I'm trying to get the list of all properties of a specific wikidata entity, starting from its id (e.g. Q39659506). I've tried to make some requests at wikidata's API using wbsearchentities and wbgetentities, but computations are too slow, due to the amount of requests and the necessary data preprocessing to obtain a Pandas Dataframe that lists properties and values like the following:
Example of the dataframe of wikidata properties I am to get
I've also tried the wikidata library for python that iterates over properties, but it is too slow compared to SPARQL. I am therefore writing this post to ask for suggestions on how to build the query such that I get properties URL, label and values URL (when available) and values, with quantities unit attached. Till now I've only been able to get the list of properties whose values are entities themselves, but not quantities or dates. You can find the query below:
# Specifying we get our info from entity DB
PREFIX entity: <http://www.wikidata.org/entity/>
SELECT ?propUrl ?propLabel ?valUrl ?valLabel ?valDesc
WHERE {
# Select the entity
entity:Q39659506 ?propUrl ?valUrl .
# Specify the property
?property ?ref ?propUrl;
rdf:type wikibase:Property;
rdfs:label ?propLabel .
# Gather values label and description
?valUrl rdfs:label ?valLabel;
schema:description ?valDesc.
# Only english language
FILTER (lang(?valLabel) = 'en') .
FILTER (lang(?propLabel) = 'en' )
FILTER (lang(?valDesc) = 'en' )
}
Thank you so much!