wikidata get all properties with labels and values of an item

前端 未结 1 1295
醉梦人生
醉梦人生 2020-12-01 17:18

My question is how I can extract all properties and there respective labels that are also rendered on the webpage from wikidata preferably over SPARQL.

Take for exa

相关标签:
1条回答
  • 2020-12-01 17:48

    Useful links on the Wikidata data model:

    • RDF dump format
    • Wikidata qualifiers, references and ranks
    • Help:qualifiers

    Your query should be of this kind:

    SELECT ?wdLabel ?ps_Label ?wdpqLabel ?pq_Label {
      VALUES (?company) {(wd:Q95)}
    
      ?company ?p ?statement .
      ?statement ?ps ?ps_ .
    
      ?wd wikibase:claim ?p.
      ?wd wikibase:statementProperty ?ps.
    
      OPTIONAL {
      ?statement ?pq ?pq_ .
      ?wdpq wikibase:qualifier ?pq .
      }
    
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    } ORDER BY ?wd ?statement ?ps_
    

    Try it!

    Only qualifiers and their values are included in the result. Neither provenance references nor value annotations (e.g. time precision) are included. Please write a comment if you need to add them.

    0 讨论(0)
提交回复
热议问题