本文整理汇总了Java中com.hp.hpl.jena.reasoner.Reasoner.setParameter方法的典型用法代码示例。如果您正苦于以下问题:Java Reasoner.setParameter方法的具体用法?Java Reasoner.setParameter怎么用?Java Reasoner.setParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.reasoner.Reasoner
的用法示例。
在下文中一共展示了Reasoner.setParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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.reasoner.Reasoner; //导入方法依赖的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.reasoner.Reasoner; //导入方法依赖的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" );
}
示例4: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例5: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例6: checkInferrayCorrectnessRDFSAndDumpToFiles
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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"));
}
示例7: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例8: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例9: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例10: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例11: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的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" );
}
示例12: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的package包/类
public static void main( String[] args )
{
// load some data that uses RDFS
Model data = FileManager.get().loadModel("file:data/input/turtle/ex11-data.ttl");
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel,
ReasonerVocabulary.RDFS_DEFAULT);
InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
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( "\n---------------\n" );
}
示例13: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的package包/类
public static void main( String[] args )
{
// load some data that uses RDFS
Model data = FileManager.get().loadModel("file:data/input/turtle/ex8-data.ttl");
Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
reasoner.setParameter(ReasonerVocabulary.PROPsetRDFSLevel,
ReasonerVocabulary.RDFS_DEFAULT);
InfModel infmodel = ModelFactory.createInfModel(reasoner, data );
String queryString = "SELECT ?z WHERE { <http://www.example.org/example#Kildaire> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?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" );
}
示例14: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的package包/类
public static void main( String[] args )
{
// load some data that uses RDFS
Model data = FileManager.get().loadModel("file:data/input/turtle/ex10-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#AllStarCandidate> }";
/* 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" );
}
示例15: main
import com.hp.hpl.jena.reasoner.Reasoner; //导入方法依赖的package包/类
public static void main( String[] args )
{
// load some data that uses RDFS
Model data = FileManager.get().loadModel("file:data/input/turtle/ex17-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 ?y ?z WHERE { <http://www.example.org/example#Johanne> ?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---------------\n" );
}