- From: Lee Feigenbaum <lee@thefigtrees.net>
- Date: Thu, 30 Sep 2010 08:51:28 -0400
- To: Andy Seaborne <andy.seaborne@epimorphics.com>
- CC: SPARQL Working Group <public-rdf-dawg@w3.org>
On 9/30/2010 6:57 AM, Andy Seaborne wrote: > Following a jena-dev question, I wondered what do implementations do > with the following? > > # Duplicate select variable - SPARQL 1.0 > SELECT ?s ?s ?p ?o > { > ?s ?p ?o > } Glitter returns the ?s "column" twice, including listing it twice in the <head> of the SRX. > # Duplicate group by variable > SELECT ?s > { > ?s ?p ?o > } GROUP BY ?s ?s I haven't tried this, but I'd expect this just works the same as GROUP BY ?s - is there a subtlety here that I'm missing? Lee > In result sets: two cases, the same binding duplicated in a row and an > attempt to provide different bindings (the latter IMHO is an error > because it's nonsensical in the design). > > # Duplicate in result set (XML) - SPARQL 1.0 > <?xml version="1.0"?> > <sparql xmlns="http://www.w3.org/2005/sparql-results#"> > <head> > <variable name="s"/> > <variable name="p"/> > <variable name="s"/> > <variable name="o"/> > </head> > <results> > <result> > <binding name="s"> <!-- First --> > <uri>http://example/s</uri> > </binding> > <binding name="p"> > <uri>http://example/p</uri> > </binding> > <binding name="s"> <!-- Second (here, the same value) --> > <uri>http://example/s</uri> > </binbding> > <binding name="o"> > <uri>http://example/o</uri> > </binding> > </result> > </results> > </sparql> > > # Duplicate in result set (JSON) - SPARQL 1.0 > { > "head": { > "vars": [ "s" , "p" , "s" , "o" ] > } , > "results": { > "bindings": [ > { > "s": { "type": "uri" , "value": "http://example/s" } , # First > "p": { "type": "uri" , "value": "http://example/p" } , > "s": { "type": "uri" , "value": "http://example/s" } , # Second > "o": { "type": "uri" , "value": "http://example/o" } > } > ] > } > } > > Andy > > Appendix: JSON and duplicate keys: > > The JSON description on json.org does not ban this > [[ > An object is an unordered set of name/value pairs. > ]] > > and RFC 4627 > [[ > An object is an unordered collection of zero or more name/value > pairs, where a name is a string and a value is a string, number, > boolean, null, object, or array. > ... > The names within an object SHOULD be unique. > ]] > > which means ("x", 1) ("x", 2) is a legal as a set of two different pairs > and ("x", 1) , ("x", 1) is a set of one pair but an unordered list or > bag of two pairs. > > The org.json Java implementation throws an exception. > >
Received on Thursday, 30 September 2010 12:52:02 UTC