本文整理匯總了Java中com.hp.hpl.jena.rdf.model.Property.getURI方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.getURI方法的具體用法?Java Property.getURI怎麽用?Java Property.getURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.rdf.model.Property
的用法示例。
在下文中一共展示了Property.getURI方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getUsage
import com.hp.hpl.jena.rdf.model.Property; //導入方法依賴的package包/類
private List<Statement> getUsage(Property property, Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#> "
+ "SELECT DISTINCT ?concept "
+ "WHERE{"
+ " {<" + property.getURI() + "> rdfs:domain ?concept} "
+ " UNION "
+ " { "
+ " ?concept rdfs:subClassOf|owl:equivalentClass ?restriction . "
+ " ?restriction a owl:Restriction; "
+ " owl:onProperty <" + property.getURI() + "> "
+ " } "
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
while(resultSet.hasNext()){
QuerySolution querySolution = resultSet.next();
Resource concept = querySolution.getResource("concept");
stmts.add(new StatementImpl(property, usage, concept));
}
return stmts;
}