W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2009

question about OPTIONAL and UNION key words

From: Mo Zhou <mozhou@umail.iu.edu>
Date: Wed, 27 May 2009 13:57:45 -0400
Message-ID: <9cc22400905271057i1ba3a7cesf14fc31adaf2e67d@mail.gmail.com>
To: public-rdf-dawg-comments@w3.org
Hi,

I recently read the specification. It is very helpful. However I got
confused by the difference between OPTIONAL and UNION key words. In
all queries using OPTIONAL, we can use UNION to write a query that
generates the same results. and vice versa.

for example:

select ?x ?mbox
where{
?x foaf:name ?name .
optional {?x foaf:mbox ?mbox} .
optional {?x foaf:homepage ?hpage}
}

will generate the same result as

select ?x ?mbox
where{
{?x foaf:name ?name } .
UNION
{?x foaf:mbox ?mbox} .
UNION
{?x foaf:homepage ?hpage}
}

So why the specification includes both OPTIONAL and UNION?

-- 
Thanks,
Mo
Received on Thursday, 28 May 2009 06:44:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 28 May 2009 06:44:12 GMT