/[volute]/trunk/projects/dm/vo-dml/xsd/vo-dml.sch.xml
ViewVC logotype

Annotation of /trunk/projects/dm/vo-dml/xsd/vo-dml.sch.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2493 - (hide annotations)
Wed Mar 26 16:44:01 2014 UTC (7 years, 6 months ago) by gerard.lemson
File MIME type: text/xml
File size: 4841 byte(s)
update vo-dml schematron file to include updates to meta-model.
1 gerard.lemson 1899 <?xml version="1.0" encoding="UTF-8"?>
2 gerard.lemson 1930 <sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2"
3     xmlns:fct="localFunctions"
4     xmlns:xs="http://www.w3.org/2001/XMLSchema"
5     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
6 gerard.lemson 1899 <sch:ns uri="http://volute.googlecode.com/dm/vo-dml/v0.9" prefix="vo-dml"/>
7 gerard.lemson 1930 <sch:ns prefix="fct" uri="localFunctions"/>
8    
9 gerard.lemson 1899 <sch:title>Schematron VO-DML Validator</sch:title>
10    
11    
12     <!-- Check that a model import exists for a utyperef with prefix not equal to utype of the model. -->
13     <sch:pattern name="RemoteModelImport">
14 gerard.lemson 2493 <sch:rule context="utype[substring-before(text(),':') != '' and substring-before(text(),':') != /vo-dml:model/vodml-id]">
15 gerard.lemson 1930 <sch:let name="prefix" value="substring-before(text(),':')"/>
16 gerard.lemson 2493 <sch:assert test="/vo-dml:model/import/vodml-id = $prefix">
17 gerard.lemson 2174 ERROR: There is no imported model corresponding to model prefix '<sch:value-of select="$prefix"/>' in this model.
18 gerard.lemson 1930 </sch:assert>
19     </sch:rule>
20 gerard.lemson 1899 </sch:pattern>
21    
22 gerard.lemson 2151 <sch:pattern name="Utypes">
23 gerard.lemson 1930 <sch:rule context="attribute">
24 gerard.lemson 2151 <sch:let name="owner" value="./vodml-id"/>
25     <sch:let name="target" value="fct:vo-dml_element(datatype/utype,/vo-dml:model)"/>
26 gerard.lemson 1930 <sch:assert test="$target = 'primitiveType' or $target = 'dataType' or $target='enumeration'">
27     ERROR: datatype of <sch:value-of select="$owner"/> is not a value type but a '<sch:value-of select="$target"/>'
28     </sch:assert>
29     </sch:rule>
30 gerard.lemson 1899
31 gerard.lemson 1930 <sch:rule context="reference">
32 gerard.lemson 2151 <sch:let name="owner" value="./vodml-id"/>
33     <sch:let name="target" value="fct:vo-dml_element(datatype/utype,/vo-dml:model)"/>
34 gerard.lemson 1930 <sch:assert test="$target = 'objectType'">
35     ERROR: datatype of reference <sch:value-of select="$owner"/> is not an object type but a '<sch:value-of select="$target"/>'
36     </sch:assert>
37     </sch:rule>
38 gerard.lemson 1899
39 gerard.lemson 2059 <sch:rule context="objectType/collection">
40 gerard.lemson 2151 <sch:let name="owner" value="./vodml-id"/>
41     <sch:let name="target" value="fct:vo-dml_element(datatype/utype,/vo-dml:model)"/>
42 gerard.lemson 1930 <sch:assert test="$target = 'objectType'">
43     ERROR: datatype of collection <sch:value-of select="$owner"/> is not an object type but a '<sch:value-of select="$target"/>'
44     </sch:assert>
45     </sch:rule>
46 gerard.lemson 1899
47 gerard.lemson 1930 <sch:rule context="objectType[extends]">
48 gerard.lemson 2151 <sch:let name="owner" value="./vodml-id"/>
49     <sch:let name="target" value="fct:vo-dml_element(extends/utype,/vo-dml:model)"/>
50 gerard.lemson 1930 <sch:assert test="$target = 'objectType'">
51     ERROR: base type of objectType <sch:value-of select="$owner"/> is not an object type but a '<sch:value-of select="$target"/>'
52     </sch:assert>
53     </sch:rule>
54 gerard.lemson 2344 <!-- rules on subsets can be rather complex.
55     A subsets element must be owned by a role that has a datatype that is a subtype of the datatype of the subsetted role.
56     The owner of the role must be a subtype of the owner of the subsetted role.
57     Problem: need not be direct subtypes, i.e. need recursion.
58     The roles must be of the same type (ie.e both attributes, or references or collections).
59     The roles must have same name (TBD correct?) -->
60     <sch:rule context="subsets">
61     <sch:let name="owner" value="../name()"/>
62     <sch:let name="target" value="fct:vo-dml_element(./utype,/vo-dml:model)"/>
63     <sch:assert test="$target">
64     ERROR: target of subsets relation with utype <sch:value-of select="./utype"/> can not be found
65     </sch:assert>
66     <sch:assert test="$target = $owner">
67     ERROR: role with subsets relation of type '<sch:value-of select="$owner"/>' MUST have same type as subsetted role (<sch:value-of select="$target"/>)
68     </sch:assert>
69     </sch:rule>
70 gerard.lemson 1930
71 gerard.lemson 1967 <!-- TODO more rules need implementing
72     - ...
73     -->
74 gerard.lemson 1930
75 gerard.lemson 1899 </sch:pattern>
76    
77    
78    
79 gerard.lemson 1930
80     <xsl:function name="fct:vo-dml_element" as="xs:string">
81     <!-- returns name of element containing the utype identified by the utyperef -->
82 gerard.lemson 2151 <xsl:param name="utype"/>
83 gerard.lemson 1930 <xsl:param name="model"/>
84    
85 gerard.lemson 2151 <xsl:variable name="prefix" select="substring-before($utype,':')"/>
86     <xsl:variable name="targetUtype" select="substring-after($utype,concat($prefix,':'))"/>
87 gerard.lemson 1930 <xsl:choose>
88 gerard.lemson 2493 <xsl:when test="$prefix = $model/vodml-id">
89 gerard.lemson 2151 <xsl:value-of select="$model//*[vodml-id = $targetUtype]/name()"/>
90 gerard.lemson 1930 </xsl:when>
91     <xsl:otherwise>
92 gerard.lemson 2493 <xsl:variable name="import" select="$model/import[vodml-id = $prefix]/url"/>
93 gerard.lemson 1930 <xsl:choose>
94     <xsl:when test="$import">
95     <xsl:variable name="doc" select="document($import)"/>
96 gerard.lemson 2151 <xsl:value-of select="$doc//*[vodml-id = $targetUtype]/name()"/>
97 gerard.lemson 1930 </xsl:when>
98     <xsl:otherwise>
99     <xsl:value-of select="'ERROR'"/>
100     </xsl:otherwise>
101     </xsl:choose>
102     </xsl:otherwise>
103     </xsl:choose>
104     </xsl:function>
105    
106    
107    
108    
109 gerard.lemson 1899 </sch:schema>

Properties

Name Value
svn:mime-type text/xml

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26