Re: Duplicate columns and group keys

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 UTC