当前位置: 首页>>代码示例>>Java>>正文


Java QueryExecUtils类代码示例

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


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

示例1: main

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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.sparql.util.QueryExecUtils; //导入依赖的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: runPlan

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入依赖的package包/类
private static void runPlan(Plan plan) {
    //QueryExecUtils.execute(op, dsg)
    List<String> vars = null ;
    ResultsFormat outputFormat = ResultsFormat.FMT_TEXT ;
    
    Op op = plan.getOp();
    if ( op instanceof OpProject )
        vars = Var.varNames(((OpProject)op).getVars()) ;
    else
        vars = Var.varNames(OpVars.visibleVars(op)) ;

    ResultSet results = ResultSetFactory.create(plan.iterator(), vars) ;
    QueryExecUtils.outputResultSet(results, null, outputFormat) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:15,代码来源:RefactorQueryExecution.java

示例13: main

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入依赖的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) ;

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

示例14: main

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入依赖的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 ?y ?z WHERE { ?x ?y ?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,代码行数:26,代码来源:SparqlQueryForAllTriples.java

示例15: main

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入依赖的package包/类
public static void main(String[] args) 
{
	Dataset dataset = DatasetFactory.createMem();
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	
	InfModel infmodel = ModelFactory.createInfModel(reasoner, dataset.getDefaultModel() );
	
	/* Do a SPARQL Query over the data in the model */
	String queryString = 
		"SELECT * WHERE { SERVICE <http://dbpedia.org/sparql> {  <http://dbpedia.org/resource/George_Harrison> ?p ?o . } } LIMIT 10";

	/* 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,代码行数:25,代码来源:FederatedSparqlQuery.java


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