On Tue, Apr 9, 2013 at 9:48 AM, Reto Bachmann-Gmür <[email protected]> wrote:
> Hi Hasan > > For efficiency reason (and considering Minto's usecase) - even though less > nice - I think the pre parser should rather return null than all the > graphs. > Hi Reto, does this mean the PreParser needs not use TcManager and just returns null for the case with no FROM NAMED clause ? Cheers Hasan > > Cheers, > Reto > On Apr 2, 2013 10:45 PM, "Hasan Hasan" <[email protected]> wrote: > > > Hi Reto, > > > > after studying carefully the description and examples in > > http://www.w3.org/TR/sparql11-query/#rdfDataset > > I think the PreParser should - as you suggested - have a TcProvider to > > return all TripleCollections, in case no FROM NAMED clause is specified > in > > the query. > > > > How should we pass the TcProvider to the PreParser? In a separate method, > > e.g., > > > > public void setTcProvider(TcProvider tcProvider); > > > > Default TcProvider would be TcManager. > > > > Cheers > > Hasan > > > > > > > > On Tue, Apr 2, 2013 at 12:34 PM, Reto Bachmann-Gmür <[email protected]> > > wrote: > > > > > Hi, > > > > > > The query SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } } can obviously > only > > > be answered correctly by a sparql engine that knows about all the > > available > > > graphs. As typically not all graphs are provided by the same provider > > this > > > means the query has to be slow laned. > > > > > > If the pre parser returns only the default graph as this is currently > the > > > case: > > > > > > 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>] > > > > > > The query would be fastlaned to the TcProvider providing the Graph > > > <urn:x-localinstance:/content.graph> which potentially knows about none > > of > > > the other graphs. > > > > > > So I think either the preparser has the TcManager and returns all the > > > TripleCollections or it returns a special value to tell the caller that > > the > > > set of affected graphs cannot be limited (return null). > > > > > > Currently clerezza correctly returns all triple collections: > > > > > > zz>val q = qp.parse("SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } }") > > > q: org.apache.clerezza.rdf.core.sparql.query.Query = > > > SELECT DISTINCT > > > ?g > > > WHERE > > > { GRAPH ?g { ?s ?p ?o . > > > } } > > > zz>val r = tcm.executeSparqlQuery(q.asInstanceOf[SelectQuery], new > > > SimpleMGraph) > > > r: org.apache.clerezza.rdf.core.sparql.ResultSet = > > > org.apache.clerezza.rdf.jena.sparql.ResultSetWrapper@b0d2ffd > > > zz>r.next > > > res5: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/tbox.graph>} > > > zz>r.next > > > res6: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/config.graph>} > > > zz>r.next > > > res7: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/content.graph>} > > > zz>r.next > > > res8: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/documentation.graph>} > > > zz>r.next > > > res9: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/web-resources-cache.graph1364897492157>} > > > zz>r.next > > > res10: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/graph-access.graph>} > > > zz>r.next > > > res11: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/web-resources.graph>} > > > zz>r.next > > > res12: org.apache.clerezza.rdf.core.sparql.SolutionMapping = > > > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > > > =<urn:x-localinstance:/system.grap > > > > > > Cheers, > > > Reto > > > > > > On Tue, Apr 2, 2013 at 8:10 AM, Hasan Hasan <[email protected]> wrote: > > > > > > > Hi Reto, all > > > > > > > > Two issues here: > > > > > > > > First the query: SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } } > > > > does not specify NAMED graphs. > > > > If the query is as follows > > > > SELECT DISTINCT ?g FROM NAMED http://example.org/g1 { GRAPH ?g { ?s > ?p > > > ?o > > > > } > > > > } > > > > then the engine will return http://example.org/g1 > > > > because the clause GRAPH refers only NAMED graphs as mentioned by > Andy > > > > > > > > Second the parser: I think the parser needs not know about TcManager > or > > > > other providers in this case, because > > > > the named graphs are all specified in the query. > > > > > > > > Cheers > > > > Hasan > > > > > > > > > > > > > > > > On Fri, Mar 29, 2013 at 1:47 PM, Reto Bachmann-Gmür (JIRA) > > > > <[email protected]>wrote: > > > > > > > > > > > > > > [ > > > > > > > > > > > > > > > https://issues.apache.org/jira/browse/CLEREZZA-761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13617295#comment-13617295 > > > > ] > > > > > > > > > > Reto Bachmann-Gmür commented on CLEREZZA-761: > > > > > --------------------------------------------- > > > > > > > > > > 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/%[email protected]%3Ethisshouldreturnallthe > 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. > > > > > > > > > > > Implement SPARQL PreParser to support fastlane > > > > > > ---------------------------------------------- > > > > > > > > > > > > Key: CLEREZZA-761 > > > > > > URL: > > > > https://issues.apache.org/jira/browse/CLEREZZA-761 > > > > > > Project: Clerezza > > > > > > Issue Type: New Feature > > > > > > Reporter: Hasan > > > > > > Assignee: Hasan > > > > > > > > > > > > The purpose is to have a class with a method to obtain referred > > > graphs > > > > > in a SPARQL Query or SPARQL Update > > > > > > > > > > -- > > > > > This message is automatically generated by JIRA. > > > > > If you think it was sent incorrectly, please contact your JIRA > > > > > administrators > > > > > For more information on JIRA, see: > > > > http://www.atlassian.com/software/jira > > > > > > > > > > > > > > >
