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


Java ResourceFactory.createProperty方法代碼示例

本文整理匯總了Java中com.hp.hpl.jena.rdf.model.ResourceFactory.createProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java ResourceFactory.createProperty方法的具體用法?Java ResourceFactory.createProperty怎麽用?Java ResourceFactory.createProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hp.hpl.jena.rdf.model.ResourceFactory的用法示例。


在下文中一共展示了ResourceFactory.createProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addRowToMODEL

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private void addRowToMODEL(List<Statement> sa, String key, String puri) {
	for (Statement s : sa) {
		if (MODEL.contains(s)) {
			continue;
		}
		// add to existing resource with same key if exists
		if (s.getPredicate().getLocalName().equals(key)) {
			ResIterator it	=	MODEL.listResourcesWithProperty(s.getPredicate(), s.getObject());
			if (it.hasNext()) { // assume all members are equal
				Resource rsc	= it.nextResource(); // get parent
				Property p	= ResourceFactory.createProperty(genOURI(), puri);
				Statement st	= ResourceFactory.createStatement(rsc, p, s.getSubject());

				MODEL.add(st);

				continue;
			}
		}

		MODEL.add(s);
	}
}
 
開發者ID:wxwilcke,項目名稱:mdb2rdf,代碼行數:23,代碼來源:RdbToRdf.java

示例2: convertRowToStatement

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private List<Statement> convertRowToStatement(Table table, Row row, Resource rcs) {
	List<Statement> sa	= new ArrayList<Statement>(row.size()); 
	int i = 0;
	
	Set<String> attrs = row.keySet();
	for (String attr : attrs) {
		RDFNode attrRcs;
		Object value	= row.get(attr);
		if (value == null || excludedValue(attr.toString(), value.toString())) { // dealing with empty and excluded values
			continue;
		} else {
			attrRcs	= createRDFNode(table.getColumn(attr), value);
		}

		Property p	= ResourceFactory.createProperty(genOURI(), attr.toString());
		Statement s	= ResourceFactory.createStatement(rcs, p, attrRcs);
		
		sa.add(s);
	}

	return sa;
}
 
開發者ID:wxwilcke,項目名稱:mdb2rdf,代碼行數:23,代碼來源:RdbToRdf.java

示例3: setUp

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
@BeforeMethod
public void setUp() {
  source = ResourceFactory.createResource();
  target = ResourceFactory.createResource();

  mid = ResourceFactory.createResource();
  final Resource y = ResourceFactory.createResource();

  final Property p = ResourceFactory.createProperty("urn:example:p");
  final Model model = ModelFactory.createDefaultModel();

  // a path of length 3
  model.add(source, p, mid);
  model.add(mid, p, y);
  model.add(y, p, target);

  // a shorter path of length 2
  model.add(source, p, mid);
  model.add(mid, p, target);

  finder = new ShortestPathFinder(model, p);
}
 
開發者ID:ewie,項目名稱:cobalt,代碼行數:23,代碼來源:ShortestPathFinderTest.java

示例4: prepare

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
@Override
public void prepare(Map conf, TopologyContext context,	OutputCollector collector) {
	this.collector = collector;
	graph = Factory.createDefaultGraph();
	startingPatternId = (String) conf.get("STARTING_PATTERN_ID");
	Resource subject = null;
	if ((conf.get(startingPatternId + "_SUBJECT")) != null) {
		subject = ResourceFactory.createResource((String) conf.get(startingPatternId + "_SUBJECT"));
	}
	Property predicate = null;
	if ((conf.get(startingPatternId + "_PREDICATE")) != null) {
		predicate = ResourceFactory.createProperty((String) conf.get(startingPatternId + "_PREDICATE"));
	}
	Resource object = null;
	if ((conf.get(startingPatternId + "_OBJECT")) != null) {
		object = ResourceFactory.createProperty((String) conf.get(startingPatternId + "_OBJECT"));
	}
	startingPattern = new SimpleSelector(subject, predicate, object);
}
 
開發者ID:allaves,項目名稱:storm-query-operators,代碼行數:20,代碼來源:Triple2GraphBolt.java

示例5: wireTopology

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private void wireTopology() {
	
	String fileName = "data/Earthquakes-Spain-2013.ttl";
	String spoutId = "rdfStreamSpout";
	String triple2graph = "triple2graph";
	String graphCounter = "graphCounter";
	String finalCounter = "finalCounter";
	
	// TODO: Get the triple pattern from the configuration/context 
	SimpleSelector startingPattern = new SimpleSelector(null, 
			ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
			ResourceFactory.createResource("http://purl.oclc.org/NET/ssnx/ssn#FeatureOfInterest"));
	
	builder.setSpout(spoutId, new RDFStreamSpout(fileName));
	builder.setBolt(triple2graph, new Triple2GraphBolt(STARTING_PATTERN_ID)).shuffleGrouping(spoutId);
	builder.setBolt(graphCounter, new RollingCountBolt(15, 3)).fieldsGrouping(triple2graph, new Fields("name"));
	builder.setBolt(finalCounter, new AckerPrinterBolt()).globalGrouping(graphCounter);
}
 
開發者ID:allaves,項目名稱:storm-query-operators,代碼行數:19,代碼來源:GraphCounterTopology.java

示例6: doGet

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
public boolean doGet(String relativeURI, 
		HttpServletRequest request,
		HttpServletResponse response,
		Configuration config) throws IOException, ServletException {
	
	Matcher matcher = pattern.matcher(relativeURI);
	if (!matcher.matches()) {
		return false;
	}
	boolean isInverse = "-".equals(matcher.group(1));
	String prefix = matcher.group(2);
	String localName = matcher.group(3);
	if (config.getPrefixes().getNsPrefixURI(prefix) == null) {
		return false;
	}
	Property property = ResourceFactory.createProperty(
			config.getPrefixes().getNsPrefixURI(prefix), localName);
	MappedResource resource = config.getMappedResourceFromRelativeWebURI(
			matcher.group(4), false);
	doGet(resource, property, isInverse, request, response, config);
	return true;
}
 
開發者ID:health-and-care-developer-network,項目名稱:health-and-care-developer-network,代碼行數:23,代碼來源:BasePathServlet.java

示例7: testOsloHasMainLanguageNorwegian

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
@Test
public void testOsloHasMainLanguageNorwegian() {
  Individual oslo = exercise31.getIndividual("Oslo");
  Property mainLanguage = ResourceFactory.createProperty(Exercise3.NS, "hasMainLanguage");
  RDFNode norwegian = ResourceFactory.createResource(Exercise3.NS + "Norwegian");
  Assert.assertTrue(oslo.hasProperty(mainLanguage, norwegian));
}
 
開發者ID:mehmandarov,項目名稱:zebra-puzzle-workshop,代碼行數:8,代碼來源:Exercise31Test.java

示例8: getProperty

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private static Property getProperty(String localName, Context context) {
	String expanded = null;
	try {
		if (localName.equals("types")) {
			expanded = RDF.type.getURI();
		} else {
			expanded = ContextUtil.expandIdentifierAsPropertyOrType(
					localName, context);
		}
	} catch (JsonLdError e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return ResourceFactory.createProperty(expanded);
}
 
開發者ID:phenopackets,項目名稱:phenopacket-reference-implementation,代碼行數:16,代碼來源:RdfReader.java

示例9: isInstanceOfTheClass

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private boolean isInstanceOfTheClass(Resource resource, Resource class_resource) {
	Property type_property = ResourceFactory.createProperty(Namespaces.RDF + "type");
	
	if (resource == null || !resource.isResource())
		return true;
	
	if (resource.hasProperty(type_property, class_resource))
		return true;
	else
		return false;
}
 
開發者ID:therelaxist,項目名稱:spring-usc,代碼行數:12,代碼來源:WebServiceLoader.java

示例10: writeConceptsToRdf

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
/**
	 * This method adds concepts to a model retrieved from original RDF file 
	 * and stores it in enriched RDF file.
	 * @param concepts The list of concepts
	 * @param inputFileName The original RDF file
	 * @param pathToAnalysisFolder The location for enriched RDF file
	 */
	public boolean writeConceptsToRdf(List<Concept> concepts, String inputFileName, String pathToAnalysisFolder) {

		boolean res = false;
		
    	Model model = createModelFromRdfFile(inputFileName);
		
		ResIterator itrConcepts = model.listSubjects();
		while (itrConcepts.hasNext()) {
			Resource rdfNode = itrConcepts.next();
        	System.out.println("rdfNode: " + rdfNode.toString());
        	Property p = null;
        	String object = null;
			StmtIterator itr = model.listStatements(rdfNode, p, object);
	    	
	    	while (itr.hasNext()) {
	    		Statement statement = itr.next();
	        	Triple triple = statement.asTriple();
	        	Concept curConcept = getConceptByUrl(concepts, triple.getSubject().toString());
		        if (curConcept.getCloseMatch() != null 
		        		&& StringUtils.isNotEmpty(curConcept.getCloseMatch().get(WIKIDATA_ID_CLOSE_MATCH_KEY))) {
    				// set subject, predicate, object
	        		Resource subject = statement.getSubject();
	        		Property predicate = ResourceFactory.createProperty(CLOSE_MATCH_PREDICATE_URL);
	        		Resource rdfObject = ResourceFactory.createResource(
	        				WIKIDATA_BASE_URL +
	        				curConcept.getCloseMatch().get(WIKIDATA_ID_CLOSE_MATCH_KEY));
	        		Statement newStatement = ResourceFactory.createStatement(subject, predicate, rdfObject);
       				model.add(newStatement);
       				break;
	        	}	
	    	}
		}
		
    	// write model to standard out
//    	model.write(System.out);
		res = writeModelToFile(model, pathToAnalysisFolder + RDF_RES_FILE_NAME);
		
		return res;
	}
 
開發者ID:gsergiu,項目名稱:music-genres,代碼行數:47,代碼來源:SkosUtils.java

示例11: handleCycles

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
@Test
public void handleCycles() {
  final Resource source = ResourceFactory.createResource();
  final Resource target = ResourceFactory.createResource();
  final Property p = ResourceFactory.createProperty("urn:example:p");

  final Model m = ModelFactory.createDefaultModel();
  m.add(source, p, target);
  m.add(target, p, source);

  final ShortestPathFinder finder = new ShortestPathFinder(m, p);
  assertEquals(finder.findShortestPath(source, target), asList(source, target));
}
 
開發者ID:ewie,項目名稱:cobalt,代碼行數:14,代碼來源:ShortestPathFinderTest.java

示例12: prepare

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
@Override
	public void prepare(Map conf, TridentOperationContext context) {
		super.prepare(conf, context);
		graph = Factory.createDefaultGraph();
		// TODO: Get the triple pattern from the configuration/context 
		statementPattern = new SimpleSelector(null, 
				ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
				ResourceFactory.createResource("http://purl.oclc.org/NET/ssnx/ssn#FeatureOfInterest")); 
//		System.out.println("PRINTED PATTERN: " + statementPattern.toString());
//		Statement aux = ResourceFactory.createStatement(ResourceFactory.createResource("http://earthquakes.linkeddata.es/1185937"), 
//				ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), 
//				ResourceFactory.createResource("http://purl.oclc.org/NET/ssnx/ssn#FeatureOfInterest"));
//		System.out.println("PRINTED TRIPLE: " + aux);
//		System.out.println("MATCHING?? " + statementPattern.test(aux));
	}
 
開發者ID:allaves,項目名稱:storm-query-operators,代碼行數:16,代碼來源:Triple2Graph.java

示例13: property

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
protected static final Property property( String local )
{ return ResourceFactory.createProperty( uri, local ); }
 
開發者ID:BenzclyZhang,項目名稱:BimSPARQL,代碼行數:3,代碼來源:GEOM.java

示例14: property

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
private static final Property property(String local) {
	return ResourceFactory.createProperty(URI, local);
}
 
開發者ID:wikipathways,項目名稱:GPML2RDF,代碼行數:4,代碼來源:SIO.java

示例15: convertToJenaProperty

import com.hp.hpl.jena.rdf.model.ResourceFactory; //導入方法依賴的package包/類
public Property convertToJenaProperty( final BigdataResource r )
{
    return ResourceFactory.createProperty( r.stringValue() );        
}
 
開發者ID:hartig,項目名稱:BlazegraphBasedTPFServer,代碼行數:5,代碼來源:BigdataStatementToJenaStatementMapper.java


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