Language tag in SMS2

When I query the graph produced with the following mapping:

prefix ndm: <>
prefix dct: <>
prefix dcterms: <>
prefix adms: <> 
prefix dcat: <>
prefix owl:	<>
prefix foaf: <>
prefix vcard: <> 
PREFIX skos: <>
PREFIX xsd: <>

MAPPING <urn:ndm> 
FROM JSON { "metadata":
                { "product_id":"?product_id",
TO { ?product a dcat:Dataset ; 
            dct:identifier ?product_id; 
            dct:description "?description_en" @en; 
            dct:description "?description_fr" @fr; 
            dct:title "?title_en" @en; 
            dct:title "?title_fr" @fr; 
    BIND (template("{product_id}") AS ?product) 

I get the following result with no indication of language, and this is not helpful to me.

    <> <> "2012-10-15T12:30:00Z" ; 
    <> "<p>This table contains 42 series, with data for years 1961 - 2011</p>"^^<> , "<p>Ce tableau contient 42 séries, avec des données pour les années 1961 - 2011 </p>"^^<> ;
    <> "3610051701" ;
    <> "Comptes du bilan national, Banque du Canada, annuel, 1961 - 2011"^^<> , "National balance sheet, Bank of Canada, annual, 1961 - 2011"^^<> ;

I read previous posts with similar issues and was wondering whether it has been fixed. Otherwise, what do you recommend? BTW, this was run with version 6.2.2.


In your mapping, you have a space between the string literals and your language tags. In the spec(s) there should not be one. So if you do dct:description "?description_en"@en; you should see the results you want.

Hi Stephen,
No, that does not work. I was actually trying different things to make it work, and, one of them was to add a space. I simply forgot to remove it before posting. It produces the same result.

Interesting that it's getting a langString datatype but not the language tag. The previous reports you're referring to might be about dynampically applying the language tag from a mapping but I'm not sure what specific report you're referencing.

Are you mapping from a JSON file or MongoDB? If it's a JSON file or if you're materializing the data from MongoDB an interim solution could be to use a throw away predicate and then do a sparql update to get the language tag and correct the predicate.

dct:description "?description_en" @en; to :description_en "?description_en" @en;

Hi Zachary,
For the report, I grabbed the text from Stardog Studio in Visualize...
Thanks for putting me on the right track. I used temp predicates as you suggested. But "?description_en"@en is treated as a literal, so I had to update with a query:

?dataset dct:description ?new_description.
?dataset a dcat:Dataset; ndm:description_fr ?description_fr.
BIND (STRLANG(?description_en,'en') AS ?new_description).

Great. I'm glad to hear that worked out for you. It would obviously be better to be able to do it in the mapping but hopefully this is a workable interim solution if there actually is a bug with the mapping service.

Your update query is what I had in mind. It looks like you're mixing up en and fr but I'm guessing that's just a copy/paste error. You can also delete the dummy predicates with a DELETE/INSERT/WHERE update query.

Yes, I deleted temp predicates.

Did you try using BIND with STRLANG in the mappings?

The mapping does not support the STRLANG function...

I don't think it's supported yet for the relational db mapings but it may be supported for the json mappings. It didn't occur to me at the time you asked your question that this might be the case which is probably why @jess is asking if you tried it or if you just assumed it didn't work from the previous report of it not working with the relational mapping.

Sorry it's been a long month. Support for STRLANG() in SMS2 mappings will be included in the release next week.

I'll create a new ticket for the language tag being ignored in the mapping target.

@zachary.whitley, I tried it. And this is what I got:
Binding functions other than template() and cast are unsupported. Found StrLang for variable new_description
But as I mentioned earlier, I am using version 6.2.2. I am mapping from MongoDB.
@jess, I am glad to know that it will be in the newer release.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.