Skip to content

Commit

Permalink
OAPs: exclude classes Page and Document
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 15, 2023
1 parent 5a045f2 commit ecd3ee7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dsp_permissions_scripts/scenario-tanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,15 @@ def update_oaps(
shortcode: str,
token: str,
) -> None:
excluded_class_iris = [
f"http://{host}/ontology/0102/scenario-tanner/v2#Document",
f"http://{host}/ontology/0102/scenario-tanner/v2#Page",
]
resource_oaps = get_all_resource_oaps_of_project(
shortcode=shortcode,
host=host,
token=token,
excluded_class_iris=excluded_class_iris,
)
serialize_resource_oaps(
resource_oaps=resource_oaps,
Expand Down
3 changes: 3 additions & 0 deletions dsp_permissions_scripts/utils/project.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import warnings
from typing import Iterable
from urllib.parse import quote_plus

import requests
Expand Down Expand Up @@ -158,6 +159,7 @@ def get_all_resource_oaps_of_project(
shortcode: str,
host: str,
token: str,
excluded_class_iris: Iterable[str] = (),
) -> list[Oap]:
logger.info(f"******* Getting all resource OAPs of project {shortcode} *******")
print(f"{get_timestamp()}: ******* Getting all resource OAPs of project {shortcode} *******")
Expand All @@ -171,6 +173,7 @@ def get_all_resource_oaps_of_project(
host=host,
token=token,
)
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_resource_oaps_of_resclass(
host=host,
Expand Down

0 comments on commit ecd3ee7

Please sign in to comment.