Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Apr 11, 2024
1 parent ffc9c96 commit f323bae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions dsp_permissions_scripts/oap/oap_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ def _get_all_oaps_of_project(
shortcode: str, dsp_client: DspClient, excluded_class_iris: Iterable[str] = (), prefixed_prop: str | None = None
) -> list[Oap]:
project_iri, onto_iris = get_project_iri_and_onto_iris_by_shortcode(shortcode, dsp_client)
all_resource_oaps = []
all_oaps = []
resclass_iris = get_all_resource_class_iris_of_project(onto_iris, dsp_client)
resclass_iris = [x for x in resclass_iris if x not in excluded_class_iris]
for resclass_iri in resclass_iris:
resource_oaps = _get_all_oaps_of_resclass(resclass_iri, project_iri, dsp_client, prefixed_prop)
all_resource_oaps.extend(resource_oaps)
return all_resource_oaps
oaps = _get_all_oaps_of_resclass(resclass_iri, project_iri, dsp_client, prefixed_prop)
all_oaps.extend(oaps)
return all_oaps
6 changes: 3 additions & 3 deletions dsp_permissions_scripts/oap/oap_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def serialize_oaps(
folder = _get_project_data_path(shortcode, mode)
folder.mkdir(parents=True, exist_ok=True)
logger.info(f"Writing {len(oaps)} OAPs into {str(folder)}")
for res_oap in oaps:
filename = re.sub(r"http://rdfh\.ch/[^/]+/", "resource_", res_oap.object_iri)
for oap in oaps:
filename = re.sub(r"http://rdfh\.ch/[^/]+/", "resource_", oap.object_iri)
filename = re.sub(r"/", "_", filename)
with open(folder / f"{filename}.json", mode="w", encoding="utf-8") as f:
f.write(res_oap.model_dump_json(indent=2))
f.write(oap.model_dump_json(indent=2))
logger.info(f"Successfully wrote {len(oaps)} OAPs into {str(folder)}")


Expand Down

0 comments on commit f323bae

Please sign in to comment.