-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplodlib_examples.py
48 lines (35 loc) · 1.24 KB
/
plodlib_examples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import plodlib
r_list = ['pompeii','r1','r1-i1','r1-i9-p1','bird','dog','ariadne','bogus_id_bogus']
# run through instantiating ids and printing standard info
for r in r_list:
c = plodlib.PLODResource(r)
print(f'''*Made instance of PLODResource for "{r}" now reading from returned object
Identifier: {c.identifier} (as passed: {c._identifier_parameter})
Type: {c.rdf_type}
Label: {c.label}
P-in-P URL: {c.p_in_p_url}
Wikidata URL: {c.wikidata_url}
''')
# Call functions for each item in r_list
for r in r_list:
print(f'*Spatial hierarchy for "{r}"')
print(plodlib.PLODResource(r).spatial_hierarchy_up())
for r in r_list:
print(f'*Spatial children for "{r}"')
print(plodlib.PLODResource(r).spatial_children())
for r in r_list:
print(f'*Depicted concepts for "{r}"')
print(plodlib.PLODResource(r).depicts_concepts())
for r in r_list:
print(f'*Depicted where for "{r}"')
print(plodlib.PLODResource(r).depicted_where())
# instances of type
type_list = ['region','street']
for r in type_list:
print(f'*Instances of "{r}"')
print(plodlib.PLODResource(r).instances_of())
# predicates
predicate_list = ['wikidata-url']
for r in predicate_list:
print(f'*"{r}" used as predicate by')
print(plodlib.PLODResource(r).used_as_predicate_by())