Skip to content

Commit

Permalink
Merge pull request #68 from acdh-oeaw/67-make_appellations-woke-type-…
Browse files Browse the repository at this point in the history
…for-persname

added woke_type to make_appellations closes #67
  • Loading branch information
csae8092 authored Aug 29, 2023
2 parents 8f20018 + 2722419 commit 8542af4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion acdh_cidoc_pyutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def make_appellations(
node: Element,
type_domain="https://foo-bar/",
type_attribute="type",
woke_type=False,
default_lang="de",
special_xpath=None,
) -> Graph:
Expand Down Expand Up @@ -239,6 +240,8 @@ def make_appellations(
type_label = y.get(type_attribute)
if type_label:
cur_type_uri = URIRef(f"{type_uri}/{slugify(type_label)}".lower())
elif woke_type:
cur_type_uri = URIRef(f"{type_uri.lower()}/{woke_type}")
else:
cur_type_uri = URIRef(type_uri.lower())
g.add((cur_type_uri, RDF.type, CIDOC["E55_Type"]))
Expand All @@ -257,7 +260,10 @@ def make_appellations(
Literal(normalize_string(entity_label_str), lang=cur_lang),
)
)
cur_type_uri = URIRef(f"{type_uri.lower()}")
if woke_type:
cur_type_uri = URIRef(f"{type_uri.lower()}/{woke_type}")
else:
cur_type_uri = URIRef(f"{type_uri.lower()}")
g.add((cur_type_uri, RDF.type, CIDOC["E55_Type"]))
g.add((app_uri, CIDOC["P2_has_type"], cur_type_uri))
# see https://github.com/acdh-oeaw/acdh-cidoc-pyutils/issues/36
Expand Down

0 comments on commit 8542af4

Please sign in to comment.