-
see also How to use Google Sheets to Manage Wikidata Coreferencing
-
create the query where the org n umber is in D3 e.g. 202100-5521 --> https://query.wikidata.org/sparql?query=SELECT*{?item wdt:P6460%20%22202100-5521%22}
=CONCATENATE("https://query.wikidata.org/sparql?query=SELECT*{?item wdt:P6460%20%22",D3,"%22}")
- create the webcrawl
=SUBSTITUTE(IMPORTXML(C3,"//*[name()='uri']"),"http://www.wikidata.org/entity/","")
- The data returned is the below and the part
//*[name()='uri'
is a XPath that fetches the WD ID from the resulting XML.
<?xml version='1.0' encoding='UTF-8'?>
<sparql xmlns='http://www.w3.org/2005/sparql-results#'>
<head>
<variable name='item'/>
</head>
<results>
<result>
<binding name='item'>
<uri>http://www.wikidata.org/entity/Q3372219</uri>
</binding>
</result>
</results>
</sparql>
- Making more API calls is slow, so Google sheet initially shows "Loading…" for all rows, and gradually "materializes" the WD IDs (Qnnnn) as they come in.