sparql how to search on label's value without the language indicator

1.6k views Asked by At

I have a query like this:

SELECT  ?uri  (STR($labelString) as $label) 
WHERE {?uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.isep.org/desco/2015/RealEstate>
    . ?uri <http://www.w3.org/2000/01/rdf-schema#label> $labelString .
  ?uri <http://www.isep.org/desco/2015/isNearTo> ?placeOfInterest . 
  ?placeOfInterest <http://www.w3.org/2000/01/rdf-schema#label> "Parque Nacional da Peneda-Gerês" }

as you see, i am searching for a specific label, it didn't work because i didn't specify the language,

when i do specify the language like this

SELECT  ?uri  (STR($labelString) as $label) 
WHERE {?uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.isep.org/desco/2015/RealEstate>
    . ?uri <http://www.w3.org/2000/01/rdf-schema#label> $labelString .
  ?uri <http://www.isep.org/desco/2015/isNearTo> ?placeOfInterest . 
  ?placeOfInterest <http://www.w3.org/2000/01/rdf-schema#label> "Parque Nacional da Peneda-Gerês"@pt } 

everything works fine, but the problem is that i don't know what is the language that the label is written in. can i search without specifying the language?

i did search over google and it seems something connecting to filter but really i couldn't find it myself

many thanks for your help

1

There are 1 answers

1
Artemis On

You just need to filter your label with str. So try this on DBpedia:

select distinct *
where {
?x a ?o.
?x rdfs:label ?label
filter(str(?label)="1918 in China")
} LIMIT 100

So based on this, your query needs to be:

SELECT  ?uri  (STR($labelString) as $label) 
WHERE {?uri a <http://www.isep.org/desco/2015/RealEstate>. 
?uri <http://www.w3.org/2000/01/rdf-schema#label> $labelString .
?uri <http://www.isep.org/desco/2015/isNearTo> ?placeOfInterest . 
?placeOfInterest rdfs:label ?label
filter(str(?label)="Parque Nacional da Peneda-Gerês")
}