Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get string without the language tag

Tags:

sparql

A SPARQL query like:

SELECT distinct *  where  { 
  ?x dc:title ?title .
}

is always returning ?title with a language tag. How to obtain an rdf language string without a language tag, e.g. return "English"@en as "English" only

like image 806
Noor Avatar asked Mar 09 '16 10:03

Noor


1 Answers

I guess you are willing to show the results from one language only. If that is the case, you can take off the label with:

SELECT distinct ?stripped_title  where  { 
?x dc:title ?title .
BIND (STR(?title)  AS ?stripped_title) 
}

but it would be meaningful only after you filter your results for the desired language, e.g.

FILTER ( LANG(?title) = "en" )

Alternatively, there might be some confusion in reading the results, for example you might get seemingly duplicating answers, while it just happened that the label is the same in two different languages.

like image 139
Ivo Velitchkov Avatar answered Sep 18 '22 09:09

Ivo Velitchkov