diff --git a/modules/intermediate_format/identification.xqm b/modules/intermediate_format/identification.xqm index 2ec5afe6446822b6f0c416503988530b96f66d72..7bf2819a1c32afd2bab69486c8a25cd20d129f76 100644 --- a/modules/intermediate_format/identification.xqm +++ b/modules/intermediate_format/identification.xqm @@ -303,7 +303,7 @@ declare function ident:identify-targets : @param $reading-sequence sequence holding the evaluation reports of the relevant readings in the nodes' context : @return converted node : - : @version 2.0 (2018-02-01) + : @version 2.1 (2018-02-20) : @status working : @author Uwe Sikora :) @@ -321,8 +321,10 @@ declare function ident:walk ) ) case element(teiHeader) return ( $node ) + + (: considering all tei:rdg except structural-variances and textcritical tei:rdg[@type="v"]:) case element(rdg) return ( - if ( not($node/parent::app[ @type eq "structural-variance" ]) ) then ( + if ( not($node/parent::app[ @type eq "structural-variance" ] or $node[@type="v"]) ) then ( let $identified-targets := ident:identify-targets($node) return ident:mark-node( $node, ($reading-sequence, ident:identify-targets($node)) ) ) else ( @@ -330,6 +332,7 @@ declare function ident:walk ) ) + (: considering all tei:lem except structural-variances :) case element(lem) return ( if ( not($node/parent::app[ @type eq "structural-variance" ]) ) then ( let $identified-targets := ident:identify-targets($node) diff --git a/modules/intermediate_format/markerset.xqm b/modules/intermediate_format/markerset.xqm index bec33898ef8891337c33f4ffca29571b3087499e..ca0e14f1774ace758b6928b48a0782dcf8b0c86a 100644 --- a/modules/intermediate_format/markerset.xqm +++ b/modules/intermediate_format/markerset.xqm @@ -41,10 +41,21 @@ declare function markerset:collect-markers ) ) else if ($reading[self::rdg]) then ( - element {name($reading)} { - $reading/@*, - attribute {"context"}{"rdg"} - } + if ($reading[@type = "ppl" or @type = "pp"][descendant::lem[@wit]]) then ( + let $children-readings := $reading/descendant::rdg + return( + element {name($reading)} { + $reading/@*, + attribute {"context"}{"changed-lem ", data($children-readings/@wit)} + } + ) + ) + else ( + element {name($reading)} { + $reading/@*, + attribute {"context"}{"rdg"} + } + ) ) else () ) @@ -105,16 +116,14 @@ declare function markerset:merge-markers :) declare function markerset:marker ($name as xs:string, $type as xs:string, $reading as node()) as element(){ - if($type = 'open' and data($reading/@type) = 'v' and $reading/@context = 'rdg') - then () - else (element {$name} { + element {$name} { (:attribute bdnp_parent {$node/parent::node()/name()}, :) attribute wit { replace(data($reading/@wit), '#', '') }, attribute type { data($reading/@type) }, attribute ref { data($reading/@id) }, attribute mark { $type }, attribute context { $reading/@context } - }) + } }; diff --git a/rest/test/interform.test.xql b/rest/test/interform.test.xql new file mode 100644 index 0000000000000000000000000000000000000000..3849ac3bb17a33ec0396fe3466698da883e8dc00 --- /dev/null +++ b/rest/test/interform.test.xql @@ -0,0 +1,18 @@ +xquery version "3.1"; + +declare namespace tei = "http://www.tei-c.org/ns/1.0"; +import module namespace functx="http://www.functx.com"; +import module namespace pre="http://bdn.edition.de/intermediate_format/preprocessing" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/preprocessing.xqm"; +import module namespace ident = "http://bdn.edition.de/intermediate_format/identification" at "xmldb:exist:///db/apps/interformat/modules/intermediate_format/identification.xqm"; + + +declare option exist:serialize "method=xml media-type=text/xml omit-xml-declaration=no indent=no"; + +(: http://localhost:8080/exist/rest/apps/interformat/rest/intermediate_format.xql :) +(:declare variable $doc-path := request:get-parameter("path", ()); :) +declare variable $doc-path := "/apps/interformat/data/samples/samples4.xml"; +let $doc := doc($doc-path) +let $preprocessed-data := pre:preprocessing($doc/tei:TEI) +return ( + ident:walk($preprocessed-data, ()) +) \ No newline at end of file