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


Java QueryExecUtils.executeQuery方法代码示例

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


在下文中一共展示了QueryExecUtils.executeQuery方法的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/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

示例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/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

示例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/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

示例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/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

示例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/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

示例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/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

示例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/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

示例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/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

示例9: 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

示例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/ex9-data.ttl");

	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	
	
	
	String queryString = "SELECT ?y WHERE { <http://www.example.org/example#DannyLemon> ?y <http://www.example.org/example#Room101> }";

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

示例11: doOne

import com.hp.hpl.jena.sparql.util.QueryExecUtils; //导入方法依赖的package包/类
private static void doOne(String label, Dataset ds, Query query) {
    QueryExecution qExec = QueryExecutionFactory.create(query, ds) ;
    System.out.println("** "+label) ; System.out.flush() ;
    QueryExecUtils.executeQuery(query, qExec);
}
 
开发者ID:afs,项目名称:quack,代码行数:6,代码来源:MainQuack.java

示例12: 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/ex25-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 ?z WHERE { <http://www.example.org/example#GraduallyMix> <http://www.example.org/example#neighborStep> ?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" );		
	
	queryString = "SELECT ?z WHERE { <http://www.example.org/example#GraduallyMix> <http://www.example.org/example#inSameRecipe> ?z }";

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

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "done" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:32,代码来源:OWL_SameRecipe.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/ex27-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 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" );		
	
	queryString = "SELECT ?x WHERE { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/example#Researcher> }";

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

	QueryExecUtils.executeQuery(qexec);
	
	System.out.println( "\n-------DONE--------\n" );		
}
 
开发者ID:fogbeam,项目名称:JenaTutorial,代码行数:31,代码来源:OWL_EquivalentClass.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/ex6-data.ttl");
	
	Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
	reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel, 
               ReasonerVocabulary.RDFS_DEFAULT);
	InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
	

	Resource theFirmNode = infmodel.createResource("http://www.example.org/example#TheFirm");
	
	String queryString = "SELECT ?s ?z WHERE { ?s <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?z  }" ;
	
	QuerySolutionMap initialBinding = new QuerySolutionMap();
	initialBinding.add("s", theFirmNode );
	
	Query query = QueryFactory.create(queryString) ;
	
	QueryExecution qexec = QueryExecutionFactory.create(query, infmodel, initialBinding) ;

	QueryExecUtils.executeQuery(qexec);

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

示例15: 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/ex16-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#DepartingVessel> }";

	/* 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" );		
	
	queryString = "SELECT ?x WHERE { ?x <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.example.org/example#InServiceVessel> }";

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

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


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