當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.listProperties方法代碼示例

本文整理匯總了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");
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:20,代碼來源:D2RQReader.java

示例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();
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:23,代碼來源:JenaModelExample.java

示例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());
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:22,代碼來源:D2RQReader.java

示例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;
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:19,代碼來源:R2RMLReader.java

示例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;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:13,代碼來源:PageServlet.java

示例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;
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:14,代碼來源:DatasetDescriptionServlet.java

示例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);
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:80,代碼來源:D2RQReader.java

示例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);
	}
}
 
開發者ID:aitoralmeida,項目名稱:c4a_data_repository,代碼行數:80,代碼來源:MapParser.java


注:本文中的com.hp.hpl.jena.rdf.model.Resource.listProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。