diff --git a/modules/intermediate_format/identification.xqm b/modules/intermediate_format/identification.xqm index b9d6fa8aa9f6d3420983f3a59bbead766ddda49d..a2be20b1c14d482633eb393cca85633dd245cd70 100644 --- a/modules/intermediate_format/identification.xqm +++ b/modules/intermediate_format/identification.xqm @@ -446,31 +446,4 @@ declare function ident:fetch-marker-from-sequence where $found return $markers -}; - - - -(:~ - : ident:identify-unit-test() - : Some kind of test-unit-function to eval the main identification functionality of this module on all tei:lem and tei:readings of a given xml-tree - : - : @param $nodes xml-tree to be tested - : @return test report for each tei:lem and tei:reading as node()* - : - : @version 2.0 (2018-02-01) - : @status working - : @note meant to test the identification algorithm - : @author Uwe Sikora - :) -declare function ident:identify-unit-test - ( $nodes as node()* ) as node()* { - - for $node at $nr in $nodes//node()[self::lem or self::rdg] - let $identified-targets := ident:identify-targets($node) - return - element{"UTEST"}{ - attribute {"n"}{$nr}, - element {"SELF"} {$node}, - $identified-targets - } }; \ No newline at end of file diff --git a/oxygen/devel/modules/unittesting.xqm b/oxygen/devel/modules/unittesting.xqm index 8b06fdfd9822d84387c0d4a201e19e6445034a0e..6e13bf6d1fc94d63dbd3ab3cbcc276beba6e5443 100644 --- a/oxygen/devel/modules/unittesting.xqm +++ b/oxygen/devel/modules/unittesting.xqm @@ -14,6 +14,8 @@ module namespace test="http://bdn.edition.de/intermediate_format/unit_testing"; import module namespace ident = "http://bdn.edition.de/intermediate_format/identification" at "../../../modules/intermediate_format/identification.xqm"; +declare namespace tei = "http://www.tei-c.org/ns/1.0"; + (:############################# Modules Functions #############################:) (:~ @@ -73,28 +75,54 @@ declare function test:branch-axis : @author Uwe Sikora :) declare function test:reading-evaluation - ( $readings as node()* ) as item()* { + ( $nodes as node()* ) as item()* { - for $reading at $nr in $readings - let $first-save-node := ident:first-save-node($reading) - let $last-save-node := ident:last-save-node($reading) + for $reading at $nr in $nodes//node()[self::tei:lem or self::tei:rdg] + let $first-save-target := ident:first-save-node($reading) + let $last-save-target := ident:last-save-node($reading) return element {$reading/name()}{ $reading/@*, - attribute {"index"} { $nr }, + attribute {"nr"} { $nr }, element {"self"}{ attribute {"gid"}{ generate-id($reading) }, $reading }, - element {"target"}{ - attribute {"type"}{ "open" }, - attribute {"gid"}{ generate-id($first-save-node) }, - $first-save-node - }, - element {"target"}{ - attribute {"type"}{ "close" }, - attribute {"gid"}{ generate-id($last-save-node) }, - $last-save-node + element {"evaluation"}{ + element {"first"}{ + attribute {"gid"}{ generate-id($first-save-target) }, + $first-save-target + }, + element {"last"}{ + attribute {"gid"}{ generate-id($last-save-target) }, + $last-save-target + } } } +}; + + +(:~ + : test:identify-target() + : unit-test-function to eval the main identification functionality of the ident module on all tei:lem and tei:readings of a given xml-tree + : + : @param $nodes xml-tree to be tested + : @return test report for each tei:lem and tei:reading as node()* + : + : @version 2.1 (2018-02-05) + : @status working + : @note meant to test the identification algorithm + : @author Uwe Sikora + :) +declare function test:identify-target + ( $nodes as node()* ) as node()* { + + for $node at $nr in $nodes//node()[self::tei:lem or self::tei:rdg] + let $identified-targets := ident:identify-targets($node) + return + element{"UTEST"}{ + attribute {"n"}{$nr}, + element {"SELF"} {$node}, + $identified-targets + } }; \ No newline at end of file