I have the following SPARQL query:
SELECT ?label ?img
WHERE
{
?uri rdfs:label ?label .
?uri vtio:hasImage ?img .
}
With results like the following:
label | img
-------------
label | link1
labe2 | link2
…
I also want the label without ?img
also matched i.e. entries where ?img
is NULL
i.e. I want results like the following:
label | img
--------------
label1 | link1
label2 |
label3 | link3
…
If I use my earlier query a result for label2
will not be shown?
How do I modify my query to also include rows like this?
Use OPTIONAL:
select ?label ?img where {
?uri rdfs:label ?label.
OPTIONAL { ?uri vtio:hasImage ?img. }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With