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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/ISO19136-AnxE/test-008.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:    008
4Description:    Asserts unique values for all the EAStub names within the model.
5Reference:             
6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:)
7
8import module namespace mod-fr = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:framework"
9at "#{ROOT_URL}ISO19136-AnxE/modules/module-framework-functions.xq";
10
11import module namespace mod-xp = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:xmi-proc"
12at "#{ROOT_URL}ISO19136-AnxE/modules/module-xproc-functions.xq";
13
14declare namespace UML   = "omg.org/UML1.3";
15declare namespace cr    = "http://ndg.service.newmoon.conftest-result/1.0";
16
17(: Declare local variables, particular to this test :)
18declare variable $test-num as xs:integer := 8;
19declare variable $pass-msg as xs:string := "Each external dependency class or package does have a unique name.";
20declare variable $fail-msg as xs:string := "The Model is not serialized properly because:";
21
22(: Declare the local assert function which defines a postive condition for pass :)
23declare function local:assert($doc-root as node()?) as node()?
24{
25        let $fail := (
26                for $type in distinct-values($doc-root/XMI/XMI.extensions/EAStub/@UMLType)
27                        for $dup in mod-xp:get-duplicates($doc-root/XMI/XMI.extensions/EAStub[@UMLType eq $type]/@name)
28                        return
29                                if ($dup eq "") then
30                                        <cr:message>{ concat("External dependency of UMLType=&quot;", $type, "&quot; with the name NULL (i.e. &quot;&quot;) has the same name as another dependency.") }</cr:message>
31                                else
32                                        <cr:message>{ concat("External dependency of UMLType=&quot;", $type, "&quot; with the name &quot;", $dup, "&quot; has the same name as another dependency.") }</cr:message>
33        )
34        return
35                if (empty($fail)) then ()
36                else
37                        <cr:fail>
38                                <cr:messages>{ $fail }</cr:messages>
39                        </cr:fail>
40};
41
42(: Create a new result element :)
43mod-fr:new-result($test-num, $pass-msg, $fail-msg, local:assert(/))
Note: See TracBrowser for help on using the repository browser.