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