本文整理汇总了Java中com.hp.hpl.jena.vocabulary.RDFS.getURI方法的典型用法代码示例。如果您正苦于以下问题:Java RDFS.getURI方法的具体用法?Java RDFS.getURI怎么用?Java RDFS.getURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.vocabulary.RDFS
的用法示例。
在下文中一共展示了RDFS.getURI方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandSubClasses
import com.hp.hpl.jena.vocabulary.RDFS; //导入方法依赖的package包/类
private List<Statement> expandSubClasses(Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
+ "SELECT DISTINCT ?class ?synonym "
+ "WHERE { "
+ "?class rdfs:subClassOf+ ?subClass . "
+ "?subClass <" + synonym + "> ?synonym"
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
resultSet.forEachRemaining(querySolution -> {
stmts.add(new StatementImpl(querySolution.getResource("class"), synonym, querySolution.getLiteral("synonym")));
});
return stmts;
}
示例2: expandSubProperties
import com.hp.hpl.jena.vocabulary.RDFS; //导入方法依赖的package包/类
private List<Statement> expandSubProperties(Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
+ "SELECT DISTINCT ?property ?synonym "
+ "WHERE { "
+ "?property rdfs:subPropertyOf+ ?subProperty . "
+ "?subProperty <" + synonym + "> ?synonym"
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
resultSet.forEachRemaining(querySolution -> {
stmts.add(new StatementImpl(querySolution.getResource("property"), synonym, querySolution.getLiteral("synonym")));
});
return stmts;
}
示例3: getSubClasses
import com.hp.hpl.jena.vocabulary.RDFS; //导入方法依赖的package包/类
private List<Resource> getSubClasses(Resource r) {
List<Resource> resources = new ArrayList<Resource>();
String query = "\n" + "prefix rdfs: <" + RDFS.getURI() + ">\n" + "\n"
+ "select distinct ?class where {\n"
+ " ?class rdfs:subClassOf/rdfs:subClassOf* <" + r.getURI()
+ "> \n" + "}";
ResultSet results = QueryExecutionFactory.create(query, schema)
.execSelect();
while (results.hasNext()) {
resources.add(results.next().getResource("class"));
}
return resources;
}