Commit 9ae79562 authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

specific index lists

parent 4871b92c
......@@ -305,7 +305,11 @@ let $store :=
if(doc-available($gndCollection || $filename))
then $gndCollection || $filename
else
xmldb:store($gndCollection, $filename, $response)
try {
xmldb:store($gndCollection, $filename, $response)
} catch * {
()
}
else ()
return
string($response//foaf:page/@rdf:resource)
......@@ -729,6 +733,39 @@ else
</xhtml:div>
};
(:~
: parser for listEvents/event entities
: @param $eventDoc – the tei:listEvent containing all entries
: :)
declare function ixp:events($eventDoc as element(tei:listEvent), $filter as xs:string+)
as element(xhtml:div) {
<xhtml:div id="{ string-join(($eventDoc/local-name(), $eventDoc/@type), "-") }" class="tab-pane">
<xhtml:div class="panel-group" aria-multiselectable="true" role="tablist">
{for $eventList in $eventDoc/tei:listEvent
return
<xhtml:div class="panel panel-default">
<xhtml:div class="panel-heading">
<h4 class="panel-title">{$eventList/tei:head/text()}</h4>
</xhtml:div>
<xhtml:div class="panel-body">
<ul class="listEvent">
{
for $event in $eventList/tei:event[@xml:id = $filter]
let $sort := string($event/*[1])
=> replace("ä", "ae")
=> replace("ö", "oe")
=> replace("ü", "ue")
order by $sort
return ixp:prepare-event($event)
}
</ul>
</xhtml:div>
</xhtml:div>
}
</xhtml:div>
</xhtml:div>
};
declare function ixp:prepare-event($event as element(tei:event))
as element(xhtml:li) {
(: check if the item points to another entity :)
......@@ -826,6 +863,38 @@ return
$result
};
(:~
: parser for tei:listOrg, returns the index of orgnaisations.
: :)
declare function ixp:orgs($orgDoc as element(tei:listOrg)+, $filter as xs:string+) {
<xhtml:div id="{ string-join(($orgDoc/local-name(), $orgDoc/@type), "-") }" class="tab-pane">
<xhtml:div class="panel-group" aria-multiselectable="true" role="tablist">
{for $orgList in $orgDoc
return
<xhtml:div class="panel panel-default">
<xhtml:div class="panel-heading">
<h4 class="panel-title">{ $orgList/tei:head/text() }</h4>
</xhtml:div>
<xhtml:div class="panel-body">
<ul class="listOrg">
{
for $org in $orgList/tei:org[@xml:id = $filter]
let $sort := string($org/*[1])
=> replace("ä", "ae")
=> replace("ö", "oe")
=> replace("ü", "ue")
order by $sort
return ixp:prepare-org($org)
}
</ul>
</xhtml:div>
</xhtml:div>
}
</xhtml:div>
</xhtml:div>
};
(:~
: transforms a single tei:org element to a xhtml:li
: @since 1.0
......@@ -915,6 +984,43 @@ else
</xhtml:div>
};
(:~
: parser for tei:listPerson, returns the index of persons
: :)
declare function ixp:persons($persDoc as element(tei:listPerson), $filter as xs:string+)
as element(xhtml:div) {
(: main tab :)
<xhtml:div id="{ string-join(($persDoc/local-name(), $persDoc/@type), "-") }" class="tab-pane">
<xhtml:div class="panel-group" aria-multiselectable="true" role="tablist">
{for $persList in $persDoc
return
<xhtml:div class="panel panel-default">
<xhtml:div class="panel-heading">
<h4 class="panel-title"><a href="#collapse1-1" data-parent="#accordion" data-toggle="collapse">Personen und Werke</a>
</h4>
</xhtml:div>
<xhtml:div class="panel-body">
<ul class="listPerson">
{
for $pers in $persList/tei:*[@xml:id = $filter]
let $sort := string($pers/*[1])
=> replace("ä", "ae")
=> replace("ö", "oe")
=> replace("ü", "ue")
order by $sort
return ixp:prepare-person($pers)
}
</ul>
</xhtml:div>
</xhtml:div>
}
</xhtml:div>
</xhtml:div>
};
declare function ixp:prepare-person($pers as element(*)+)
as element(xhtml:li) {
(: check if the item points to another entity :)
......@@ -1064,6 +1170,36 @@ else
</xhtml:div>
};
(:~
: prepares the index of geographical references
: :)
declare function ixp:places($listPlace as element(tei:listPlace), $filter as xs:string+)
as element(xhtml:div) {
<xhtml:div id="{ string-join(($listPlace/local-name(), $listPlace/@type), "-") }" class="tab-pane">
<xhtml:div class="panel-group" aria-multiselectable="true" role="tablist">
<xhtml:div class="panel panel-default">
<xhtml:div class="panel-heading">
<h4 class="panel-title"><a href="#collapse1-1" data-parent="#accordion" data-toggle="collapse">Geographisches Register</a>
</h4>
</xhtml:div>
<xhtml:div class="panel-body">
<ul class="listPlace">
{
for $place in $listPlace/tei:place[@xml:id = $filter]
let $sort := string($place/*[1])
=> replace("ä", "ae")
=> replace("ö", "oe")
=> replace("ü", "ue")
order by $sort
return ixp:prepare-place($place)
}
</ul>
</xhtml:div>
</xhtml:div>
</xhtml:div>
</xhtml:div>
};
(:~
: transformation of a single geographical reference item :)
declare function ixp:prepare-place($place as element(tei:place))
......@@ -1201,6 +1337,38 @@ return ixp:prepare-work($i)
</xhtml:div>
};
(:~
: prepares the list of works :)
declare function ixp:works($wrkDoc as element(tei:list), $filter as xs:string+)
as element(xhtml:div) {
<xhtml:div id="{ string-join(($wrkDoc/local-name(), $wrkDoc/@type), "-") }" class="tab-pane">
<xhtml:div class="panel-group" aria-multiselectable="true" role="tablist">
{for $wrkList in $wrkDoc
return
<xhtml:div class="panel panel-default">
<xhtml:div class="panel-heading">
<h4 class="panel-title"><a href="#collapse1-1" data-parent="#accordion" data-toggle="collapse">{$wrkList/tei:head/text()}</a>
</h4>
</xhtml:div>
<xhtml:div class="panel-body">
<ul class="workList">
{
for $i in $wrkList//tei:item[not(tei:list)][@xml:id = $filter]
order by (lower-case(($i/tei:name[not(@type)]/text())[1])
=> replace("ä", "ae")
=> replace("ö", "oe")
=> replace("ü", "ue") )
return ixp:prepare-work($i)
}
</ul>
</xhtml:div>
</xhtml:div>
}
</xhtml:div>
</xhtml:div>
};
(:~
: prepares a single work item :)
declare function ixp:prepare-work($work as element(tei:item))
......
......@@ -235,3 +235,60 @@ declare function ixv:item($node, $map, $e as xs:string?, $nb as xs:string?) {
index:rendered-entity($e)
else ()
};
declare function ixv:items($node, $map, $nb as xs:string, $index as xs:string) {
let $sourceDoc := doc("/db/sade-projects/textgrid/data/xml/data/" || $nb || ".xml")/tei:TEI/tei:sourceDoc
return
switch ($index)
case "listPerson"
return
let $prefix := "psn:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $persDoc := doc("/db/sade-projects/textgrid/data/xml/data/253sx.xml")//tei:body/tei:listPerson
return
ixp:persons( $persDoc, $list)
case "listPlace" return
let $prefix := "plc:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $placeDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t2.xml")//tei:body/tei:listPlace
return
ixp:places( $placeDoc, $list )
case "listOrg" return
let $prefix := "org:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $orgDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t1.xml")//tei:body/tei:listOrg
return
ixp:orgs( $orgDoc, $list )
case "listEvent" return
let $prefix := "eve:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $eventDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t0.xml")//tei:body/tei:listEvent
return
ixp:events( $eventDoc, $list )
case "list-works" return
let $prefix := "wrk:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $itemDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t3.xml")//tei:list[@type="works"]
return
ixp:works( $itemDoc, $list )
case "list-Fontane" return
let $prefix := "wrk:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $itemDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t3.xml")//tei:list[@type="Fontane"]
return
ixp:works( $itemDoc, $list )
case "list-periodicals" return
let $prefix := "wrk:"
let $references := ($sourceDoc//tei:rs[contains(@ref, $prefix)]/string(@ref) ! tokenize(., " "))[starts-with(., $prefix)]
let $list := $references ! substring-after(., $prefix)
let $itemDoc := doc("/db/sade-projects/textgrid/data/xml/data/253t3.xml")//tei:list[@type="periodicals"]
return
ixp:works( $itemDoc, $list )
default return ()
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment