Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Wikidata objects connected to Europeana merged in the last week -
# see
# query
# youtube
from SPARQLWrapper import SPARQLWrapper, JSON
endpoint_url = ""
query = """SELECT ?EuropeanaEntity ?tgt ?change (REPLACE(STR(?item), ".*Q", "Q") AS ?qid) (REPLACE(STR(?tgt), ".*Q", "Q") AS ?tgtQid) ?tgtLabel WHERE {
?tgt wdt:P7704 ?EuropeanaEntityID.
?item owl:sameAs ?tgt;
schema:dateModified ?change.
BIND((NOW()) - ?change AS ?date_range)
FILTER(?date_range < 8 )
BIND(URI(CONCAT("", ?EuropeanaEntityID)) AS ?EuropeanaEntity)
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,de". }
ORDER BY DESC(?change)"""
def get_results(endpoint_url, query):
sparql = SPARQLWrapper(endpoint_url)
return sparql.query().convert()
results = get_results(endpoint_url, query)
for result in results["results"]["bindings"]:

This comment has been minimized.

Copy link
Owner Author

salgo60 commented Dec 20, 2019

{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'O. Henry'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-19T18:12:30Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q50414656'}, 'tgtQid': {'type': 'literal', 'value': 'Q172788'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'Martin Sjardijn'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-19T16:39:39Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q77971378'}, 'tgtQid': {'type': 'literal', 'value': 'Q2849054'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'Shakili Alasgar'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-19T06:35:24Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q55197795'}, 'tgtQid': {'type': 'literal', 'value': 'Q12850169'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'William Kelly'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-19T00:53:33Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q20858032'}, 'tgtQid': {'type': 'literal', 'value': 'Q8013902'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'George Frederick Harris'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-18T13:06:49Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q43131267'}, 'tgtQid': {'type': 'literal', 'value': 'Q5539465'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'Halide Edib Adıvar'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-18T10:12:35Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q16434869'}, 'tgtQid': {'type': 'literal', 'value': 'Q234289'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'Princess Eugénie of Sweden'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-17T16:15:09Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q75385428'}, 'tgtQid': {'type': 'literal', 'value': 'Q526915'}}
{'tgt': {'type': 'uri', 'value': ''}, 'tgtLabel': {'xml:lang': 'en', 'type': 'literal', 'value': 'Ambrose Macdonald Poynter'}, 'change': {'datatype': '', 'type': 'literal', 'value': '2019-12-17T15:22:20Z'}, 'EuropeanaEntity': {'type': 'uri', 'value': ''}, 'qid': {'type': 'literal', 'value': 'Q75491003'}, 'tgtQid': {'type': 'literal', 'value': 'Q4741823'}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.