我在这个网站上执行此代码MESH Query它返回正确的结果 但是,当我使用耶拿执行它会返回null。 在耶拿问题执行MESH端点的SPARQL查询
String s = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX meshv: <http://id.nlm.nih.gov/mesh/vocab#>
PREFIX mesh: <http://id.nlm.nih.gov/mesh/>
PREFIX mesh2015: <http://id.nlm.nih.gov/mesh/2015/>
PREFIX mesh2016: <http://id.nlm.nih.gov/mesh/2016/>
PREFIX mesh2017: <http://id.nlm.nih.gov/mesh/2017/>
SELECT ?d ?dName ?c ?cName
FROM <http://id.nlm.nih.gov/mesh>
WHERE {
?d a meshv:Descriptor .
?d meshv:concept ?c .
?d rdfs:label ?dName .
?c rdfs:label ?cName
FILTER(REGEX(?dName,'infection','i') || REGEX(?cName,'infection','i'))
}
ORDER BY ?d ";
Query query = QueryFactory.create(s);
QueryExecution qe = QueryExecutionFactory.sparqlService("http://id.nlm.nih.gov/mesh/sparql", query);
ResultSet results = qe.execSelect();
ResultSetFormatter.out(System.out, results, query);
我想你必须启用RDFS推理,很可能通过'qe.addParam(“推理”, 'true')' –
这个函数不存在。 –
最有可能。这个想法是你必须在URL中设置'&inference = true'。你有没有看到“RDFS推理?”用户界面中的复选框? –