Skip to content

[Sparql Factory] Prefered languages for text literals

Functions such as "get labeled nodes" should handle language string in a smart way.

Prefer langString with language in a given order (eg. fr, it, en) or fallback to no xsd:string.

Maybe something like that (from https://stackoverflow.com/questions/56674720/sparql-query-template-with-language-filters) :

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
select * where { 
    bind(skos:member as ?s)
        ?s ?p ?o .
        filter (
            !isLiteral(?o) ||
            langmatches(lang(?o), "en") 
            || (langmatches(lang(?o), "") && not exists {
                    ?s ?p ?other. 
                    filter(isLiteral(?other) && langmatches(lang(?other), "en")) 
                }))

} 
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information