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

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

#{ROOT_URL}ISO19136-AnxE parametrized the import URLs

RevLine 
[8190]1xquery version "1.0";
2(:~~~~~~~~~~~~~~~~~~~~~~~~~~ Conformance Test  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3Test Number:    019
4Description:    Asserts that there is no more than one tagged value with the
5                                same tag on each element.
6Reference:             
7~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~:)
8
9import module namespace mod-fr = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:framework"
[8191]10at "#{ROOT_URL}ISO19136-AnxE/modules/module-framework-functions.xq";
[8190]11
12import module namespace mod-xp = "urn:local-module:ISO19136-V3.2-AnxE_XMI-V1.1:xmi-proc"
[8191]13at "#{ROOT_URL}ISO19136-AnxE/modules/module-xproc-functions.xq";
[8190]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 := 19;
20declare variable $pass-msg as xs:string := "There is no more than one tagged value with the same tag on each element.";
21declare variable $fail-msg as xs:string := "The following element has more than one tagged value with the same tag:";
22
23(:
24        #Date:          2008-12-03
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                        (: Check linked tags :)
34                        for $tag in $doc-root/XMI/XMI.content/UML:TaggedValue[@tag = ("documentation", "targetNamespace", "xmlns", "xsdDocument", "version", "asDictionary", "codeSpace", "dictionaryIdentifier", "memberIdentifierStem", "noPropertyType", "byValuePropertyType", "inlineOrByReference", "sequenceNumber", "isMetadata", "isCollection", "ownedBy", "gmlProfileSchema", "xmlSchemaType")]
35                        let $descendent := $doc-root//*[@xmi.id eq $tag/@modelElement]/UML:ModelElement.taggedValue/UML:TaggedValue[@tag eq $tag/@tag]
36                        where exists($descendent) or exists($tag/following-sibling::*[name(.) eq "UML:TaggedValue" and @tag eq $tag/@tag and @modelElement eq $tag/@modelElement])
37                        return <cr:message>{ concat("Tagged value &quot;", $tag/@tag, "&quot; ", mod-xp:get-tag-owner-verbal($doc-root, $tag), " is duplicated.") }</cr:message>,
38
39                        (: Check descendent tags only :)
40                        for $tag in $doc-root//UML:ModelElement.taggedValue/UML:TaggedValue[@tag = ("documentation", "targetNamespace", "xmlns", "xsdDocument", "version", "asDictionary", "codeSpace", "dictionaryIdentifier", "memberIdentifierStem", "noPropertyType", "byValuePropertyType", "inlineOrByReference", "sequenceNumber", "isMetadata", "isCollection", "ownedBy", "gmlProfileSchema", "xmlSchemaType")]
41                        where exists($tag/following-sibling::*[@tag eq $tag/@tag])
42                        return <cr:message>{ concat("Tagged value &quot;", $tag/@tag, "&quot; ", mod-xp:get-tag-owner-verbal($doc-root, $tag), " is duplicated.") }</cr:message>
43                )
44        return
45                if (empty($fail)) then ()
46                else
47                        <cr:fail>
48                                <cr:messages>{ $fail }</cr:messages>
49                        </cr:fail>
50};
51
52(: Create a new result element :)
53mod-fr:new-result($test-num, $pass-msg, $fail-msg, local:assert(/))
Note: See TracBrowser for help on using the repository browser.