Clerezza
  1. Clerezza
  2. CLEREZZA-761

Implement SPARQL PreParser to support fastlane

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      The purpose is to have a class with a method to obtain referred graphs in a SPARQL Query or SPARQL Update

        Activity

        Hide
        Hasan added a comment -

        SPARQL Update is not yet supported

        Also not yet supported within BuiltInCall in Query:
        [125] ExistsFunc ::= 'EXISTS' GroupGraphPattern
        [126] NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern

        Show
        Hasan added a comment - SPARQL Update is not yet supported Also not yet supported within BuiltInCall in Query: [125] ExistsFunc ::= 'EXISTS' GroupGraphPattern [126] NotExistsFunc ::= 'NOT' 'EXISTS' GroupGraphPattern
        Hide
        Reto Bachmann-Gmür added a comment -

        zz>import org.apache.clerezza.rdf.core.sparql._
        import org.apache.clerezza.rdf.core.sparql._
        zz>val spp = $[SparqlPreParser]
        spp: org.apache.clerezza.rdf.core.sparql.SparqlPreParser = org.apache.clerezza.rdf.core.sparql.SparqlPreParser@3aa78e7a
        zz>spp.getReferredGraphs("SELECT DISTINCT ?g { GRAPH ?g

        { ?s ?p ?o }

        }", new UriRef("urn:x-localinstance:/content.graph"))
        res0: java.util.Set[org.apache.clerezza.rdf.core.UriRef] = [<urn:x-localinstance:/content.graph>]
        zz>

        As discussed in http://mail-archives.apache.org/mod_mbox/clerezza-dev/201303.mbox/%3C51498242.4020809@apache.org%3E this should return all the graphs in the dataset. I think that SParqlPreParser being a service it could consider by default TcManager being the dataset, but it probably should also have a method that takes any TcProvider as dataset and return it's triple collections.

        Show
        Reto Bachmann-Gmür added a comment - zz>import org.apache.clerezza.rdf.core.sparql._ import org.apache.clerezza.rdf.core.sparql._ zz>val spp = $ [SparqlPreParser] spp: org.apache.clerezza.rdf.core.sparql.SparqlPreParser = org.apache.clerezza.rdf.core.sparql.SparqlPreParser@3aa78e7a zz>spp.getReferredGraphs("SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } }", new UriRef("urn:x-localinstance:/content.graph")) res0: java.util.Set [org.apache.clerezza.rdf.core.UriRef] = [<urn:x-localinstance:/content.graph>] zz> As discussed in http://mail-archives.apache.org/mod_mbox/clerezza-dev/201303.mbox/%3C51498242.4020809@apache.org%3E this should return all the graphs in the dataset. I think that SParqlPreParser being a service it could consider by default TcManager being the dataset, but it probably should also have a method that takes any TcProvider as dataset and return it's triple collections.
        Hide
        Hasan added a comment -

        As discussed in email [1], the SPARQL PreParser now returns null rather than all graphs if no named graphs are specified in the query

        [1] http://mail-archives.apache.org/mod_mbox/clerezza-dev/201304.mbox/%3CCALvhUEW2HjucR4Wv2RCfkoGS6uh8R_jt-JaFwSzs%2B%2BFaae_J7w%40mail.gmail.com%3E

        Show
        Hasan added a comment - As discussed in email [1] , the SPARQL PreParser now returns null rather than all graphs if no named graphs are specified in the query [1] http://mail-archives.apache.org/mod_mbox/clerezza-dev/201304.mbox/%3CCALvhUEW2HjucR4Wv2RCfkoGS6uh8R_jt-JaFwSzs%2B%2BFaae_J7w%40mail.gmail.com%3E
        Hide
        Reto Bachmann-Gmür added a comment -

        WHILE DROP-querie seems to be support INSERT queries cause an exception to be thrown.

        Show
        Reto Bachmann-Gmür added a comment - WHILE DROP-querie seems to be support INSERT queries cause an exception to be thrown.
        Hide
        Hasan added a comment -

        The preparser should only return null if no named graphs are specified in the query AND if there is a graph graph pattern referring a variable.
        In this case the preparser has to support parsing GroupGraphPattern. I am starting to implement support of preparsing GroupGraphPattern.

        Show
        Hasan added a comment - The preparser should only return null if no named graphs are specified in the query AND if there is a graph graph pattern referring a variable. In this case the preparser has to support parsing GroupGraphPattern. I am starting to implement support of preparsing GroupGraphPattern.
        Hide
        Hasan added a comment -

        Now the preparser returns null for "SELECT DISTINCT ?g { GRAPH ?g

        { ?s ?p ?o }

        }"

        Show
        Hasan added a comment - Now the preparser returns null for "SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } }"
        Hide
        Hasan added a comment -

        All SPARQL Update operations and new functions in SPARQL Query are now supported by the preparser. Note that the preparser is only able to obtain referred graphs, but cannot completely generate parsed objects, e.g., it ignores variables binding defined using the BIND keyword.

        Show
        Hasan added a comment - All SPARQL Update operations and new functions in SPARQL Query are now supported by the preparser. Note that the preparser is only able to obtain referred graphs, but cannot completely generate parsed objects, e.g., it ignores variables binding defined using the BIND keyword.
        Hide
        Hasan added a comment -

        I added some tests in SparqlPreParserTest.java and all passed. However, if you find errors, please add a test there and comment it out, reopen the issue, and I'll try to fix it.

        Show
        Hasan added a comment - I added some tests in SparqlPreParserTest.java and all passed. However, if you find errors, please add a test there and comment it out, reopen the issue, and I'll try to fix it.
        Hide
        Reto Bachmann-Gmür added a comment -

        simple describe fails, adding failing test (commented out)

        Show
        Reto Bachmann-Gmür added a comment - simple describe fails, adding failing test (commented out)
        Hide
        Hasan added a comment -

        will look into it, probably this evening

        Show
        Hasan added a comment - will look into it, probably this evening

          People

          • Assignee:
            Hasan
            Reporter:
            Hasan
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development