Skip to content

Commit

Permalink
zml2lido: dont treat herstellendeKollektive as places and map Ethnien…
Browse files Browse the repository at this point in the history
… to lido:culture
  • Loading branch information
mokko committed May 25, 2024
1 parent 4804992 commit 1416422
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 11 deletions.
59 changes: 53 additions & 6 deletions zml2lido/data/xsl/zml2lido/event-Herstellung.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@
z:repeatableGroup[
@name = 'ObjGeograficGrp']/
z:repeatableGroupItem[
z:vocabularyReference/@name = 'GeopolVoc'
and z:vocabularyReferenceItem/@name = $herstellendeKollektive
z:vocabularyReference[
@name = 'GeopolVoc'
]/z:vocabularyReferenceItem[
z:formattedValue = $herstellendeKollektive
]
]"/>

<!--
Expand All @@ -82,9 +85,15 @@
@name = 'TypeVoc'
]/z:vocabularyReferenceItem[
@name = $herstellendeOrtstypen
] or not(z:vocabularyReference[
]
or not(z:vocabularyReference[
@name = 'TypeVoc'
])
and not(z:vocabularyReference[
@name = 'GeopolVoc'
]/z:vocabularyReferenceItem[
@name = $herstellendeKollektive
])
]"/>


Expand All @@ -105,11 +114,13 @@
or not (z:vocabularyReference[@name = 'TypeVoc'])
]"/>

<!-- Write event-Herstellung if any of the following -->
<xsl:if test="$herstellendeRollenN
or $herstellendeKollektiveN
or $herstellendeOrteNN
or $herstellendeDatenTypenN
or z:repeatableGroup[@name = 'ObjMaterialTechniqueGrp']
or z:repeatableGroup[@name = 'ObjCulturalContextGrp']
">
<lido:eventSet>
<lido:displayEvent xml:lang="de">Herstellung</lido:displayEvent>
Expand All @@ -124,9 +135,17 @@

<!-- Ethnien und andere Kollektive aus GeoBezug-->
<xsl:apply-templates mode="eventActor" select="$herstellendeKollektiveN"/>
<!-- lido:culture-->
<xsl:apply-templates select="z:repeatableGroup[@name = 'ObjCulturalContextGrp']"/>

<!-- lido:culture
Do we only want that ObjCulturalContextGrp if Ortstyp = Herstellung
-->
<xsl:apply-templates select="z:repeatableGroup[@name = 'ObjCulturalContextGrp']"/>
<xsl:apply-templates mode="culture" select="$herstellendeKollektiveN"/>
<!--xsl:message>
<xsl:text>herstellendeKollektiveN</xsl:text>
<xsl:value-of select="$herstellendeKollektiveN"/>
</xsl:message-->

<!-- eventDate
SPEC allows repeated displayDates only for language variants;
according to spec event dates cannot be repeated.
Expand Down Expand Up @@ -205,8 +224,9 @@
</xsl:template>


<!-- create lido:culture from mpx:Kul.Bezug-->
<xsl:template match="z:repeatableGroup[@name = 'ObjCulturalContextGrp']">
<xsl:message>yyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy</xsl:message>
<!--xsl:message>yyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyyyy yyyyyyyyyyyyyyyyyy</xsl:message-->
<xsl:for-each select="z:repeatableGroupItem">
<lido:culture>
<lido:conceptID lido:type="local" lido:source="ObjCulturalContextGrp">
Expand All @@ -233,6 +253,33 @@
</xsl:template>


<!-- create lido:culture from old-fashioned herstellendenKollektiven in mpx:geogr.Bezug-->
<xsl:template mode="culture" match="z:repeatableGroup[
@name = 'ObjGeograficGrp']/
z:repeatableGroupItem">
<!--xsl:message>xxxxxxxxxxxxxxxxxxxxxxxxxxx mode=culture for herstellendesKollektiv</xsl:message-->
<lido:culture>
<lido:conceptID lido:type="local" lido:source="ObjGeograficGrp">
<xsl:value-of select="z:vocabularyReference[
@name = 'PlaceVoc'
]/z:vocabularyReferenceItem/@id"/>
</lido:conceptID>
<lido:term>
<xsl:if test="z:vocabularyReference[
@name = 'PlaceVoc'
]/z:vocabularyReferenceItem/z:formattedValue/@language ne ''">
<xsl:attribute name="xml:lang">
<xsl:value-of select="z:vocabularyReference[
@name = 'PlaceVoc'
]/z:vocabularyReferenceItem/z:formattedValue/@language"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="z:vocabularyReference[
@name = 'PlaceVoc'
]/z:vocabularyReferenceItem/z:formattedValue"/>
</lido:term>
</lido:culture>
</xsl:template>

<!--
m3: Kultur auf Actor gemappt entsprechend Vorschlag FvH;
Expand Down
10 changes: 5 additions & 5 deletions zml2lido/lidoTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ def _lvl2_path(self, p: str | Path) -> Path:
p = Path(p)
suffixes = "".join(p.suffixes)
stem = str(p.name).split(".")[0] # splits off multiple suffixes
new_dir = p.parent / "lvl2"
new_dir.mkdir(exist_ok=True)
new_p = new_dir.joinpath(stem + "-2" + suffixes)
new_dir = p.parent # / "lvl2"
# new_dir.mkdir(exist_ok=True)
new_p = new_dir.joinpath(stem + "-lvl2" + suffixes)
return new_p

def _prepareOutdir(self) -> Path:
Expand All @@ -398,16 +398,16 @@ def _prepareOutdir(self) -> Path:
if re.match(r"\d\d\d\d\d\d", self.src.parent.name):
outdir = sdataP / self.src.parents[1].name / self.src.parent.name
elif self.src.parent.name == "sdata":
print("_outdir:Case2")
# print("_outdir:Case2")
outdir = sdataP
# raise SyntaxError(
# """ERROR: Don't use an src file inside of sdata.
# Use a subdirectory instead!"""
# )
else:
# should write in sdata/ccc for example, which may be pwd
print(f"_outdir:Case3 {self.src.parent.resolve().name}")
outdir = sdataP / self.src.parent.resolve().name
print(f"Case3: {outdir=}")

if not outdir.exists():
print(f"Making new dir {outdir}")
Expand Down

0 comments on commit 1416422

Please sign in to comment.