Hi Holger,
Your suggestion of using built-in str function works only when all the language labels are queried. As per our requirement, we wrote a SPARQL (please check below) to get English language labels only and in this case the built-in str function fails(please check below screenshot) to convert a language-tagged string literal to a simple
xsd:string literal. Could you please check the below SPARQL to see if there is any change that can be done to the SPARQL to convert a language-tagged string literal to a simple
xsd:string literal?
SPARQL:
SELECT DISTINCT ?preferredlabel ?stringPrefLabel ?result
WHERE {
GRAPH <urn:x-evn-master:geo> {
{
?result a <http://topquadrant.com/ns/examples/geography#Continent> .
} .
BIND (search:nestedObjectsList(?result, skos:prefLabel, "result", ?none, "en") AS ?preferredlabel) .
BIND (str(?preferredlabel) AS ?stringPrefLabel) .
}
}
ORDER BY (LCASE(?label))
Coming to the other question on dealing with the label that has comma in it,it seems in the above post I was referring to a bad example so below is another example that I wan t to share.
Our taxonomy has a concept and it's preferred labels in English & French languages are
Government, Central/Federal (en) and
Gouvernement, Central/Fédéral (fr). Here the thing to observe is that each label contains comma in it. Now, when a SPARQL is written to get the above preferred labels of the concept and use SPARQL Endpoint service then the response contains the two language labels separated by comma as shown below. Now the challenge is that the labels contains a comma in them and the separator for the English and French labels is also a comma.So, using comma as separator to get labels from the below json will give the 4 values i) Government
, ii)Central/Federal (en)
, iii) Gouvernement , iv)Central/Fédéral (fr). But the requirement is to get the actual English and French language labels correctly.
e.g.: "prefLabel_0":{"value":"
Government, Central/Federal (en),
Gouvernement, Central/Fédéral (fr)","type":"literal"}
So, we just want to check that what could be the best way in this kind of scenarios to get the labels correctly? Is there way to specify a separator(like pipe (|) ) for the preferred/ alternate labels list in the above json through the SPARQL Endpoint service or so?
Thanks,
Sanjeev