本文整理汇总了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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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" );
}
示例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) ;
}
示例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" );
}
示例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" );
}
示例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" );
}