dbpedia fetch entitites in language other than english

Deadly 提交于 2019-12-01 09:11:43

You need to filter based on the language of the value of the property. Not every property will have values in different languages, but some properties will. It seems, from your example, that dbpprop:name doesn't have values in every language. You may find more values in other languages if you look on the other language specific DBpediae.

However, for something like a name, you'll probably get multi-language results if you use the rdfs:label property. For instance, to get the names of Barack Obama, Daniel Webster, and Johnny Cash in Russian, you could do:

select ?label {
  values ?person { dbpedia:Johnny_Cash dbpedia:Barack_Obama dbpedia:Daniel_Webster }
  ?person rdfs:label ?label .
  filter langMatches(lang(?label),"ru")
}

SPARQL results

As an aside, note the use of langMatches rather than equality for matching language tags. This is usually a better approach, because it will correctly handle the different language tags within a language For example (from the SPARQL specification), you can find both of the French literals:

"Cette Série des Années Soixante-dix"@fr .
"Cette Série des Années Septante"@fr-BE .

with langMatches(lang(?title),"fr"), but only the first one with lang(?title) = "fr".

Artemis

You are looking for rdfs:label for a name, of course all the names are English, you are looking at the English dbpedia.

PREFIX owl: <http://dbpedia.org/ontology/>
PREFIX dbpprop: <http://dbpedia.org/property/>
SELECT distinct *
WHERE {
    ?person a owl:Person .
    ?person rdfs:label ?name . 
    FILTER(lang(?name) = "fr")
}

Again, for the second one, if you replace the name with the rdfs: label you can have:

    PREFIX owl: <http://dbpedia.org/ontology/>
    PREFIX dbpprop: <http://dbpedia.org/property/>
    SELECT distinct *
        WHERE {
    ?person a owl:Person .
    ?person rdfs:label ?name .
    ?person dbpprop:language <http://dbpedia.org/resource/English_language>.
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!