Details

      Description

      The java client methods for getStatements() ignore the includeInferred parameter. This is defined by the openrdf API and needs to be recognized and its semantics respected for compliance in our BigdataSailRemoteRepositoryConnection class.

        Activity

        beebs Brad Bebee created issue -
        bryanthompson bryanthompson made changes -
        Field Original Value New Value
        Fix Version/s BLAZEGRAPH_RELEASE_1_5_2 [ 10164 ]
        bryanthompson bryanthompson made changes -
        Parent BLZG-789 [ 12235 ]
        Issue Type Bug [ 1 ] Sub-task [ 5 ]
        bryanthompson bryanthompson made changes -
        Component/s RemoteRepository [ 10017 ]
        Hide
        bryanthompson bryanthompson added a comment -

        includeInferred is currently ignored by RemoteRepository.getStatements2().

        • We need to add unit tests for this capability. This could be done at the openrdf layer (test suite for BigdataSailRemoteRepositoryConnection).
        • It needs to be passed along as a URL query parameter for the GraphQuery (implements IPreparedGraphQuery).
        • The server needs to be modified to recognize that URL query parameter.
        • That parameter needs to be declared on the NSS wiki page (for v1.5.2).
        Show
        bryanthompson bryanthompson added a comment - includeInferred is currently ignored by RemoteRepository.getStatements2(). We need to add unit tests for this capability. This could be done at the openrdf layer (test suite for BigdataSailRemoteRepositoryConnection). It needs to be passed along as a URL query parameter for the GraphQuery (implements IPreparedGraphQuery). The server needs to be modified to recognize that URL query parameter. That parameter needs to be declared on the NSS wiki page (for v1.5.2).
        Hide
        bryanthompson bryanthompson added a comment - - edited

        As a first step, I am adding unit test coverage for BigdataSailRemoteRepositoryConnection.getStatements(). The core cases for triples and quads all pass.

        The RemoteRepository.getStatements() method works by generating a CONSTRUCT query. If the database is using quads (or rather if the caller has specified one or more contexts) then a default graph query is setup for the named graphs specified to the getStatements() method. For example:

                final long result = countResults(cxn.getStatements(//
                        null,// s
                        RDFS.LABEL,// p
                        new URIImpl("http://xmlns.com/foaf/0.1/XXX"),// o
                        false, // includeInferred
                        new URIImpl("http://www.bigdata.com/") // contexts
                        ));
        

        Causes the following SPARQL CONSTRUCT query to be generated.

        CONSTRUCT {
        ?s <http://www.w3.org/2000/01/rdf-schema#label> <http://xmlns.com/foaf/0.1/XXX>
        }
        FROM <http://www.bigdata.com/>
        WHERE {
        ?s <http://www.w3.org/2000/01/rdf-schema#label> <http://xmlns.com/foaf/0.1/XXX>
        }
        

        This is then evaluated against the following quads data (trig):

        @prefix : <http://www.bigdata.com/> .
        @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
        @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
        @prefix foaf: <http://xmlns.com/foaf/0.1/> .
        
        :{
        :Mike rdf:type foaf:Person .
        :Bryan rdf:type foaf:Person .
        :Martyn rdf:type foaf:Person .
        }
        
        :c1 {
        :Mike rdfs:label "Mike" .
        :Bryan rdfs:label "Bryan" .
        }
        
        :c2 {
        :Mike foaf:knows :Bryan .
        :Bryan foaf:knows :Martyn .
        }
        
        Show
        bryanthompson bryanthompson added a comment - - edited As a first step, I am adding unit test coverage for BigdataSailRemoteRepositoryConnection.getStatements(). The core cases for triples and quads all pass. The RemoteRepository.getStatements() method works by generating a CONSTRUCT query. If the database is using quads (or rather if the caller has specified one or more contexts) then a default graph query is setup for the named graphs specified to the getStatements() method. For example: final long result = countResults(cxn.getStatements( // null , // s RDFS.LABEL, // p new URIImpl( "http: //xmlns.com/foaf/0.1/XXX" ),// o false , // includeInferred new URIImpl( "http: //www.bigdata.com/" ) // contexts )); Causes the following SPARQL CONSTRUCT query to be generated. CONSTRUCT { ?s <http: //www.w3.org/2000/01/rdf-schema#label> <http://xmlns.com/foaf/0.1/XXX> } FROM <http: //www.bigdata.com/> WHERE { ?s <http: //www.w3.org/2000/01/rdf-schema#label> <http://xmlns.com/foaf/0.1/XXX> } This is then evaluated against the following quads data (trig): @prefix : <http: //www.bigdata.com/> . @prefix rdf: <http: //www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http: //www.w3.org/2000/01/rdf-schema#> . @prefix foaf: <http: //xmlns.com/foaf/0.1/> . :{ :Mike rdf:type foaf:Person . :Bryan rdf:type foaf:Person . :Martyn rdf:type foaf:Person . } :c1 { :Mike rdfs:label "Mike" . :Bryan rdfs:label "Bryan" . } :c2 { :Mike foaf:knows :Bryan . :Bryan foaf:knows :Martyn . }
        Hide
        bryanthompson bryanthompson added a comment -

        Per the manner in which the CONSTRUCT query is generated above, the named graph is NOT part of the constructed statements.

        This is clearly the root cause for BLZG-753 (export() looses the context).

        Show
        bryanthompson bryanthompson added a comment - Per the manner in which the CONSTRUCT query is generated above, the named graph is NOT part of the constructed statements. This is clearly the root cause for BLZG-753 (export() looses the context).
        Hide
        bryanthompson bryanthompson added a comment -

        Also, note that includeInferred can not be readily communicated through SPARQL QUERY interface but it is supported at the Sail layer:

                public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluate(
                        final QueryRoot queryRoot, //
                        final Dataset dataset,//
                        final BindingSet bindings,//
                        final boolean includeInferred//
                ) throws SailException {
        

        So perhaps we can just raise includeInferred onto the SPARQL QUERY interface as a URL query parameter?

        Show
        bryanthompson bryanthompson added a comment - Also, note that includeInferred can not be readily communicated through SPARQL QUERY interface but it is supported at the Sail layer: public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluate( final QueryRoot queryRoot, // final Dataset dataset, // final BindingSet bindings, // final boolean includeInferred // ) throws SailException { So perhaps we can just raise includeInferred onto the SPARQL QUERY interface as a URL query parameter?
        Hide
        beebs Brad Bebee added a comment -

        +1 on includeInferred to the REST layer.

        Show
        beebs Brad Bebee added a comment - +1 on includeInferred to the REST layer.
        Hide
        bryanthompson bryanthompson added a comment -

        Mike wrote: I think the GETSTMTS approach is best, like what we do for HASSTMT. I doubt that query will work in triples mode. Also I am noticing more and more that we have a lot of overhead associated with parsing, optimizing, and creating/executing a physical plan even for a simple query. GETSTMTS would bypass all that.

        Show
        bryanthompson bryanthompson added a comment - Mike wrote: I think the GETSTMTS approach is best, like what we do for HASSTMT. I doubt that query will work in triples mode. Also I am noticing more and more that we have a lot of overhead associated with parsing, optimizing, and creating/executing a physical plan even for a simple query. GETSTMTS would bypass all that.
        beebs Brad Bebee made changes -
        Workflow Trac Import v2 [ 13043 ] Trac Import v3 [ 13416 ]
        beebs Brad Bebee made changes -
        Workflow Trac Import v3 [ 13416 ] Trac Import v4 [ 14745 ]
        bryanthompson bryanthompson made changes -
        Assignee bryanthompson [ bryanthompson ] igorkim [ igorkim ]
        beebs Brad Bebee made changes -
        Workflow Trac Import v4 [ 14745 ] Trac Import v5 [ 16134 ]
        igorkim igorkim made changes -
        Status Accepted [ 10101 ] In Progress [ 3 ]
        Priority Highest [ 1 ]
        beebs Brad Bebee made changes -
        Workflow Trac Import v5 [ 16134 ] Trac Import v6 [ 18544 ]
        igorkim igorkim made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        beebs Brad Bebee made changes -
        Fix Version/s BLAZEGRAPH_RELEASE_1_5_3 [ 10165 ]
        Fix Version/s BLAZEGRAPH_RELEASE_1_5_2 [ 10164 ]
        bryanthompson bryanthompson made changes -
        Fix Version/s BLAZEGRAPH_RELEASE_1_5_2 [ 10164 ]
        Fix Version/s BLAZEGRAPH_RELEASE_1_5_3 [ 10165 ]
        beebs Brad Bebee made changes -
        Workflow Trac Import v6 [ 18544 ] Trac Import v7 [ 19988 ]
        beebs Brad Bebee made changes -
        Workflow Trac Import v7 [ 19988 ] Trac Import v8 [ 21676 ]
        bryanthompson bryanthompson made changes -
        Status Resolved [ 5 ] In Review [ 10100 ]
        bryanthompson bryanthompson made changes -
        Resolution Done [ 10000 ]
        Status In Review [ 10100 ] Done [ 10000 ]

          People

          • Assignee:
            igorkim igorkim
            Reporter:
            bryanthompson bryanthompson
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: