0

I want to gather all properties of a item from wikidata.

All queries I see so far assume you know properties you are looking for, but in my case, I'm not.

For example, when querying for Q1798740, I would like a returned value that looks like

[{"item": "Q1798740",
  "P31": ["Q1146"],
  "P17": ["Q70972"],
  ...
  "P2043":"70 metres"}
]

and that contains all statements from the wikidata page

What query should I perform?

Manu H
  • 523
  • 1
  • 5
  • 17
  • no need to use SPARQL: https://stackoverflow.com/questions/38906932/how-to-programmatically-get-all-available-information-from-a-wikidata-entity – UninformedUser Apr 01 '20 at 10:48

1 Answers1

1

You need only to ask for {wd:Q1798740 ?p ?value} but it would be useful also to get the labels of the properties, which is a bit trickier:

SELECT DISTINCT ?p ?property_label ?value 
WHERE
{
wd:Q1798740 ?p ?value .

?property wikibase:directClaim ?p ;
          rdfs:label ?property_label .

 FILTER(LANG(?property_label)="en")
}
Ivo Velitchkov
  • 2,361
  • 11
  • 21
  • a more complete solution was already given here: https://stackoverflow.com/questions/46383784/wikidata-get-all-properties-with-labels-and-values-of-an-item – UninformedUser Apr 01 '20 at 17:41