Wikidata LabelService does not behave as expected

后端 未结 1 585
轻奢々
轻奢々 2020-12-12 00:50

The following Wikidata query does not work as I would expect it:

# WikiData SPARQL Query
#
# Wolfgang Fahl 2018-01-06
#
# get father of queen victoria
SELECT         


        
相关标签:
1条回答
  • 2020-12-12 00:52

    The reason why http://www.wikidata.org/prop/direct/P22 is returned instead of father is that Wikidata truthy predicates do not have labels (try DESCRIBE wdt:P22). Only proper properties have labels (try DESCRIBE wd:P22).

    Wikidata label service could wrap this situation, but it doesn't:

    SERVICE wikibase:label only supplies labels for entities in the wd: namepace.

    Thus, try this query:

    SELECT ?queenLabel ?realpropertyLabel ?fatherLabel
    WHERE {
      VALUES (?queen) {(wd:Q9439)}
      VALUES (?property) {(wdt:P22)}
      ?queen ?property ?father .
      ?realproperty wikibase:directClaim ?property
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
    } 
    
    0 讨论(0)
提交回复
热议问题