J'exécute ce code sur ce site MESH Query il renvoie les bons résultats Mais quand j'ai exécuté en utilisant Jena, il renvoie null. Sur JenaProblème d'exécution de requête SPARQL pour MESH Endpoint
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);
Je suppose que vous devez activer RDFS inférences, probablement, via 'qe.addParam ('inférence , 'true') ' –
cette fonction n'existe pas. –
Très probablement. L'idée est que vous devez définir '& inference = true' dans l'URL demandée. Avez-vous vu "l'inférence RDFS?" case à cocher dans l'interface utilisateur? –