Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1001

named graphs set not empty if no FROM NAMED clause given

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Later
    • Affects Version/s: Fuseki 2.0.0
    • Fix Version/s: None
    • Component/s: Fuseki
    • Labels:
      None

      Description

      According to the SPARQL 1.1 Query Language specification the set of named graphs must be empty if a query only specifies FROM clauses and no FROM NAMED clauses:

      An RDF Dataset comprises ... zero or more named graphs

      That means, the only way to express zero named graphs is to specify no FROM NAMED clause.

      But:

      Having the following data:
      http://example.org/graph1

      <urn:subject1> rdfs:label "Subject one" .
      

      http://example.org/graph2

      <urn:subject2> rdfs:label "Subject two" .
      

      and executing the query:

      SELECT ?g
      FROM <http://example.org/graph1>
      WHERE {
        GRAPH ?g { ?s ?p ?o . }
      }
      

      will return

       ?g
      ===========
       ex:graph1
       ex:graph2
      

      which proves that the set of named graphs is not empty:

      GRAPH can ... use a variable which will range over the IRI of all the named graphs in the query's RDF dataset.

        Issue Links

          Activity

          Hide
          andy.seaborne Andy Seaborne added a comment -

          Which storage sub-system are you using?

          Show
          andy.seaborne Andy Seaborne added a comment - Which storage sub-system are you using?
          Hide
          depressiveRobot Marvin Frommhold added a comment -

          The in-memory system.

          Show
          depressiveRobot Marvin Frommhold added a comment - The in-memory system.
          Hide
          andy.seaborne Andy Seaborne added a comment -

          I can't reproduce this from the description (I used the Fuseki UI to laod the files into a memory and also a TDB database).

          Could you provide a complete setup and description please?

          What client are you using to query Fuseki?

          Show
          andy.seaborne Andy Seaborne added a comment - I can't reproduce this from the description (I used the Fuseki UI to laod the files into a memory and also a TDB database). Could you provide a complete setup and description please? What client are you using to query Fuseki?
          Hide
          depressiveRobot Marvin Frommhold added a comment -

          The install is based on the following brew install:
          https://github.com/Homebrew/homebrew/pull/41970

          $ fuseki-server
          [2015-07-29 17:10:07] Server     INFO  Fuseki 2.0.0 2015-03-08T09:49:20+0000
          [2015-07-29 17:10:07] Config     INFO  FUSEKI_HOME=/usr/local/Cellar/fuseki/2.0.0/libexec
          [2015-07-29 17:10:07] Config     INFO  FUSEKI_BASE=/tmp/fuseki
          [2015-07-29 17:10:07] Servlet    INFO  Initializing Shiro environment
          [2015-07-29 17:10:07] Config     INFO  Shiro file: file:///tmp/fuseki/shiro.ini
          [2015-07-29 17:10:07] Server     INFO  Started 2015/07/29 17:10:07 CEST on port 3030
          

          Now I created a new dataset using the Fuseki UI, uploaded an TTL file to destination graph with name http://example.org/graph1 and another file to graph http://example.org/graph2 (also using the UI) and then used the query editor to execute the query.

          Show
          depressiveRobot Marvin Frommhold added a comment - The install is based on the following brew install: https://github.com/Homebrew/homebrew/pull/41970 $ fuseki-server [2015-07-29 17:10:07] Server INFO Fuseki 2.0.0 2015-03-08T09:49:20+0000 [2015-07-29 17:10:07] Config INFO FUSEKI_HOME=/usr/local/Cellar/fuseki/2.0.0/libexec [2015-07-29 17:10:07] Config INFO FUSEKI_BASE=/tmp/fuseki [2015-07-29 17:10:07] Servlet INFO Initializing Shiro environment [2015-07-29 17:10:07] Config INFO Shiro file: file: ///tmp/fuseki/shiro.ini [2015-07-29 17:10:07] Server INFO Started 2015/07/29 17:10:07 CEST on port 3030 Now I created a new dataset using the Fuseki UI, uploaded an TTL file to destination graph with name http://example.org/graph1 and another file to graph http://example.org/graph2 (also using the UI) and then used the query editor to execute the query.
          Hide
          andy.seaborne Andy Seaborne added a comment - - edited

          OK- I see part of the problem - the in-memory dataset does not support FROM. In Fuseki2, loading external files via FROM is not supported.

          Please run

          SELECT * {
             {?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }
          }
          

          to show what the contents of the database are.

          (I have tested with the recently released Fuseki 2.3.0)

          Show
          andy.seaborne Andy Seaborne added a comment - - edited OK- I see part of the problem - the in-memory dataset does not support FROM . In Fuseki2, loading external files via FROM is not supported. Please run SELECT * { {?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } } } to show what the contents of the database are. (I have tested with the recently released Fuseki 2.3.0)
          Hide
          depressiveRobot Marvin Frommhold added a comment -

          I do not load external files via FROM, just "local" graphs of the current selected Fuseki dataset.

          The same problem exists when inserting the data via query (http://localhost:3030/test/update):

          INSERT DATA { GRAPH <http://example.org/graph1> { <urn:subject1> rdfs:label "Subject one" . } }
          

          Does that mean a Fuseki in-memory dataset does not support FROM/FROM NAMED at all?

          Show
          depressiveRobot Marvin Frommhold added a comment - I do not load external files via FROM , just "local" graphs of the current selected Fuseki dataset. The same problem exists when inserting the data via query ( http://localhost:3030/test/update): INSERT DATA { GRAPH <http: //example.org/graph1> { <urn:subject1> rdfs:label "Subject one" . } } Does that mean a Fuseki in-memory dataset does not support FROM/FROM NAMED at all?
          Hide
          andy.seaborne Andy Seaborne added a comment -

          Not sure yet what's happening with in-memory datasets in Fuseki and FROM/FROM NAMED. When used outside Fuseki, ARQ would try to load from the URLs but in Fuseki is different and Fuseki, to some extent, processes that part of the query.

          What does

          SELECT * {
             {?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }
          }
          

          show?

          Show
          andy.seaborne Andy Seaborne added a comment - Not sure yet what's happening with in-memory datasets in Fuseki and FROM/FROM NAMED . When used outside Fuseki, ARQ would try to load from the URLs but in Fuseki is different and Fuseki, to some extent, processes that part of the query. What does SELECT * { {?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } } } show?
          Hide
          depressiveRobot Marvin Frommhold added a comment - - edited

          As expected:

          s,p,o,g
          urn:subject1,http://www.w3.org/2000/01/rdf-schema#label,subject1,http://example.org/graph1
          urn:subject2,http://www.w3.org/2000/01/rdf-schema#label,subject2,http://example.org/graph2
          

          The thing is, your query does not define an RDF Dataset so the default one of the service is used.

          But my issue is related to the fact, that a query defines its own dataset to be queried which must override the one of the service:

          If a query provides such a dataset description, then it is used in place of any dataset that the query service would use if no dataset description is provided in a query.

          Show
          depressiveRobot Marvin Frommhold added a comment - - edited As expected: s,p,o,g urn:subject1,http: //www.w3.org/2000/01/rdf-schema#label,subject1,http://example.org/graph1 urn:subject2,http: //www.w3.org/2000/01/rdf-schema#label,subject2,http://example.org/graph2 The thing is, your query does not define an RDF Dataset so the default one of the service is used. But my issue is related to the fact, that a query defines its own dataset to be queried which must override the one of the service: If a query provides such a dataset description, then it is used in place of any dataset that the query service would use if no dataset description is provided in a query.
          Hide
          andy.seaborne Andy Seaborne added a comment -

          Thanks - knowing the result of the query confirms the issue is not in the data loading or dataset.

          Show
          andy.seaborne Andy Seaborne added a comment - Thanks - knowing the result of the query confirms the issue is not in the data loading or dataset.
          Hide
          andy.seaborne Andy Seaborne added a comment -

          JENA-1004 captures the root cause and a place for discussion. This means the original reports are kept without rewriting. They are resolved as superseded.

          Show
          andy.seaborne Andy Seaborne added a comment - JENA-1004 captures the root cause and a place for discussion. This means the original reports are kept without rewriting. They are resolved as superseded.
          Hide
          andy.seaborne Andy Seaborne added a comment -

          JENA-1004 resolved.

          Show
          andy.seaborne Andy Seaborne added a comment - JENA-1004 resolved.

            People

            • Assignee:
              Unassigned
              Reporter:
              depressiveRobot Marvin Frommhold
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development