我在這個網站上執行此代碼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推理?」用戶界面中的複選框? –