本文整理匯總了Java中com.hp.hpl.jena.rdf.model.Resource.listProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.listProperties方法的具體用法?Java Resource.listProperties怎麽用?Java Resource.listProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.rdf.model.Resource
的用法示例。
在下文中一共展示了Resource.listProperties方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseConfiguration
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private void parseConfiguration() {
Iterator<Individual> it = this.model.listIndividuals(D2RQ.Configuration);
if (it.hasNext()) {
Resource configResource = it.next();
Configuration configuration = new Configuration(configResource);
StmtIterator stmts = configResource.listProperties(D2RQ.serveVocabulary);
while (stmts.hasNext()) {
configuration.setServeVocabulary(stmts.nextStatement().getBoolean());
}
stmts = configResource.listProperties(D2RQ.useAllOptimizations);
while (stmts.hasNext()) {
configuration.setUseAllOptimizations(stmts.nextStatement().getBoolean());
}
this.mapping.setConfiguration(configuration);
if (it.hasNext())
throw new D2RQException("Only one configuration block is allowed");
}
}
示例2: main
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
public static void main(String[] args) {
// Set up the ModelD2RQ using a mapping file
ModelD2RQ m = new ModelD2RQ("file:doc/example/mapping-iswc.ttl");
// Find anything with an rdf:type of iswc:InProceedings
StmtIterator paperIt = m.listStatements(null, RDF.type, ISWC.InProceedings);
// List found papers and print their titles
while (paperIt.hasNext()) {
Resource paper = paperIt.nextStatement().getSubject();
System.out.println("Paper: " + paper.getProperty(DC.title).getString());
// List authors of the paper and print their names
StmtIterator authorIt = paper.listProperties(DC.creator);
while (authorIt.hasNext()) {
Resource author = authorIt.nextStatement().getResource();
System.out.println("Author: " + author.getProperty(FOAF.name).getString());
}
System.out.println();
}
m.close();
}
示例3: parseDownloadMap
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private void parseDownloadMap(DownloadMap dm, Resource r) {
StmtIterator stmts;
stmts = r.listProperties(D2RQ.dataStorage);
while (stmts.hasNext()) {
dm.setDatabase(mapping.database(
stmts.nextStatement().getResource()));
}
stmts = r.listProperties(D2RQ.belongsToClassMap);
while (stmts.hasNext()) {
dm.setBelongsToClassMap(mapping.classMap(
stmts.nextStatement().getResource()));
}
stmts = r.listProperties(D2RQ.contentDownloadColumn);
while (stmts.hasNext()) {
dm.setContentDownloadColumn(stmts.nextStatement().getString());
}
stmts = r.listProperties(D2RQ.mediaType);
while (stmts.hasNext()) {
dm.setMediaType(stmts.nextStatement().getString());
}
}
示例4: getRDFNodes
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
public List<RDFNode> getRDFNodes(Resource r, Property p, NodeType acceptableNodes) {
List<RDFNode> result = new ArrayList<RDFNode>();
StmtIterator it = r.listProperties(p);
while (it.hasNext()) {
Statement stmt = it.next();
remainingTriples.remove(stmt);
if (acceptableNodes.isTypeOf(stmt.getObject())) {
result.add(stmt.getObject());
} else {
if (acceptableNodes.coerce(stmt.getObject()) != null) {
result.add(acceptableNodes.coerce(stmt.getObject()));
}
report.report(acceptableNodes.ifNot, r, p, stmt.getObject());
}
}
Collections.sort(result, RDFComparator.getRDFNodeComparator());
return result;
}
示例5: collectProperties
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private Collection<Property> collectProperties(Model m, Resource r) {
Collection<Property> result = new TreeSet<Property>();
StmtIterator it = r.listProperties();
while (it.hasNext()) {
result.add(new Property(it.nextStatement(), false));
}
it = m.listStatements(null, null, r);
while (it.hasNext()) {
result.add(new Property(it.nextStatement(), true));
}
return result;
}
示例6: generatePartitions
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private static Set<Resource> generatePartitions(Model m, Resource type,
Property p) {
Set<Resource> partitions = new HashSet<Resource>();
ResIterator classIt = m.listResourcesWithProperty(RDF.type, type);
while (classIt.hasNext()) {
Resource classMap = classIt.next();
StmtIterator pIt = classMap.listProperties(p);
while (pIt.hasNext()) {
partitions.add((Resource) pIt.next().getObject());
}
}
return partitions;
}
示例7: parsePropertyBridge
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private void parsePropertyBridge(PropertyBridge bridge, Resource r) {
StmtIterator stmts;
stmts = r.listProperties(D2RQ.column);
while (stmts.hasNext()) {
if (r.getProperty(RDF.type).equals(D2RQ.ObjectPropertyBridge)) {
// Legacy
bridge.setURIColumn(Microsyntax.parseColumn(stmts.nextStatement().getString()));
} else {
bridge.setColumn(Microsyntax.parseColumn(stmts.nextStatement().getString()));
}
}
stmts = r.listProperties(D2RQ.pattern);
while (stmts.hasNext()) {
if (r.getProperty(RDF.type).equals(D2RQ.ObjectPropertyBridge)) {
// Legacy
bridge.setURIPattern(stmts.nextStatement().getString());
} else {
bridge.setPattern(stmts.nextStatement().getString());
}
}
stmts = r.listProperties(D2RQ.sqlExpression);
while (stmts.hasNext()) {
bridge.setSQLExpression(stmts.nextStatement().getString());
}
stmts = r.listProperties(D2RQ.lang);
while (stmts.hasNext()) {
bridge.setLang(stmts.nextStatement().getString());
}
stmts = r.listProperties(D2RQ.datatype);
while (stmts.hasNext()) {
bridge.setDatatype(stmts.nextStatement().getResource().getURI());
}
stmts = r.listProperties(D2RQ.refersToClassMap);
while (stmts.hasNext()) {
Resource classMapResource = stmts.nextStatement().getResource();
bridge.setRefersToClassMap(this.mapping.classMap(classMapResource));
}
stmts = r.listProperties(D2RQ.dynamicProperty);
while (stmts.hasNext()) {
bridge.addDynamicProperty(stmts.next().getString());
}
stmts = r.listProperties(D2RQ.property);
while (stmts.hasNext()) {
bridge.addProperty(stmts.nextStatement().getResource());
}
stmts = this.model.listStatements(null, D2RQ.propertyBridge, r);
while (stmts.hasNext()) {
bridge.addProperty(stmts.nextStatement().getSubject());
}
stmts = r.listProperties(D2RQ.propertyDefinitionLabel);
while (stmts.hasNext()) {
bridge.addDefinitionLabel(stmts.nextStatement().getLiteral());
}
stmts = r.listProperties(D2RQ.propertyDefinitionComment);
while (stmts.hasNext()) {
bridge.addDefinitionComment(stmts.nextStatement().getLiteral());
}
stmts = r.listProperties(D2RQ.additionalPropertyDefinitionProperty);
while (stmts.hasNext()) {
Resource additionalProperty = stmts.nextStatement().getResource();
bridge.addAdditionalDefinitionProperty(additionalProperty);
}
stmts = r.listProperties(D2RQ.limit);
while (stmts.hasNext()) {
bridge.setLimit(stmts.nextStatement().getInt());
}
stmts = r.listProperties(D2RQ.limitInverse);
while (stmts.hasNext()) {
bridge.setLimitInverse(stmts.nextStatement().getInt());
}
stmts = r.listProperties(D2RQ.orderDesc);
while (stmts.hasNext()) {
bridge.setOrder(stmts.nextStatement().getString(), true);
}
stmts = r.listProperties(D2RQ.orderAsc);
while (stmts.hasNext()) {
bridge.setOrder(stmts.nextStatement().getString(), false);
}
}
示例8: parsePropertyBridge
import com.hp.hpl.jena.rdf.model.Resource; //導入方法依賴的package包/類
private void parsePropertyBridge(PropertyBridge bridge, Resource r) {
StmtIterator stmts;
stmts = r.listProperties(D2RQ.column);
while (stmts.hasNext()) {
if (r.getProperty(RDF.type).equals(D2RQ.ObjectPropertyBridge)) {
// Legacy
bridge.setURIColumn(stmts.nextStatement().getString());
} else {
bridge.setColumn(stmts.nextStatement().getString());
}
}
stmts = r.listProperties(D2RQ.pattern);
while (stmts.hasNext()) {
if (r.getProperty(RDF.type).equals(D2RQ.ObjectPropertyBridge)) {
// Legacy
bridge.setURIPattern(stmts.nextStatement().getString());
} else {
bridge.setPattern(stmts.nextStatement().getString());
}
}
stmts = r.listProperties(D2RQ.sqlExpression);
while (stmts.hasNext()) {
bridge.setSQLExpression(stmts.nextStatement().getString());
}
stmts = r.listProperties(D2RQ.lang);
while (stmts.hasNext()) {
bridge.setLang(stmts.nextStatement().getString());
}
stmts = r.listProperties(D2RQ.datatype);
while (stmts.hasNext()) {
bridge.setDatatype(stmts.nextStatement().getResource().getURI());
}
stmts = r.listProperties(D2RQ.refersToClassMap);
while (stmts.hasNext()) {
Resource classMapResource = stmts.nextStatement().getResource();
bridge.setRefersToClassMap(this.mapping.classMap(classMapResource));
}
stmts = r.listProperties(D2RQ.dynamicProperty);
while (stmts.hasNext()) {
bridge.addDynamicProperty(stmts.next().getString());
}
stmts = r.listProperties(D2RQ.property);
while (stmts.hasNext()) {
bridge.addProperty(stmts.nextStatement().getResource());
}
stmts = this.model.listStatements(null, D2RQ.propertyBridge, r);
while (stmts.hasNext()) {
bridge.addProperty(stmts.nextStatement().getSubject());
}
stmts = r.listProperties(D2RQ.propertyDefinitionLabel);
while (stmts.hasNext()) {
bridge.addDefinitionLabel(stmts.nextStatement().getLiteral());
}
stmts = r.listProperties(D2RQ.propertyDefinitionComment);
while (stmts.hasNext()) {
bridge.addDefinitionComment(stmts.nextStatement().getLiteral());
}
stmts = r.listProperties(D2RQ.additionalPropertyDefinitionProperty);
while (stmts.hasNext()) {
Resource additionalProperty = stmts.nextStatement().getResource();
bridge.addDefinitionProperty(additionalProperty);
}
stmts = r.listProperties(D2RQ.limit);
while (stmts.hasNext()) {
bridge.setLimit(stmts.nextStatement().getInt());
}
stmts = r.listProperties(D2RQ.limitInverse);
while (stmts.hasNext()) {
bridge.setLimitInverse(stmts.nextStatement().getInt());
}
stmts = r.listProperties(D2RQ.orderDesc);
while (stmts.hasNext()) {
bridge.setOrder(stmts.nextStatement().getString(), true);
}
stmts = r.listProperties(D2RQ.orderAsc);
while (stmts.hasNext()) {
bridge.setOrder(stmts.nextStatement().getString(), false);
}
}