source: mauRepo/ISO19136-AnxE/test-005.xq @ 8191

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/ISO19136-AnxE/test-005.xq@8406
Revision 8191, 2.0 KB checked in by mnagni, 8 years ago (diff)

#{ROOT_URL}ISO19136-AnxE parametrized the import URLs

Line 
1xquery version "1.0";
2(:~~~~~~~~~~~~~~~~~~~~~~~~~~ Conformance Test  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3Test Number:    005
4Description:    Asserts the existence of "xsdDocument" tagged value on
5                                Application Schema and Leaf packages within the model.
6Reference:             
7~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:)
8
9import module namespace mod-fr = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:framework"
10at "#{ROOT_URL}ISO19136-AnxE/modules/module-framework-functions.xq";
11
12import module namespace mod-xp = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:xmi-proc"
13at "#{ROOT_URL}ISO19136-AnxE/modules/module-xproc-functions.xq";
14
15declare namespace UML   = "omg.org/UML1.3";
16declare namespace cr    = "http://ndg.service.newmoon.conftest-result/1.0";
17
18(: Declare local variables, particular to this test :)
19declare variable $test-num as xs:integer := 5;
20declare variable $pass-msg as xs:string := "The model does have "xsdDocument" tagged-value for every package.";
21declare variable $fail-msg as xs:string := "The model is not serialized properly because:";
22
23(:
24        #Date:          2008-11-28
25        #Author:        Pavel Golodoniuc
26
27        Declare the local assert function which defines a postive condition for pass.
28:)
29declare function local:assert($doc-root as node()?) as node()?
30{
31        let
32                $fail := (
33                        for $pkg in $doc-root//UML:Package
34                        let $xsd-doc := $doc-root/XMI/XMI.content/UML:TaggedValue[@tag eq "xsdDocument" and ends-with(@modelElement, replace($pkg/@xmi.id, "^(.*)(.{36})$", "$2"))]/@value
35                        where empty($xsd-doc)
36                        return  <cr:message>{ concat("The ", $pkg/UML:ModelElement.taggedValue/UML:TaggedValue[@tag eq "stereotype"]/@value, " package &quot;", $pkg/@name, "&quot; does NOT have any &quot;xsdDocument&quot; tagged-value.") }</cr:message>
37                )
38        return
39                if (empty($fail)) then ()
40                else
41                        <cr:fail>
42                                <cr:messages>{ $fail }</cr:messages>
43                        </cr:fail>
44};
45
46(: Create a new result element :)
47mod-fr:new-result($test-num, $pass-msg, $fail-msg, local:assert(/))
Note: See TracBrowser for help on using the repository browser.