Last active
April 3, 2017 11:48
-
-
Save paregorios/64873fabf30e49e2827508c337431f3f to your computer and use it in GitHub Desktop.
How to find all Pleiades URIs that correspond to a Trismegistos place URI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read in the json and get the graph of places | |
import json | |
with open('pleiades-places-latest.json', 'r', encoding='utf-8') as f: | |
pj = json.load(f) | |
graph = pj['@graph'] | |
# iterate through the graph and test each place for a TM reference | |
for place in graph: | |
references = place['references'] | |
tm_geoids = [r['accessURI'] for r in references if 'trismegistos' in r['accessURI']] | |
if len(tm_geoids) == 1: | |
print('{} = {}'.format(place['uri'], tm_geoids[0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @fosco13! I've updated the gist.