[redland-dev] Status of OPTIONAL
Knud Hinnerk Möller
knud.moeller at deri.org
Wed Mar 21 10:51:23 UTC 2007
Yes, that's what I thought. Anyway, it's not really urgent for me (I =
did a programmatic workaround now). Still, I would be cool to have =
it! :-)
Cheers,
Knud
Am 21.03.2007 um 09:41 schrieb Seaborne, Andy:
> -------- Original Message --------
>> From: Richard Newman <>
>> Date: 20 March 2007 20:10
>>
>> Try nesting them.
>>
>> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox ?hpage
>> WHERE { ?x foaf:name ?name . OPTIONAL {
>> ?x foaf:mbox ?mbox .
>> OPTIONAL { ?x foaf:homepage ?hpage }
>> }
>> }
>>
>> The semantics should be the same, and it might work (that's a problem
>> with a few RDF toolkits).
>>
>> -R
>
> The semantics aren't the same!
>
> Pattern 1:
>
> WHERE { ?x foaf:name ?name .
> OPTIONAL { ?x foaf:mbox ?mbox } .
> OPTIONAL { ?x foaf:homepage ?hpage } }
>
>
> Pattern 2:
>
> WHERE { ?x foaf:name ?name .
> OPTIONAL {
> ?x foaf:mbox ?mbox .
> OPTIONAL { ?x foaf:homepage ?hpage }
>
> In pattern 2, ?hpage can only be bound if ?mbox is also bound.
> If ?mbox does not match, it will fail the outer OPTIONAL and so the =
> inner one, with ?hpage, will not return a binding regardless of =
> whether the inner pattern matches.
>
> In pattern 1, one, both or neither of ?mbox, ?hpage can be bound.
>
> Andy
>
>
>>
>>
>> On 20 Mar 2007, at 1:06 PM, Knud Hinnerk M=F6ller wrote:
>>
>>> Hi,
>>>
>>> I know OPTIONAL doesn't work properly yet - do you have any idea =
>>> when
>>> it will? Single OPTIONALS seem to work fine, but multiples don't =
>>> seem
>>> to work. In particular, this query from the SPARQL spec seems to =
>>> work:
>>>
>>> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox =
>>> WHERE {
>>> ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox }
>>> }
>>>
>>> But this one doesn't:
>>>
>>> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox ?hpage
>>> WHERE { ?x foaf:name ?name .
>>> OPTIONAL { ?x foaf:mbox ?mbox } .
>>> OPTIONAL { ?x foaf:homepage ?hpage } }
>>>
>>> The first OPTIONAL is ignored, and the query evaluates =
>>> identically to:
>>>
>>> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox ?hpage
>>> WHERE { ?x foaf:name ?name .
>>> ?x foaf:mbox ?mbox .
>>> OPTIONAL { ?x foaf:homepage ?hpage } }
>>>
>>> In the meantime, are there any code examples that show how to do a
>>> workaround programmatically?
>>>
>>> Cheers,
>>> Knud
>>> -------------------------------------------------
>>> Knud M=F6ller, MA
>>> +353 - 91 - 495086
>>> Digital Enterprise Research Institute
>>> National University of Ireland, Galway Institi=FAid Taighde na
>>> Fiontra=EDochta Digit=ED Ollscoil na h=C9ireann, Gaillimh
>>>
>>>
>>> _______________________________________________
>>> redland-dev mailing list
>>> redland-dev at lists.librdf.org
>>> http://lists.librdf.org/mailman/listinfo/redland-dev
>>
>> _______________________________________________
>> redland-dev mailing list
>> redland-dev at lists.librdf.org
>> http://lists.librdf.org/mailman/listinfo/redland-dev
>
-------------------------------------------------
Knud M=F6ller, MA
+353 - 91 - 495086
Digital Enterprise Research Institute
National University of Ireland, Galway
Institi=FAid Taighde na Fiontra=EDochta Digit=ED
Ollscoil na h=C9ireann, Gaillimh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/redland-dev/attachments/20070321/=
0987c832/attachment-0001.htm
More information about the redland-dev
mailing list