次の CONSTRUCT クエリに基づいて、いくつかの新しいトリプルを推測しようとしています。
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX gpml: <http://vocabularies.wikipathways.org/gpml#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
CONSTRUCT {
?line rdf:type wp:DirectedInteraction .
}
WHERE {
?pathway dc:identifier ?wpIdentifier .{
SELECT DISTINCT * WHERE {
?datanode2 dc:identifier ?dn2Identifier .
?datanode2 rdf:type gpml:DataNode .
?datanode2 dcterms:isPartOf ?pathway .
?datanode2 gpml:graphid ?dn2GraphId .
?line gpml:graphref ?dn2GraphId .
FILTER (?datanode2 != ?datanode1)
FILTER (!regex(str(?datanode2), "noIdentifier")) .
{
SELECT DISTINCT * WHERE {
?datanode1 dc:identifier ?dn1Identifier .
?datanode1 gpml:graphid ?dn1GraphId .
?datanode1 rdf:type gpml:DataNode .
?datanode1 dcterms:isPartOf ?pathway .
?line gpml:graphref ?dn1GraphId .
?line rdf:type gpml:Interaction .
?line gpml:arrowTowards ?target .
?line gpml:arrowHead "Arrow"^^xsd:string .
?line gpml:graphid ?lineGraphId .
?line dcterms:isPartOf ?pathway .}}
FILTER (!regex(str(?datanode1), "noIdentifier")) .
}
}
}
名手ベースの SPARQL エンドポイントに送信すると、期待される結果が返されます。ただし、同じクエリが Jena ベースのエンドポイントに対して送信されると、0 個のトリプルが返されます。
public static void main(String[] args) throws IOException {
Model model = FileManager.get().loadModel("/tmp/wpContent_v0.0.72733_20131216.ttl");
BufferedReader constructQueryText = new BufferedReader(new FileReader("sparqlQueries/DirectedInteraction.construct"));
StringBuilder sb = new StringBuilder();
String line = constructQueryText.readLine();
while (line != null) {
sb.append(line);
sb.append('\n');
line = constructQueryText.readLine();
}
String queryText = sb.toString();
Query query = QueryFactory.create(queryText);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
Model results = queryExecution.execConstruct();
basicCalls.saveRDF2File(results, "/tmp/directedInteractions.ttl", "TURTLE");
System.out.println(results.size());
System.out.println(model.size());
}
2 日以上デバッグを続けていますが、エラーが見つからないようです。
CONSTRUCT クエリを virtuoso ベースのエンドポイントと Jena 実装に送信されるエンドポイントに書き込む方法に違いはありますか?