[redland-dev] Status of OPTIONAL
Richard Newman
r.newman at reading.ac.uk
Tue Mar 20 20:10:29 UTC 2007
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
On 20 Mar 2007, at 1:06 PM, Knud Hinnerk Möller 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öller, MA
> +353 - 91 - 495086
> Digital Enterprise Research Institute
> National University of Ireland, Galway
> Institiúid Taighde na Fiontraíochta Digití
> Ollscoil na hÉireann, Gaillimh
>
>
> _______________________________________________
> redland-dev mailing list
> redland-dev at lists.librdf.org
> http://lists.librdf.org/mailman/listinfo/redland-dev
More information about the redland-dev
mailing list