Reputation: 43146
I am querying the french dbpedia (http://fr.dbpedia.org/) with SPARQL.
I am using Python and SPARQLWrapper if it makes any difference.
This 1st query is working Ok.
PREFIX dbpp:<http://dbpedia.org/property/>
PREFIX dbpo:<http://dbpedia.org/ontology/>
PREFIX dbpr:<http://dbpedia.org/resource/>
SELECT ?wt ?summary ?source_url
WHERE {
?wt rdfs:label "Concerto"@fr .
OPTIONAL { ?wt dbpedia-owl:abstract ?summary . }
OPTIONAL { ?wt foaf:isPrimaryTopicOf ?source_url . }
filter (lang(?summary) = "fr" )
}
This 2nd query doesn't work.
PREFIX dbpp:<http://dbpedia.org/property/>
PREFIX dbpo:<http://dbpedia.org/ontology/>
PREFIX dbpr:<http://dbpedia.org/resource/>
SELECT ?wt ?summary ?source_url
WHERE {
?wt rdfs:label "Opéra"@fr .
OPTIONAL { ?wt dbpedia-owl:abstract ?summary . }
OPTIONAL { ?wt foaf:isPrimaryTopicOf ?source_url . }
filter (lang(?summary) = "fr" )
}
The only difference is the value of the label. The page http://fr.dbpedia.org/page/Opéra
exists in dbpedia and rdfs label is set as "Opéra".
I think that the query doesn't work because it contains the french letter é
. I've tried several escaping (Op%C3%A9re
, Op\u0233ra
, Op\xe9ra
) without any success.
Any idea?
Upvotes: 2
Views: 598
Reputation: 1453
The problem is that the FILTER
is not made optional. So it doesn't match <http://fr.dbpedia.org/resource/Opéra>
, which has no dbpedia-owl:abstract
.
PREFIX dbpp: <http://dbpedia.org/property/>
PREFIX dbpo: <http://dbpedia.org/ontology/>
PREFIX dbpr: <http://dbpedia.org/resource/>
SELECT ?wt ?summary ?source_url
WHERE {
?wt rdfs:label "Opéra"@fr .
OPTIONAL { ?wt dbpedia-owl:abstract ?summary .
filter (lang(?summary) = "fr" )
}
OPTIONAL { ?wt foaf:isPrimaryTopicOf ?source_url . }
}
... works (and returns <http://fr.dbpedia.org/resource/Catégorie:Opéra>
as well).
Upvotes: 2