本文整理了Java中org.apache.jena.query.Query.setPrefix
方法的一些代码示例,展示了Query.setPrefix
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.setPrefix
方法的具体详情如下:
包路径:org.apache.jena.query.Query
类名称:Query
方法名:setPrefix
暂无
代码示例来源:origin: apache/jena
/**
* Add a prefix to the prefix mapping.
* @param pfx The prefix to add.
* @param uri The uri to resolve the prefix to.
*/
public void addPrefix(String pfx, String uri) {
query.setPrefix(canonicalPfx(pfx), uri);
}
代码示例来源:origin: org.apache.jena/jena-querybuilder
/**
* Add a prefix to the prefix mapping.
* @param pfx The prefix to add.
* @param uri The uri to resolve the prefix to.
*/
public void addPrefix(String pfx, String uri) {
query.setPrefix(canonicalPfx(pfx), uri);
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public static String addPrefix(String queryString, Map<String, String> prefix2Namespace){
Query query = QueryFactory.create(queryString);
for (Entry<String, String> entry : prefix2Namespace.entrySet()) {
String prefix = entry.getKey();
String namespace = entry.getValue();
query.setPrefix(prefix, namespace);
}
return query.toString();
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
@Override
public Query toQuery(){
Query query = QueryFactory.make();
query.setQuerySelectType();
query.addResultVar(NodeFactory.createVariable("x0"));
query.setDistinct(true);
query.setPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
query.setPrefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
query.setPrefix("yago", "http://dbpedia.org/class/yago/");
query.setPrefix("cyc", "http://sw.opencyc.org/2008/06/10/concept/");
query.setPrefix("owl", "http://www.w3.org/2002/07/owl#");
query.setPrefix("dbp", "http://dbpedia.org/property/");
query.setPrefix("dbo", "http://dbpedia.org/ontology/");
query.setPrefix("dbr", "http://dbpedia.org/resource/");
query.setPrefix("dc", "http://purl.org/dc/terms/");
ElementGroup whereClause = new ElementGroup();
ElementTriplesBlock triples = new ElementTriplesBlock();
for(Triple t : buildTriples(this)){
triples.addTriple(t);
}
whereClause.addElement(triples);
query.setQueryPattern(whereClause);
return query;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public static String addPrefixes(String queryString, String prefix, String namespace){
Query query = QueryFactory.create(queryString);
query.setPrefix(prefix, namespace);
return query.toString();
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
for (String res : usedResources) {
if(res.startsWith(namespace)){
query.setPrefix(prefix, namespace);
break;
代码示例来源:origin: WDAqua/Qanary
query.setPrefix("dbr", "http://dbpedia.org/resource/");
query.setPrefix("dbp", "http://dbpedia.org/property/");
query.setPrefix("dbo", "http://dbpedia.org/ontology/");
String formatted = query.serialize();
formatted = formatted.replace("<", "<").replace(">", ">").replace("\n", "<br/>");
代码示例来源:origin: Galigator/openllet
q.setPrefix("rdf", RDF.getURI());
if (q.getPrefix("rdfs") == null)
q.setPrefix("rdfs", RDFS.getURI());
if (q.getPrefix("owl") == null)
q.setPrefix("owl", OWL.getURI());
if (q.getPrefix("xsd") == null)
q.setPrefix("xsd", XSD.getURI());
内容来源于网络,如有侵权,请联系作者删除!