Search in a multilingual database for terms that have not been translated into a specific language

痞子三分冷 提交于 2020-01-14 14:48:07

问题


My query in a multilingual thesaurus looks like this:

select (COUNT(?label) as ?pCount)
where {?term <http://www.w3.org/2004/02/skos/core#prefLabel> ?label 
FILTER(langMatches(lang(?label), "DE"))}

I get a huge number of concepts with their German translation, which is what I expect from this query.
I'm now looking for a query giving me all concepts without any German translation, that is all which have no "prefLabel" with "@de".

How would such a query look like?


回答1:


You want either FILTER NOT EXISTS or MINUS:

select ?term
where {
    ?term a <http://www.w3.org/2004/02/skos/core#Concept>
    MINUS {
        ?term <http://www.w3.org/2004/02/skos/core#prefLabel> ?label
        FILTER(langMatches(lang(?label), "DE"))
    }
}

Either will work here (I've used MINUS because it's shorter).

With MINUS the matching rows of the right hand (or, rather, bottom) block are removed from the other side. In this case terms with german labels are removed from the list of all concepts (?term a <http://www.w3.org/2004/02/skos/core#Concept>).

(If your concepts aren't explicitly typed as such you could use ?term <http://www.w3.org/2004/02/skos/core#prefLabel> ?someLabel instead, but you might want to add a DISTINCT to tidy up)



来源:https://stackoverflow.com/questions/16415515/search-in-a-multilingual-database-for-terms-that-have-not-been-translated-into-a

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!