Return-Path: X-Original-To: apmail-clerezza-dev-archive@www.apache.org Delivered-To: apmail-clerezza-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 91435F007 for ; Tue, 2 Apr 2013 20:45:45 +0000 (UTC) Received: (qmail 39003 invoked by uid 500); 2 Apr 2013 20:45:45 -0000 Delivered-To: apmail-clerezza-dev-archive@clerezza.apache.org Received: (qmail 38939 invoked by uid 500); 2 Apr 2013 20:45:45 -0000 Mailing-List: contact dev-help@clerezza.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@clerezza.apache.org Delivered-To: mailing list dev@clerezza.apache.org Received: (qmail 38931 invoked by uid 500); 2 Apr 2013 20:45:45 -0000 Delivered-To: apmail-incubator-clerezza-dev@incubator.apache.org Received: (qmail 38928 invoked by uid 99); 2 Apr 2013 20:45:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 20:45:45 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.128.172] (HELO mail-ve0-f172.google.com) (209.85.128.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 20:45:39 +0000 Received: by mail-ve0-f172.google.com with SMTP id oz10so1102905veb.3 for ; Tue, 02 Apr 2013 13:45:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=KY43MppE4LfsM0RJ1C4PN6ijBonFMcIMqe+m75jBkJE=; b=JWcdyrSymgOJBfg15GFIELifjZ+Iowa03e9TGgjJpwZG327yHX3hKcj2igU4tggNcl rHieHkTWqQTIJwgnNRurWPodcytA4A9avs6N2j8I5dqat7gDgQ9XEsLcSKL+X2neGig3 OqmhC01iQmMdRL1Rb7wk2VXYMUS7MuOJ4tA2WpDbpVioELz7paBo8DIFBkhBiaVzqe4C zdKy62hx6DaCdiNx1A6KFQhOYvnWo9TwPH4Mi4B/6p0z5xhQ9IgprOjJwDGscPht+1cg XGDWwgpk6ANGQp3e29V/rmdNcMrOOlVZ/BjyeUviJUbfeJlEK/UYTQzvGjlNAg7ohJJ6 xouw== MIME-Version: 1.0 X-Received: by 10.58.187.42 with SMTP id fp10mr13873682vec.46.1364935517796; Tue, 02 Apr 2013 13:45:17 -0700 (PDT) Received: by 10.220.151.79 with HTTP; Tue, 2 Apr 2013 13:45:17 -0700 (PDT) X-Originating-IP: [84.72.54.15] In-Reply-To: References: Date: Tue, 2 Apr 2013 22:45:17 +0200 Message-ID: Subject: Re: [jira] [Commented] (CLEREZZA-761) Implement SPARQL PreParser to support fastlane From: Hasan Hasan To: dev@clerezza.apache.org Cc: clerezza-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=047d7b6dccb0ae253a04d966d056 X-Gm-Message-State: ALoCoQknELTVa+7/AFL9ve/HVgQdpwzvNIyPSX/oU/yD42fRQ9Wo/B4oXZNiYIWbFFS/f/5ZsLg+ X-Virus-Checked: Checked by ClamAV on apache.org --047d7b6dccb0ae253a04d966d056 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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=FCr wro= te: > 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 availab= le > graphs. As typically not all graphs are provided by the same provider thi= s > 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 } }",n= ew > UriRef("urn:x-localinstance:/content.graph")) > res0: java.util.Set[org.apache.clerezza.rdf.core.UriRef] =3D > [] > > The query would be fastlaned to the TcProvider providing the Graph > which potentially knows about none o= f > 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 t= he > set of affected graphs cannot be limited (return null). > > Currently clerezza correctly returns all triple collections: > > zz>val q =3D qp.parse("SELECT DISTINCT ?g { GRAPH ?g { ?s ?p ?o } }") > q: org.apache.clerezza.rdf.core.sparql.query.Query =3D > SELECT DISTINCT > ?g > WHERE > { GRAPH ?g { ?s ?p ?o . > } } > zz>val r =3D tcm.executeSparqlQuery(q.asInstanceOf[SelectQuery], new > SimpleMGraph) > r: org.apache.clerezza.rdf.core.sparql.ResultSet =3D > org.apache.clerezza.rdf.jena.sparql.ResultSetWrapper@b0d2ffd > zz>r.next > res5: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res6: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res7: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res8: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res9: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res10: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res11: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D} > zz>r.next > res12: org.apache.clerezza.rdf.core.sparql.SolutionMapping =3D > {org.apache.clerezza.rdf.core.sparql.query.Variable@67 > =3D > Cheers, > Reto > > On Tue, Apr 2, 2013 at 8:10 AM, Hasan Hasan 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=FCr (JIRA) > > wrote: > > > > > > > > [ > > > > > > https://issues.apache.org/jira/browse/CLEREZZA-761?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D136172= 95#comment-13617295 > > ] > > > > > > Reto Bachmann-Gm=FCr commented on CLEREZZA-761: > > > --------------------------------------------- > > > > > > zz>import org.apache.clerezza.rdf.core.sparql._ > > > import org.apache.clerezza.rdf.core.sparql._ > > > zz>val spp =3D $[SparqlPreParser] > > > spp: org.apache.clerezza.rdf.core.sparql.SparqlPreParser =3D > > > 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] =3D > > > [] > > > zz> > > > > > > As discussed in > > > > > > http://mail-archives.apache.org/mod_mbox/clerezza-dev/201303.mbox/%3C5149= 8242.4020809@apache.org%3Ethisshouldreturn all the graphs in the dataset. I= think that > > > SParqlPreParser being a service it could consider by default TcManage= r > > > being the dataset, but it probably should also have a method that tak= es > > 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 > > > > > > --047d7b6dccb0ae253a04d966d056--