Skip to content

Commit a818aab

Browse files
committed
#2069: replace lhas_key, publication_uuid, scenario_uuid with has uuid (OEO_00390095)
1 parent db24f67 commit a818aab

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

factsheet/management/commands/bundle_re_structure_for_publications.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def handle(self, *args, **options):
6969
oekg.add(
7070
(
7171
publications_URI,
72-
OEKG["publication_uuid"],
72+
OEO.OEO_00390095,
7373
Literal(publication_uuid),
7474
)
7575
)

factsheet/views.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ def create_factsheet(request, *args, **kwargs):
233233
publications_URI = URIRef(
234234
"http://openenergy-platform.org/ontology/oekg/publication/" + item["id"]
235235
)
236-
bundle.add(
237-
(publications_URI, OEKG["publication_uuid"], Literal(item["id"]))
238-
)
236+
bundle.add((publications_URI, OEO.OEO_00390095, Literal(item["id"])))
239237

240238
bundle.add((study_URI, OEO.BFO_0000051, publications_URI))
241239
if item["report_title"] != "":
@@ -314,7 +312,7 @@ def create_factsheet(request, *args, **kwargs):
314312
)
315313
)
316314

317-
bundle.add((scenario_URI, OEKG["scenario_uuid"], Literal(item["id"])))
315+
bundle.add((scenario_URI, OEO.OEO_00390095, Literal(item["id"])))
318316

319317
if "regions" in item:
320318
for region in item["regions"]:
@@ -415,7 +413,7 @@ def create_factsheet(request, *args, **kwargs):
415413
bundle.add(
416414
(
417415
input_dataset_URI,
418-
OEO["has_key"],
416+
OEO.OEO_00390095,
419417
Literal(input_dataset["key"]),
420418
)
421419
)
@@ -458,7 +456,7 @@ def create_factsheet(request, *args, **kwargs):
458456
bundle.add(
459457
(
460458
output_dataset_URI,
461-
OEO["has_key"],
459+
OEO.OEO_00390095,
462460
Literal(output_dataset["key"]),
463461
)
464462
)
@@ -685,9 +683,7 @@ def update_factsheet(request, *args, **kwargs):
685683
publications_URI = URIRef(
686684
"http://openenergy-platform.org/ontology/oekg/publication/" + item["id"]
687685
)
688-
new_bundle.add(
689-
(publications_URI, OEKG["publication_uuid"], Literal(item["id"]))
690-
)
686+
new_bundle.add((publications_URI, OEO.OEO_00390095, Literal(item["id"])))
691687
new_bundle.add((study_URI, OEO.BFO_0000051, publications_URI))
692688
if item["report_title"] != "":
693689
new_bundle.add(
@@ -752,9 +748,7 @@ def update_factsheet(request, *args, **kwargs):
752748
for s, p, o in oekg.triples((scenario_URI, None, None)):
753749
oekg.remove((o, p, o))
754750

755-
new_bundle.add(
756-
(scenario_URI, OEKG["scenario_uuid"], Literal(item["id"]))
757-
)
751+
new_bundle.add((scenario_URI, OEO.OEO_00390095, Literal(item["id"])))
758752
new_bundle.add((scenario_URI, RDF.type, OEO.OEO_00000365))
759753
new_bundle.add((scenario_URI, RDFS.label, Literal((item["acronym"]))))
760754
if item["name"] != "":
@@ -884,7 +878,7 @@ def update_factsheet(request, *args, **kwargs):
884878
new_bundle.add(
885879
(
886880
input_dataset_URI,
887-
OEO["has_key"],
881+
OEO.OEO_00390095,
888882
Literal(input_dataset["key"]),
889883
)
890884
)
@@ -924,7 +918,7 @@ def update_factsheet(request, *args, **kwargs):
924918
new_bundle.add(
925919
(
926920
output_dataset_URI,
927-
OEO["has_key"],
921+
OEO.OEO_00390095,
928922
Literal(output_dataset["key"]),
929923
)
930924
)
@@ -1284,7 +1278,7 @@ def factsheet_by_id(request, *args, **kwargs):
12841278
if label is not None:
12851279
publication["report_title"] = label
12861280

1287-
publication_uuid = oekg.value(o, OEKG["publication_uuid"])
1281+
publication_uuid = oekg.value(o, OEO.OEO_00390095)
12881282
publication["id"] = publication_uuid
12891283

12901284
publication["authors"] = []
@@ -1314,7 +1308,7 @@ def factsheet_by_id(request, *args, **kwargs):
13141308
for s, p, o in oekg.triples((study_URI, OEO.BFO_0000051, None)):
13151309
scenario = {}
13161310
label = oekg.value(o, RDFS.label)
1317-
scenario_uuid = oekg.value(o, OEKG["scenario_uuid"])
1311+
scenario_uuid = oekg.value(o, OEO.OEO_00390095)
13181312

13191313
if label != None: # noqa
13201314
scenario["acronym"] = label
@@ -1353,7 +1347,7 @@ def factsheet_by_id(request, *args, **kwargs):
13531347
for s2, p2, o2 in oekg.triples((o, OEO.OEO_00020437, None)):
13541348
o2_iri = oekg.value(o2, OEO.OEO_00390094)
13551349
o2_label = oekg.value(o2, RDFS.label)
1356-
o2_key = oekg.value(o2, OEO["has_key"])
1350+
o2_key = oekg.value(o2, OEO.OEO_00390095)
13571351
o2_idx = oekg.value(o2, OEO["has_id"])
13581352

13591353
scenario["input_datasets"].append(
@@ -1367,7 +1361,7 @@ def factsheet_by_id(request, *args, **kwargs):
13671361
for s3, p3, o3 in oekg.triples((o, OEO.OEO_00020436, None)):
13681362
o3_iri = oekg.value(o3, OEO.OEO_00390094)
13691363
o3_label = oekg.value(o3, RDFS.label)
1370-
o3_key = oekg.value(o3, OEO["has_key"])
1364+
o3_key = oekg.value(o3, OEO.OEO_00390095)
13711365
o3_idx = oekg.value(o3, OEO["has_id"])
13721366

13731367
scenario["output_datasets"].append(

0 commit comments

Comments
 (0)