Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
intermediate-format
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bibliothek-der-neologie
intermediate-format
Commits
5b92c4e6
Commit
5b92c4e6
authored
7 years ago
by
uwe
Browse files
Options
Downloads
Patches
Plain Diff
started unittesting and added unittesting module
parent
bb074e88
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
oxygen/devel/modules/unittesting.xqm
+100
-0
100 additions, 0 deletions
oxygen/devel/modules/unittesting.xqm
oxygen/intermediate_format.oxygen.devel.xqm
+7
-53
7 additions, 53 deletions
oxygen/intermediate_format.oxygen.devel.xqm
with
107 additions
and
53 deletions
oxygen/devel/modules/unittesting.xqm
0 → 100644
+
100
−
0
View file @
5b92c4e6
xquery
version
"3.0"
;
(:~
: UNIT TESTING Module ("test", "http://bdn.edition.de/intermediate_format/unit_testing")
: *******************************************************************************************
: This module defines functions to test different functions from the Intermediate Format conversion
:
: It includes the main module "ident"
:
: @version 1.0 (2018-02-05)
: @status development
: @author Uwe Sikora
:)
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"
;
(:############################# Modules Functions #############################:)
(:~
: test:branch-axis()
: This function evaluates the left- and right-branch AXIS
:
: @param $node the nodes to evaluate the left- and right-branch AXIS for
: @return evaluation-report as item()
:
: @version 1.0 (2018-02-05)
: @status development (working)
: @author Uwe Sikora
:)
declare
function
test:branch-axis
(
$node
as
node
()
)
as
item
()
{
let
$left-axis
:=
ident:left-branch-axis
(
$node
)
let
$right-axis
:=
ident:right-branch-axis
(
$node
)
return
element
{
"axisTest"
}{
element
{
"targetNode"
}{
$node
}
,
element
{
"axis"
}{
element
{
"leftAxis"
}{
attribute
{
"names"
}{
$left-axis
/
name
()}
,
for
$item
at
$nr
in
$left-axis
return
element
{
"item"
}{
attribute
{
"n"
}{
$nr
}
,
attribute
{
"gid"
}{
generate-id
(
$item
)}
,
$item
}
}
,
element
{
"rightAxis"
}{
attribute
{
"names"
}{
$right-axis
/
name
()}
,
for
$item
at
$nr
in
$right-axis
return
element
{
"item"
}{
attribute
{
"n"
}{
$nr
}
,
attribute
{
"gid"
}{
generate-id
(
$item
)}
,
$item
}
}
}
}
};
(:~
: test:reading-evaluation()
: This function evaluates tei:lem and tei:app elements. It identifies the save first
: and last node and collects readingMarkers
:
: @param $reading the reading to be tested
: @return evaluation-report as item()
:
: @version 1.0 (2018-02-05)
: @status development (working)
: @author Uwe Sikora
:)
declare
function
test:reading-evaluation
(
$readings
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
)
return
element
{
$reading
/
name
()}{
$reading
/
@
*,
attribute
{
"index"
}
{
$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
}
}
};
\ No newline at end of file
This diff is collapsed.
Click to expand it.
oxygen/intermediate_format.oxygen.devel.xqm
+
7
−
53
View file @
5b92c4e6
...
...
@@ -7,7 +7,7 @@ import module namespace functx = "http://www.functx.com" at "functx.xqm";
import
module
namespace
markerset
=
"http://bdn.edition.de/intermediate_format/markerset"
at
"../modules/intermediate_format/markerset.xqm"
;
import
module
namespace
pre
=
"http://bdn.edition.de/intermediate_format/preprocessing"
at
"../modules/intermediate_format/preprocessing.xqm"
;
import
module
namespace
ident
=
"http://bdn.edition.de/intermediate_format/identification"
at
"../modules/intermediate_format/identification.xqm"
;
import
module
namespace
test
=
"http://bdn.edition.de/intermediate_format/unit_testing"
at
"devel/modules/unittesting.xqm"
;
(:declare namespace target = "http://www.interform.com/target_index";
import module "http://www.interform.com/target_index" at "targetindex.xqm";
:)
...
...
@@ -17,18 +17,6 @@ declare namespace tei = "http://www.tei-c.org/ns/1.0";
(:declare option saxon:output "indent=no";:)
declare
variable
$apparatus
:=
(
'app'
);
declare
variable
$apparatus-childs
:=
(
'lem'
,
'rdg'
);
declare
variable
$blocklevel-elements
:=
(
'titlePage'
,
'titlePart'
,
'aligned'
,
'div'
,
'list'
,
'item'
,
'table'
,
'row'
,
'cell'
,
'head'
,
'p'
,
'note'
);
declare
function
local:in-sequence
(
$values
as
xs:anyAtomicType
*
,
$sequence
as
xs:anyAtomicType
*
)
as
xs:boolean
{
$values
=
$sequence
};
declare
function
local:app-index
(
$apps
as
node
()
*
)
as
item
()
*
{
...
...
@@ -153,8 +141,8 @@ declare function local:check-reading
declare
function
local:is-save-first-node
(
$node
as
node
())
as
xs:boolean
{
let
$first-descendants
:=
local:first-descendants
(
$node
)
let
$has-save-first-descendants
:=
not
(
local
:in-sequence
(
$first-descendants
/
name
()
,
$blocklevel-elements
)
)
let
$self-ble
:=
functx:is-value-in-sequence
(
$node
/
name
()
,
$blocklevel-elements
)
let
$has-save-first-descendants
:=
not
(
ident
:in-sequence
(
$first-descendants
/
name
()
,
$
ident:
blocklevel-elements
)
)
let
$self-ble
:=
functx:is-value-in-sequence
(
$node
/
name
()
,
$
ident:
blocklevel-elements
)
return
if
(
$has-save-first-descendants
and
not
(
$self-ble
))
then
(
true
())
else
(
false
())
};
...
...
@@ -162,46 +150,12 @@ declare function local:is-save-first-node
declare
function
local:is-save-last-node
(
$node
as
node
())
as
xs:boolean
{
let
$last-descendants
:=
local:last-descendants
(
$node
)
let
$has-save-last-descendants
:=
not
(
local
:in-sequence
(
$last-descendants
/
name
()
,
$blocklevel-elements
)
)
let
$self-ble
:=
functx:is-value-in-sequence
(
$node
/
name
()
,
$blocklevel-elements
)
let
$has-save-last-descendants
:=
not
(
ident
:in-sequence
(
$last-descendants
/
name
()
,
$
ident:
blocklevel-elements
)
)
let
$self-ble
:=
functx:is-value-in-sequence
(
$node
/
name
()
,
$
ident:
blocklevel-elements
)
return
if
(
$has-save-last-descendants
and
not
(
$self-ble
))
then
(
true
())
else
(
false
())
};
declare
function
local:axis-test
(
$node
as
node
()
)
as
item
()
{
let
$left-axis
:=
ident:left-branch-axis
(
$node
)
let
$right-axis
:=
ident:right-branch-axis
(
$node
)
return
element
{
"axisTest"
}{
element
{
"node"
}{
$node
}
,
(:element {"test"}{
attribute {"index"}{fn:index-of($left-axis, $left-axis[4])},
fn:index-of($left-axis, $left-axis[ ident:is-or-are-ble(self::node()/name()) ][last()])
},:)
element
{
"leftAxis"
}{
attribute
{
"names"
}{
$left-axis
/
name
()}
,
for
$item
at
$nr
in
$left-axis
return
element
{
"item"
}{
attribute
{
"n"
}{
$nr
}
,
attribute
{
"gid"
}{
generate-id
(
$item
)}
,
$item
}
}
,
element
{
"rightAxis"
}{
attribute
{
"names"
}{
$right-axis
/
name
()}
,
for
$item
at
$nr
in
$right-axis
return
element
{
"item"
}{
attribute
{
"n"
}{
$nr
}
,
attribute
{
"gid"
}{
generate-id
(
$item
)}
,
$item
}
}
}
};
let
$doc
:=
.
let
$pre
:=
pre:preprocessing
(
$doc
/
node
())
...
...
@@ -230,10 +184,10 @@ let $test := <test>
</test>
return
(
(:ident:left-nodes-path($test),:)
(:local:axis-test
($test)
:)
test:branch-axis
(
$test
)
(:ident:identify-unit-test($pre):)
(:$pre:)
ident:walk
(
$pre
,
())
(:
ident:walk($pre, ())
:)
(: $target-index:)
(:local:target-in-index("d0t36", $app-index),:)
(:target:conversion-by-target-index($pre, $target-index):)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment