On 27/05/16 14:23, Mikael Pesonen wrote:
Hi,
This query does what i want, that is, lists all graphs having the term
"digitalisaatio"@fi:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?s ?graphTitle1 ?graphTitle2
WHERE {
GRAPH ?graph
{
?s skos:prefLabel "digitalisaatio"@fi
OPTIONAL { ?graph dcterms:title ?graphTitle1 }
}}
But when I add new param
OPTIONAL { ?graph dc:title ?graphTitle2}
so that new query is this:
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?s ?graphTitle1 ?graphTitle2
WHERE {
GRAPH ?graph
{
?s skos:prefLabel "digitalisaatio"@fi
OPTIONAL { ?graph dcterms:title ?graphTitle1 }
OPTIONAL { ?graph dc:title ?graphTitle2}
}}
This will depend on your data model.
Do you have a complete, minimal example? (some small amount of data and
a query that you expect to work).
I dont get all the graphs anymore. OPTIONAL should never filter out
data, just add? There must be a logical explanation, but I'm not getting
it. Im using Fuseki.
Which version?
Andy
By the way:
OPTIONAL { ?graph (dcterms:title|dc:title) ?graphTitle1 }
asks for either dcterms:title or dc:title or both.
Br,
Mikael