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

RE: SPARQL Query Problem - perhaps solvable in 1.1?

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Tue, 25 Aug 2009 13:14:39 +0000
To: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-ID: <B6CF1054FDC8B845BF93A6645D19BEA3693CC70314@GVW1118EXC.americas.hpqcorp.net>
Even though this particular problem can be done with a cascade of OPTIONALs, it would be useful to have the new special forms COALESCE and IF(cond, expr1, expr2) anyway.

Need to consider the effect of COALESCE(undef,undef, ... ,undef) because of bound(coalesce(...))

The "IF" returns the value of the expression evaluated.


> -----Original Message-----
> From: public-rdf-dawg-request@w3.org [mailto:public-rdf-dawg-
> request@w3.org] On Behalf Of Lee Feigenbaum
> Sent: 25 August 2009 13:46
> To: Toby Inkster
> Cc: public-rdf-dawg@w3.org; public-sparql-dev@w3.org
> Subject: Re: SPARQL Query Problem - perhaps solvable in 1.1?
> Hi Toby,
> I've CCed the SPARQL WG list but also the public-sparql-dev list which
> in general is better suited for "how do I..." SPARQL questions. If I'm
> correct that that best suits the nature of this question, please drop
> public-rdf-dawg@w3.org from future messages in this thread.
> If I understand you correctly, the pattern you're looking for is that
> you have a prioritized list of predicates that you want to use for a
> particular value, in this case date. The "canonical" way to do this in
> SPARQL (or, at least, what I've always done and seen done) is to use a
> series of OPTIONAL clauses that all bind to the same variable:
> SELECT ?date {
>     ?item a ex:Item .
>     OPTIONAL { ?item dct:created ?date }
>     OPTIONAL { ?item dct:issued ?date }
>     OPTIONAL { ?item dct:date ?date }
>     OPTIONAL { ?item dc:date ?date }
> } ORDER BY ?date
> This will bind ?date to the first of the predicates that have a value
> for each ex:Item.
> Please let me know if I'm misunderstanding your needs.
> thanks,
> Lee

Received on Tuesday, 25 August 2009 13:16:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:08:26 GMT