On 19/02/2018 23:59, sanjeev devireddy wrote:
       We have the following two challenges while fetching/parsing the list of preferred/alternative labels received from the the SPARQL Endpoint service response.

1)To get the preferred/alternative label(s) without language tags. We just want to check that is there a way to get the labels without language tags?

You can convert a language-tagged string literal to a simple xsd:string literal using the built-in str function, e.g.

    ?concept skos:prefLabel|skos:altLabel ?label .
    BIND (str(?label) AS ?stringLabel) .

2)When there is a comma in the labels of preferred/alternative labels (please check the below example).

     Assume that there a single concept named Latin America, North America. As shown below, we can see that there are two labels of the languages English & French. Here we can observe that in each language label there is a comma. In this case, using comma as a separator will fail to get the English & French language labels of a single concept Latin America, North America.     "prefLabel_0": { "type": "literal" , "value": "Latin America, North America(en), Amérique latine, Amérique du Nord(fr)" }

   So we just want to check what could be the best way in this kind of scenario?

So you want the query to return all sub-strings as separated by commas? The following example will produce an iteration over all substrings, and trim them off extra spaces in case the string is irregular.

    BIND ("Latin America, North America(en), Amérique latine, Amérique du Nord(fr)" AS ?str)
    ?sub spif:split (?str ",") .
    BIND (spif:trim(?sub) AS ?trimmed) .

To get rid of the language tags, you'd need to do further string processing using functions like spif:indexOf and SUBSTR.


You received this message because you are subscribed to the Google Groups "TopBraid 
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to