Language tag in SMS2

When I query the graph produced with the following mapping:

prefix ndm: <http://statcan.gc.ca/ndm/>
prefix dct: <http://purl.org/dc/terms/>
prefix dcterms: <http://purl.org/dc/terms/>
prefix adms: <http://www.w3.org/ns/adms#> 
prefix dcat: <http://www.w3.org/ns/dcat/>
prefix owl:	<http://www.w3.org/2002/07/owl#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix vcard: <http://www.w3.org/2006/vcard/ns#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

MAPPING <urn:ndm> 
FROM JSON { "metadata":
                { "product_id":"?product_id",
                "title_en":"?title_en", 
                "title_fr":"?title_fr",
                "description_en":"?description_en", 
                "description_fr":"?description_fr" 
                } 
        } 
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; 
} 
WHERE { 
    BIND (template("http://statcan.gc.ca/ndm/{product_id}") AS ?product) 
}
;

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

{
    <http://statcan.gc.ca/ndm/3610051701> <http://purl.org/dc/terms/issued> "2012-10-15T12:30:00Z" ; 
    <http://purl.org/dc/terms/description> "<p>This table contains 42 series, with data for years 1961 - 2011</p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> , "<p>Ce tableau contient 42 séries, avec des données pour les années 1961 - 2011 </p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> ;
    <http://purl.org/dc/terms/identifier> "3610051701" ;
    <http://purl.org/dc/terms/title> "Comptes du bilan national, Banque du Canada, annuel, 1961 - 2011"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> , "National balance sheet, Bank of Canada, annual, 1961 - 2011"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> ;
}

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.
Thanks,
Francine.

Hi,

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:

INSERT {
?dataset dct:description ?new_description.
}
WHERE {
?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.

https://www.w3.org/TR/sparql11-update/#deleteInsert

Yes, I deleted temp predicates.
Thanks

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.