Is there a differense between a CONSTRUCT queries sent to a virtuoso endpoint and one sent to a Jena one?

て烟熏妆下的殇ゞ 提交于 2020-01-23 02:54:46

问题


I am trying to infer some new triples based on the following CONSTRUCT query:

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")) .
            }
        }
    }

When submitted to a virtuoso based SPARQL endpoint it returns the expected results. When however the same query is submitted against a Jena based endpoint, 0 triples are returned.

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());
}

I have been debugging for over two days now, and I can't seem to find any error.

Is there a difference in how to write a CONSTRUCT query to a virtuoso-based endpoint and one that is sent to a Jena implementation?

来源:https://stackoverflow.com/questions/20746689/is-there-a-differense-between-a-construct-queries-sent-to-a-virtuoso-endpoint-an

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!