W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2010

Re: Duplicate columns and group keys

From: Steve Harris <steve.harris@garlik.com>
Date: Thu, 30 Sep 2010 12:47:06 +0100
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <68CA6E55-4D4C-41F1-AA63-2B581ED1A0C0@garlik.com>
To: Andy Seaborne <andy.seaborne@epimorphics.com>
On 2010-09-30, at 11:57, 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
> }

4store only returns each column once, but issues a warning:

# 4s-query test 'SELECT ?s ?p ?o ?s WHERE { ?s ?p ?o } LIMIT 1'

<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
  <head>
    <variable name="s"/>
    <variable name="p"/>
    <variable name="o"/>
  </head>
<!-- parser warning: Variable s duplicated in SELECT at line 1 -->
  <results>
    <result>
      <binding name="s"><uri>file:///tmp/c</uri></binding>
      <binding name="p"><uri>file:///tmp/d</uri></binding>
      <binding name="o"><literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal></binding>
    </result>
  </results>
</sparql>

5store duplicates the column, and no warning:

# keep-query testkb-swh -f sparql 'SELECT ?s ?p ?o ?s WHERE { ?s ?p ?o } LIMIT 1'
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
 <variable name="s"/>
 <variable name="p"/>
 <variable name="o"/>
 <variable name="s"/>
</head>
<results>
<result>
 <binding name="s"><uri>test:x</uri></binding>
 <binding name="p"><uri>test:y</uri></binding>
 <binding name="o"><literal>ntriples</literal></binding>
 <binding name="s"><uri>test:x</uri></binding>
</result>
</results></sparql>

- Steve

-- 
Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203  http://www.garlik.com/
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD
Received on Thursday, 30 September 2010 11:48:13 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:43 GMT