source: mauRepo/ISO19136-AnxE/test-022.xq @ 8190

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

Share project "ISO19136-AnxE" into " http://proj.badc.rl.ac.uk/svn/ndg/mauRepo"

Line 
1xquery version "1.0";
2(:~~~~~~~~~~~~~~~~~~~~~~~~~~ Conformance Test  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3Test Number:    022
4Description:    Asserts each navigable association-end must have a role-name.
5                                (in order to be encoded)
6Reference:             
7~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:)
8
9import module namespace mod-fr = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:framework"
10at "http://jenkins.badc.rl.ac.uk/xqueries/ISO19136-V3.2-AnxE_XMI-V1.1/modules/module-framework-functions.xq";
11
12import module namespace mod-xp = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:xmi-proc"
13at "http://jenkins.badc.rl.ac.uk/xqueries/ISO19136-V3.2-AnxE_XMI-V1.1/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 := 22;
20declare variable $pass-msg as xs:string := "All navigable association-ends do have a role-name.";
21declare variable $fail-msg as xs:string := "WARNING: This will not be encoded because:";
22
23(:
24        #Date:          2009-01-08
25        #Author:        Krupali Patel
26
27        Declare the local assert function which defines a postive condition for pass.
28
29        #Date:          2009-01-16
30        #Update:        Krupali Patel
31:)
32declare function local:assert($doc-root as node()?) as node()?
33{
34        let
35                $fail := (
36                        for $asso-end in $doc-root//UML:AssociationEnd[@isNavigable eq "true" and (empty(@name) or @name eq "")]
37                        let
38                                $class-name1 := mod-xp:get-class-name-by-type($doc-root, $asso-end/@type)/@name,
39                                $class-name2 := mod-xp:get-class-name-by-type($doc-root, ($asso-end/preceding-sibling::UML:AssociationEnd | $asso-end/following-sibling::UML:AssociationEnd)/@type)/@name
40                        return  <cr:message>{ concat("Navigable end of the association from class &quot;", $class-name1, "&quot; to class &quot;", $class-name2, "&quot; does not have a role-name.") }</cr:message>
41                )
42        return
43                if (empty($fail)) then ()
44                else
45                        <cr:fail>
46                                <cr:messages>{ $fail }</cr:messages>
47                        </cr:fail>     
48};
49
50(: Create a new result element :)
51mod-fr:new-result($test-num, $pass-msg, $fail-msg, local:assert(/))
Note: See TracBrowser for help on using the repository browser.