• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ReasonerRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hp.hpl.jena.reasoner.ReasonerRegistry的典型用法代码示例。如果您正苦于以下问题:Java ReasonerRegistry类的具体用法?Java ReasonerRegistry怎么用?Java ReasonerRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ReasonerRegistry类属于com.hp.hpl.jena.reasoner包,在下文中一共展示了ReasonerRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex5-data.ttl");

	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x  ?z WHERE { ?x <http://www.example.org/example#worksFor> ?z }" ;

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n----------\ndone" );
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:24,代码来源:SparqlQueryWithPropertySubclass.java


示例2: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex13-data.ttl");
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://www.w3.org/2000/01/rdf-schema#label> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
		
	
	System.out.println( "done" );		
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:24,代码来源:RDFSLabels.java


示例3: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex12-data2.ttl");
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x WHERE { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/example#Investigator> }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	
	System.out.println( "\n---------------\n" );		
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:24,代码来源:TermReconcilation_UnionPattern.java


示例4: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex17-data2.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://cal.example.com/cal#nextDeparture> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;
			
	QueryExecUtils.executeQuery(qexec);		
	
	System.out.println( "done" );		
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:24,代码来源:RDFS_CommonProperty.java


示例5: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex12-data.ttl");
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String 	queryString = "SELECT ?x WHERE { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/example#Analyst> }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n---------------\n" );		
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:23,代码来源:TermReconciliation_Subclass.java


示例6: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex22-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://www.example.org/example#hasAncestor> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;
	
	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "done" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:21,代码来源:OWL_TransitiveProperty.java


示例7: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex30-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?facility ?location WHERE { ?p <http://www.example.org/example#manufactureLocation> ?location . ?p <http://mfg.example.org/mfg#facility> ?facility . }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);	
	
	System.out.println( "\n-------DONE--------\n" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:21,代码来源:OWLMain30_WithoutSameAs.java


示例8: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex30-data.ttl");
	
	Model sameAsData = FileManager.get().loadModel( "file:data/input/turtle/ex30-sameas.ttl" );
	data.add( sameAsData );
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?facility ?location WHERE { ?p <http://www.example.org/example#manufactureLocation> ?location . ?p <http://mfg.example.org/mfg#facility> ?facility . }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n-------DONE--------\n" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:24,代码来源:OWLMain30_WithSameAs.java


示例9: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex19-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://www.example.org/example#hasPossession> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "done" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:21,代码来源:OWL_WeirdInference.java


示例10: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex21-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://www.example.org/example#married> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n---------------\n" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:21,代码来源:OWLSymmetricProperty.java


示例11: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{
	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex20-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x ?z WHERE { ?x <http://www.w3.org/2000/01/rdf-schema#subclassOf> ?z }";

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel) ;

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n---------------\n" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:21,代码来源:AnotherInverseOfProperty.java


示例12: subprojectsSellers

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void subprojectsSellers() {

        //services for each table
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
        SubProjectSellersService sub = (SubProjectSellersService) ctx.getBean("subProjectSellersServiceImpl");

        List<SubProjectSellers> subProjectSeller = sub.getSubProjectSellers();

        //--------------RDF Model--------------//
        Model model = ModelFactory.createDefaultModel();
        Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
        InfModel infModel = ModelFactory.createInfModel(reasoner, model);

        model.setNsPrefix("elod", OntologySpecification.elodPrefix);
        model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);


        for (SubProjectSellers subProjectSeller1 : subProjectSeller) {
            Resource instanceSeller = infModel.createResource(OntologySpecification.instancePrefix
                    + "Organization/" + subProjectSeller1.getSellerId());
            Resource instanceSubProject = infModel.createResource(OntologySpecification.instancePrefix
                    + "Subproject/" + subProjectSeller1.getOps() + "/" + subProjectSeller1.getSubProjectId());
            infModel.add(instanceSeller, RDF.type, OntologySpecification.organizationResource);
            infModel.add(instanceSeller, RDF.type, OntologySpecification.businessResource);
            infModel.add(instanceSubProject, RDF.type, OntologySpecification.subProjectResource);
            instanceSubProject.addProperty(OntologySpecification.seller, instanceSeller);
        }

        try {
            FileOutputStream fout = new FileOutputStream(
                    "/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/subProjectSellersEspa.rdf");
            model.write(fout);
        } catch (IOException e) {
            System.out.println("Exception caught" + e.getMessage());
        }
    }
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:37,代码来源:SubprojectsSellersImpl.java


示例13: espaSellers

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void espaSellers() {

        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
        SellersService sellers = (SellersService) ctx.getBean("sellersServiceImpl");

        List<Sellers> seller = sellers.getSellers();

        //--------------RDF Model--------------//
        Model model = ModelFactory.createDefaultModel();
        Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
        InfModel infModel = ModelFactory.createInfModel(reasoner, model);

        model.setNsPrefix("elod", OntologySpecification.elodPrefix);
        model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
        model.setNsPrefix("vcard", OntologySpecification.vcardPrefix);

        for (Sellers seller1 : seller) {
            Resource instanceSeller = infModel.createResource(OntologySpecification.instancePrefix + "Organization/" + seller1.getId());
            infModel.add(instanceSeller, RDF.type, OntologySpecification.organizationResource);
            instanceSeller.addProperty(OntologySpecification.name, seller1.getEponimia(), XSDDatatype.XSDstring);
        }

        try {
            FileOutputStream fout = new FileOutputStream(
                    "/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/sellersEspa.rdf");
            model.write(fout);
        } catch (IOException e) {
            System.out.println("Exception caught" + e.getMessage());
        }
    }
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:31,代码来源:SellersImpl.java


示例14: applyReasoning

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
void applyReasoning(Reasoning r) {
	switch(r) {
	case rdfs:
		this.jenaModel = ModelFactory.createRDFSModel(this.jenaModel);
		break;
	case owl:
		this.jenaModel = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(),
		        this.jenaModel);
		break;
	default:
		break;
	}
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:14,代码来源:ModelImplJena.java


示例15: Validator

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
/**
 * Builds a new {@link Validator} with the given rule for determining the sample size.
 */
public Validator() {
	schema = ModelFactory.createDefaultModel();
			
	RDFDataMgr.read(schema, getClass().getResourceAsStream("/aliada-ontology.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/efrbroo.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/current.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/wgs84_pos.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/time.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/skos-xl.owl"), Lang.RDFXML);
       RDFDataMgr.read(schema, getClass().getResourceAsStream("/0.1.owl"), Lang.RDFXML);		
       
       reasoner = ReasonerRegistry.getOWLMicroReasoner().bindSchema(schema);
}
 
开发者ID:ALIADA,项目名称:aliada-tool,代码行数:17,代码来源:Validator.java


示例16: checkInferrayCorrectnessRDFSAndDumpToFiles

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
/**
 * Check the correctness for RDFS FULL, i.e. follow the RDFS specification
 * exactly, even inferring syntactic sugar.
 * <p>
 * Ontology must be in NT format
 * 
 * @param ontologyLocation
 *            where the ontology is on disk
 */
public static void checkInferrayCorrectnessRDFSAndDumpToFiles(
		final String ontologyLocation) {
	// Compute the model processed by Inferray
	final DefaultConfiguration config = new DefaultConfiguration();
	config.setRulesProfile(SupportedProfile.RDFS);
	final Inferray infere = new Inferray(config);
	infere.parse(ontologyLocation);
	infere.process();
	final Model actualModel = ExportUtils.exportToJenaModel(infere);
	// Compute the Jena Model
	final Model intemerdiateModel = ModelFactory.createDefaultModel();
	try {
		final InputStream is = new BufferedInputStream(new FileInputStream(
				ontologyLocation));
		intemerdiateModel.read(is, null, "N-TRIPLE");//
	} catch (final FileNotFoundException e) {
		LOGGER.error("Error reading file", e);
		return;
	}
	final Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel,
			ReasonerVocabulary.RDFS_FULL);
	final InfModel expectedModel = ModelFactory.createInfModel(reasoner,
			intemerdiateModel);
	// Compute correctness checking
	final CorrectnessResult result = CorrectnessChecker
			.checkForCorrectness(expectedModel, actualModel);
	result.dumpMissingToFile(new File("missing.nt"));
	result.dumpOverheadToFile(new File("overhead.nt"));
}
 
开发者ID:jsubercaze,项目名称:inferray,代码行数:40,代码来源:InferrayCorrectness.java


示例17: buildInferenceModel

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
private void buildInferenceModel() {

		OntModel vocabularyModel = this.getVocabularyModel();
		vocabularyModel.loadImports();
		//TODO which reasoner should we use as default. RDFSSimple is by far the fastest
		//TODO Reasoner boundReasoner = ReasonerRegistry.getOWLMicroReasoner();
		this.boundReasoner = ReasonerRegistry.getRDFSSimpleReasoner();
		this.boundReasoner = this.boundReasoner.bindSchema(this.vocabularyModel);
	}
 
开发者ID:peterjohnlawrence,项目名称:com.inova8.remediator,代码行数:10,代码来源:Void.java


示例18: main

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void main( String[] args )
{

	// load some data that uses RDFS
	Model data = FileManager.get().loadModel("file:data/input/turtle/ex2-data.ttl");
	
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = "SELECT ?x WHERE { ?x  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.com/shop#Shirts>}" ;

	/* Now create and execute the query using a Query object */
	Query query = QueryFactory.create(queryString) ;
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel);

	try
	{
	    ResultSet results = qexec.execSelect() ;
	    while( results.hasNext() )
	    {
	    	QuerySolution soln = results.nextSolution();
	    	System.out.println( "soln: " + soln.toString());
	    }
	}
	finally
	{
		qexec.close();
	}
	
	System.out.println( "done" );
	
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:38,代码来源:BasicSparqlQuery.java


示例19: espaSubprojects

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void espaSubprojects() throws ParseException {

        //services for each table
        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
        SubProjectsService sub = (SubProjectsService) ctx.getBean("subProjectsServiceImpl");

        List<SubProjects> subProject = sub.getSubProjects();

        //--------------RDF Model--------------//
        Model model = ModelFactory.createDefaultModel();
        Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
        InfModel infModel = ModelFactory.createInfModel(reasoner, model);

        model.setNsPrefix("elod", OntologySpecification.elodPrefix);
        model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
        model.setNsPrefix("dcterms", OntologySpecification.dctermsPrefix);

        //number format
        DecimalFormat df = new DecimalFormat("0.00");

        for (SubProjects subProject1 : subProject) {

            Resource instanceCurrency = infModel.createResource("http://linkedeconomy.org/resource/Currency/EUR");
            Resource instanceBudgetUps = infModel.createResource(OntologySpecification.instancePrefix
                    + "UnitPriceSpecification/BudgetItem/" + subProject1.getOps() + "/" + subProject1.getId());
            Resource instanceBudget = infModel.createResource(OntologySpecification.instancePrefix + "BudgetItem/" + subProject1.getOps() + "/" + subProject1.getId());
            Resource instanceSubProject = infModel.createResource(OntologySpecification.instancePrefix + "Subproject/" + subProject1.getOps() + "/" + subProject1.getId());
            Resource instanceProject = infModel.createResource(OntologySpecification.instancePrefix
                    + "Subsidy/" + subProject1.getOps());
            DateFormat dfDate = new SimpleDateFormat("dd/MM/yyyy");
            DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
            java.util.Date stDateStarts;
            java.util.Date stDateEnds;
            stDateStarts = dfDate.parse(subProject1.getStart());
            stDateEnds = dfDate.parse(subProject1.getFinish());
            String startDate = df2.format(stDateStarts);
            String endDate = df2.format(stDateEnds);
            infModel.add(instanceProject, RDF.type, OntologySpecification.projectResource);
            infModel.add(instanceBudgetUps, RDF.type, OntologySpecification.priceSpecificationResource);
            infModel.add(instanceBudget, RDF.type, OntologySpecification.budgetResource);
            infModel.add(instanceSubProject, RDF.type, OntologySpecification.subProjectResource);
            instanceProject.addProperty(OntologySpecification.hasRelatedProject, instanceSubProject);
            instanceSubProject.addProperty(OntologySpecification.hasRelatedBudgetItem, instanceBudget);
            instanceBudget.addProperty(OntologySpecification.price, instanceBudgetUps);
            instanceBudgetUps.addProperty(OntologySpecification.hasCurrencyValue, df.format(subProject1.getBudget()), XSDDatatype.XSDfloat);
            instanceBudgetUps.addProperty(OntologySpecification.valueAddedTaxIncluded, "true", XSDDatatype.XSDboolean);
            instanceBudgetUps.addProperty(OntologySpecification.hasCurrency, instanceCurrency);
            instanceSubProject.addProperty(OntologySpecification.startDate, startDate, XSDDatatype.XSDdateTime);
            instanceSubProject.addProperty(OntologySpecification.endDate, endDate, XSDDatatype.XSDdateTime);
            instanceSubProject.addProperty(OntologySpecification.title, String.valueOf(subProject1.getTitle()), "el");
        }

        try {
            FileOutputStream fout = new FileOutputStream(
                    "/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/subProjectEspa.rdf");
            model.write(fout);
        } catch (IOException e) {
            System.out.println("Exception caught" + e.getMessage());
        }
    }
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:61,代码来源:SubProjectsImpl.java


示例20: espaBuyers

import com.hp.hpl.jena.reasoner.ReasonerRegistry; //导入依赖的package包/类
public static void espaBuyers() {

        ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
        BuyersService buyers = (BuyersService) ctx.getBean("buyersServiceImpl");

        List<Buyers> buyer = buyers.getBuyers();
        List<Buyer> projectBuyer = buyers.getProjectBuyers();

        //--------------RDF Model--------------//
        Model model = ModelFactory.createDefaultModel();
        Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
        InfModel infModel = ModelFactory.createInfModel(reasoner, model);

        model.setNsPrefix("elod", OntologySpecification.elodPrefix);
        model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
        model.setNsPrefix("vcard", OntologySpecification.vcardPrefix);

        for (Buyer projectBuyer1 : projectBuyer) {

            Resource instanceBuyer = infModel.createResource(OntologySpecification.instancePrefix + "Organization/" + projectBuyer1.getBuyerId());
            Resource instanceProject = infModel.createResource(OntologySpecification.instancePrefix + "Subsidy/" + projectBuyer1.getOps());


            infModel.add(instanceBuyer, RDF.type, OntologySpecification.organizationResource);
            infModel.add(instanceProject, RDF.type, OntologySpecification.subsidyResource);

            instanceProject.addProperty(OntologySpecification.beneficiary, instanceBuyer);
            instanceBuyer.addProperty(OntologySpecification.name, String.valueOf(projectBuyer1.getEponimia()), XSDDatatype.XSDstring);

        }


        try {
            FileOutputStream fout = new FileOutputStream(
                    "/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/buyersEspa.rdf");
            // /home/svaf/buyersEspa.rdf
            // /Users/giovaf/Documents/yds_pilot1/espa_tests/06-01-2016_output/buyersEspa.rdf
            model.write(fout);
        } catch (IOException e) {
            System.out.println("Exception caught" + e.getMessage());
        }
    }
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:43,代码来源:BuyersImpl.java



注:本文中的com.hp.hpl.jena.reasoner.ReasonerRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BrowserLauncher类代码示例发布时间:2022-05-22
下一篇:
Java InputConnectionCompat类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap