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

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/ISO19136-AnxE/test-017.xq@8406
Revision 8191, 1.7 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:    017
4Description:    Asserts that every class in the model carries a suitable
5                                stereotype.
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
12declare namespace UML   = "omg.org/UML1.3";
13declare namespace cr    = "http://ndg.service.newmoon.conftest-result/1.0";
14
15(: Declare local variables, particular to this test :)
16declare variable $test-num as xs:integer := 17;
17declare variable $pass-msg as xs:string := "No class has an unknown stereotype.";
18declare variable $fail-msg as xs:string := "WARNING: The following class has an unknown stereotype, so will not be encoded:";
19
20(:
21        #Date:          2008-12-03
22        #Author:        Pavel Golodoniuc
23
24        Declare the local assert function which defines a postive condition for pass.
25:)
26declare function local:assert($doc-root as node()?) as node()?
27{
28        let
29                $fail := (
30                        for $class in $doc-root//UML:Class[UML:ModelElement.stereotype/UML:Stereotype[not(matches(@name, "^(|DataType|Enumeration|CodeList|Union|FeatureType|Type|dataType|enumeration|codeList|union|featureType|type)$", "i"))]]
31                        return <cr:message>{ concat("Class &quot;", $class/@name, "&quot; has an unknown stereotype &lt;&lt;", $class/UML:ModelElement.stereotype/UML:Stereotype/@name, "&gt;&gt;.") }</cr:message>
32                )
33        return
34                if (empty($fail)) then ()
35                else
36                        <cr:fail>
37                                <cr:messages>{ $fail }</cr:messages>
38                        </cr:fail>
39};
40
41(: Create a new result element :)
42mod-fr:new-result($test-num, $pass-msg, $fail-msg, local:assert(/))
Note: See TracBrowser for help on using the repository browser.