|
From: Adrian B. <Adr...@ma...> - 2017-01-11 14:34:33
|
Hello everyone, I'm writign on behalf of a Wikidata Research Project <https://meta.wikimedia.org/wiki/Research:Understanding_Wikidata_Queries> into SPARQL-Queries. We are writing a java application to parse SPARQL-Queries from the query.wikidata.org-logs and analyse them for different features. At the moment we are parsing the queries with org.openrdf.query.parser.QueryParserUtil into org.openrdf.query.parser.ParsedQuery-Objects. Unfortunatly we cannot parse queries like this one: SELECT DISTINCT ?item WHERE { ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) } because of: "BIND clause alias '{}' was previously used". If we parse them as org.openrdf.query.TupleQuery-Objects using org.openrdf.repository.RepositoryConnection.prepareTupleQuery they are parsed just fine. Unfortunatly, the TupleQuery-Objects do not support the analysis-Features of ParsedQuery. All of which leads to 2-3 questions: 1. Why is this kind of query accepted by one parser but not the other? 2. Is it possible to obtain a ParsedQuery-Object from a TupleQuery-Object? (3. Is this the right mailing list to post these questions to?) Greetings, Adrian Bielefeldt |
|
From: Jerven T. B. <Jer...@si...> - 2017-01-12 09:03:19
|
Hi Adrian, I am not involved in BigData/BlazeGraph etc.. but I can provide some insight. On 2017-01-11 15:15, Adrian Bielefeldt wrote: > I'm writign on behalf of a Wikidata Research Project [1] into > SPARQL-Queries. We are writing a java application to parse > SPARQL-Queries from the query.wikidata.org-logs and analyse them for > different features. At the moment we are parsing the queries with > org.openrdf.query.parser.QueryParserUtil into > org.openrdf.query.parser.ParsedQuery-Objects. Unfortunatly we cannot > parse queries like this one: > > SELECT DISTINCT ?item > WHERE > { ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) } > > because of: "BIND clause alias '{}' was previously used". > > If we parse them as org.openrdf.query.TupleQuery-Objects using > org.openrdf.repository.RepositoryConnection.prepareTupleQuery they are > parsed just fine. This is practically an invalid SPARQL query (different systems accept more or less) but the query is nonsensical. The Query Parser reports that. The TupleQuery parses according to the AST which does not "judge" a query on its merits. It has been a while since I did any query analysis for sparql.uniprot.org. What I did at that time is for more detailed analysis is use the SPIN-API [2] to convert the SPARQL query string to an RDF representation. Loaded that SPARQL query as RDF into a triple store and used SPARQL to analyze those SPARQL queries. i.e. use SPARQL to analyze analytical SPARQL queries ;) Regarding the openrdf parser questions you can ask them at eclipse-rdf4j https://groups.google.com/forum/#!forum/rdf4j-users rdf4j at eclipse is what was formerly named openrdf/sesame. Regards, Jerven [2] https://github.com/spinrdf/spinrdf/ > > > Unfortunatly, the TupleQuery-Objects do not support the > analysis-Features of ParsedQuery. > > All of which leads to 2-3 questions: > > 1. Why is this kind of query accepted by one parser but not the other? > 2. Is it possible to obtain a ParsedQuery-Object from a > TupleQuery-Object? > (3. Is this the right mailing list to post these questions to?) > > Greetings, > > Adrian Bielefeldt > > > Links: > ------ > [1] > https://meta.wikimedia.org/wiki/Research:Understanding_Wikidata_Queries > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > _______________________________________________ > Bigdata-developers mailing list > Big...@li... > https://lists.sourceforge.net/lists/listinfo/bigdata-developers -- Jerven Tjalling Bolleman SIB | Swiss Institute of Bioinformatics CMU - 1, rue Michel Servet - 1211 Geneva 4 t: +41 22 379 58 85 - f: +41 22 379 58 58 Jer...@si... - http://www.sib.swiss |
|
From: Adrian B. <Adr...@ma...> - 2017-01-13 12:36:20
|
Hi Jerven, thanks for the reply. On 12/01/17 10:03, Jerven Tjalling Bolleman wrote: > Hi Adrian, > > I am not involved in BigData/BlazeGraph etc.. but I can provide some > insight. > > On 2017-01-11 15:15, Adrian Bielefeldt wrote: >> I'm writign on behalf of a Wikidata Research Project [1] into >> SPARQL-Queries. We are writing a java application to parse >> SPARQL-Queries from the query.wikidata.org-logs and analyse them for >> different features. At the moment we are parsing the queries with >> org.openrdf.query.parser.QueryParserUtil into >> org.openrdf.query.parser.ParsedQuery-Objects. Unfortunatly we cannot >> parse queries like this one: >> >> SELECT DISTINCT ?item >> WHERE >> { ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) } >> >> because of: "BIND clause alias '{}' was previously used". >> >> If we parse them as org.openrdf.query.TupleQuery-Objects using >> org.openrdf.repository.RepositoryConnection.prepareTupleQuery they are >> parsed just fine. > > This is practically an invalid SPARQL query (different systems accept > more or less) but > the query is nonsensical. The Query Parser reports that. > The TupleQuery parses according to the AST which does not "judge" a > query on its merits. > So what you're saying is that the TupleQuery-Object creates the AST but does not notice that there is actually no sensible way to execute it? Then what happens if I call .evaluate() on this object? > It has been a while since I did any query analysis for > sparql.uniprot.org. > What I did at that time is for more detailed analysis is use the > SPIN-API [2] to convert > the SPARQL query string to an RDF representation. Loaded that SPARQL > query as RDF into a > triple store and used SPARQL to analyze those SPARQL queries. i.e. use > SPARQL to analyze analytical SPARQL queries ;) > We thought about that as well. Is there some kind of public project documentation on this? It would certainly be of interest to us. > Regarding the openrdf parser questions you can ask them at > eclipse-rdf4j https://groups.google.com/forum/#!forum/rdf4j-users > Thanks, I'll try it there too. > rdf4j at eclipse is what was formerly named openrdf/sesame. > > Regards, > Jerven > > [2] https://github.com/spinrdf/spinrdf/ > >> >> >> Unfortunatly, the TupleQuery-Objects do not support the >> analysis-Features of ParsedQuery. >> >> All of which leads to 2-3 questions: >> >> 1. Why is this kind of query accepted by one parser but not the other? >> 2. Is it possible to obtain a ParsedQuery-Object from a >> TupleQuery-Object? >> (3. Is this the right mailing list to post these questions to?) >> >> Greetings, >> >> Adrian Bielefeldt >> >> >> Links: >> ------ >> [1] >> https://meta.wikimedia.org/wiki/Research:Understanding_Wikidata_Queries >> ------------------------------------------------------------------------------ >> >> Developer Access Program for Intel Xeon Phi Processors >> Access to Intel Xeon Phi processor-based developer platforms. >> With one year of Intel Parallel Studio XE. >> Training and support from Colfax. >> Order your platform today. http://sdm.link/xeonphi >> _______________________________________________ >> Bigdata-developers mailing list >> Big...@li... >> https://lists.sourceforge.net/lists/listinfo/bigdata-developers > |
|
From: Artem K. <art...@gm...> - 2017-01-12 18:38:09
|
Hi Adrian, Query that you are trying to parse is not a valid SPARQL query - "The variable introduced by the BIND clause must not have been used in the group graph pattern up to the point of use in BIND. " [https://www.w3.org/TR/sparql11-query/#bind] . Regards, Artem On Wed, Jan 11, 2017 at 3:15 PM, Adrian Bielefeldt < Adr...@ma...> wrote: > Hello everyone, > > I'm writign on behalf of a Wikidata Research Project > <https://meta.wikimedia.org/wiki/Research:Understanding_Wikidata_Queries> > into SPARQL-Queries. We are writing a java application to parse > SPARQL-Queries from the query.wikidata.org-logs and analyse them for > different features. At the moment we are parsing the queries with > org.openrdf.query.parser.QueryParserUtil into > org.openrdf.query.parser.ParsedQuery-Objects. Unfortunatly we cannot > parse queries like this one: > > SELECT DISTINCT ?item > WHERE > { ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) } > > because of: "BIND clause alias '{}' was previously used". > > If we parse them as org.openrdf.query.TupleQuery-Objects using > org.openrdf.repository.RepositoryConnection.prepareTupleQuery they are > parsed just fine. > > Unfortunatly, the TupleQuery-Objects do not support the analysis-Features > of ParsedQuery. > > All of which leads to 2-3 questions: > > 1. Why is this kind of query accepted by one parser but not the other? > 2. Is it possible to obtain a ParsedQuery-Object from a TupleQuery-Object? > (3. Is this the right mailing list to post these questions to?) > > Greetings, > > Adrian Bielefeldt > > ------------------------------------------------------------ > ------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > _______________________________________________ > Bigdata-developers mailing list > Big...@li... > https://lists.sourceforge.net/lists/listinfo/bigdata-developers > > |
|
From: Adrian B. <Adr...@ma...> - 2017-01-13 12:42:42
|
Hi Artem, thanks for the reply. On 12/01/17 19:38, Artem Kozlov wrote: > Hi Adrian, > > Query that you are trying to parse is not a valid SPARQL query - "The > variable introduced by the |BIND |clause must not have been used in > the group graph pattern up to the point of use in |BIND|. > " [https://www.w3.org/TR/sparql11-query/#bind] . I would have thought so too, but not only does blazegraph accept it (at least as a TupleQuery-Object) but if I execute it in query.wikidata.org (which uses blazegraph as a backend) it runs successfully. Interesstingly enough the result is the same as SELECT DISTINCT ?item WHERE { BIND (wd:Q146 AS ?tree0) ?tree0 wdt:P31 ?item} > > Regards, > > Artem > > On Wed, Jan 11, 2017 at 3:15 PM, Adrian Bielefeldt > <Adr...@ma... > <mailto:Adr...@ma...>> wrote: > > Hello everyone, > > I'm writign on behalf of a Wikidata Research Project > <https://meta.wikimedia.org/wiki/Research:Understanding_Wikidata_Queries> > into SPARQL-Queries. We are writing a java application to parse > SPARQL-Queries from the query.wikidata.org-logs and analyse them > for different features. At the moment we are parsing the queries with > org.openrdf.query.parser.QueryParserUtil into > org.openrdf.query.parser.ParsedQuery-Objects. Unfortunatly we > cannot parse queries like this one: > > SELECT DISTINCT ?item > WHERE > { ?tree0 wdt:P31 ?item . BIND (wd:Q146 AS ?tree0) } > > because of: "BIND clause alias '{}' was previously used". > > If we parse them as org.openrdf.query.TupleQuery-Objects using > org.openrdf.repository.RepositoryConnection.prepareTupleQuery they > are parsed just fine. > > Unfortunatly, the TupleQuery-Objects do not support the > analysis-Features of ParsedQuery. > > All of which leads to 2-3 questions: > > 1. Why is this kind of query accepted by one parser but not the other? > 2. Is it possible to obtain a ParsedQuery-Object from a > TupleQuery-Object? > (3. Is this the right mailing list to post these questions to?) > > Greetings, > > Adrian Bielefeldt > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today. http://sdm.link/xeonphi > _______________________________________________ > Bigdata-developers mailing list > Big...@li... > <mailto:Big...@li...> > https://lists.sourceforge.net/lists/listinfo/bigdata-developers > <https://lists.sourceforge.net/lists/listinfo/bigdata-developers> > > |