| 1 |
<!-- XML Schema for the VODML lite mapping L. Michel 06/2020 --> |
| 2 |
<!-- MIVOT schema for the record --> |
| 3 |
<!-- GL 2021-07-23: Refactoring towards using type definitions rather than |
| 4 |
global elements. Following VOTable v 1.11 refactoring from 23-May-2006 LM |
| 5 |
2021-08-25: add VOtable import, prefix prefixes with dm-mapping --> |
| 6 |
|
| 7 |
<!-- ======================= --> |
| 8 |
<!-- XSD sample http://users.polytech.unice.fr/~pfz/LANGDOC/COURS/EXEMPLES/XSD_DXS/chapter14.html --> |
| 9 |
|
| 10 |
<xs:schema attributeFormDefault="unqualified" |
| 11 |
elementFormDefault="qualified" version="1.1" |
| 12 |
xmlns:xs="http://www.w3.org/2001/XMLSchema" |
| 13 |
targetNamespace="http://www.ivoa.net/xml/mivot" |
| 14 |
xmlns:dm-mapping="http://www.ivoa.net/xml/mivot"> |
| 15 |
|
| 16 |
|
| 17 |
<!-- Required to validate mapping block within a VOTable (LM 08/2021) --> |
| 18 |
<xs:import namespace="http://www.ivoa.net/xml/VOTable/v1.3" |
| 19 |
schemaLocation="http://www.ivoa.net/xml/VOTable/v1.3" /> |
| 20 |
<xs:import namespace="http://www.ivoa.net/xml/VOTable/v1.2" |
| 21 |
schemaLocation="http://www.ivoa.net/xml/VOTable/v1.2" /> |
| 22 |
<xs:import namespace="http://www.ivoa.net/xml/VOTable/v1.1" |
| 23 |
schemaLocation="http://www.ivoa.net/xml/VOTable/v1.1" /> |
| 24 |
|
| 25 |
<!-- Top level structure of the mapping block --> |
| 26 |
<xs:element name="VODML"> |
| 27 |
<xs:complexType> |
| 28 |
<xs:sequence> |
| 29 |
<xs:element name="REPORT" type="dm-mapping:Report" |
| 30 |
minOccurs="0" maxOccurs="1" /> |
| 31 |
<xs:element name="MODEL" type="dm-mapping:Model" |
| 32 |
minOccurs="0" maxOccurs="unbounded" /> |
| 33 |
<xs:element name="GLOBALS" type="dm-mapping:Globals" |
| 34 |
minOccurs="0" maxOccurs="1" /> |
| 35 |
<xs:element name="TEMPLATES" type="dm-mapping:Templates" |
| 36 |
minOccurs="0" maxOccurs="unbounded" /> |
| 37 |
</xs:sequence> |
| 38 |
<!-- MD proposal |
| 39 |
--> |
| 40 |
</xs:complexType> |
| 41 |
|
| 42 |
<!-- Make sure dmid is unique within the mapping block --> |
| 43 |
<xs:unique name="Uniquedmid"> |
| 44 |
<xs:selector xpath=".//*" /> |
| 45 |
<xs:field xpath="@dmid" /> |
| 46 |
</xs:unique> |
| 47 |
</xs:element> |
| 48 |
|
| 49 |
<!-- Annotation process report--> |
| 50 |
<xs:complexType name="Report" mixed="true"> |
| 51 |
<xs:attribute name="status" type="xs:string" |
| 52 |
use="required" /> |
| 53 |
|
| 54 |
</xs:complexType> |
| 55 |
|
| 56 |
<!-- Declaration of one used model --> |
| 57 |
<xs:complexType name="Model"> |
| 58 |
<xs:attribute name="name" type="xs:string" /> |
| 59 |
<xs:attribute name="url" type="xs:anyURI" /> |
| 60 |
|
| 61 |
|
| 62 |
</xs:complexType> |
| 63 |
|
| 64 |
<!-- Mapping of the data that have a global scope (e.g. frames) --> |
| 65 |
<xs:complexType name="Globals"> |
| 66 |
<xs:sequence> |
| 67 |
<xs:choice> |
| 68 |
<xs:element name="INSTANCE" type="dm-mapping:Instance"/> |
| 69 |
<xs:element name="COLLECTION" type="dm-mapping:Collection"/> |
| 70 |
</xs:choice> |
| 71 |
</xs:sequence> |
| 72 |
</xs:complexType> |
| 73 |
|
| 74 |
<!-- Mapping of the data contained in a particular table --> |
| 75 |
<xs:complexType name="Templates"> |
| 76 |
<xs:sequence> |
| 77 |
<xs:element name="WHERE" type="dm-mapping:Where" |
| 78 |
minOccurs="0" maxOccurs="unbounded" /> |
| 79 |
<xs:element name="INSTANCE" type="dm-mapping:Instance" |
| 80 |
minOccurs="1" maxOccurs="unbounded" /> |
| 81 |
</xs:sequence> |
| 82 |
<xs:attribute type="xs:string" name="tableref" /> |
| 83 |
</xs:complexType> |
| 84 |
|
| 85 |
<!-- Mapping of either a Datatype or an Objecttype --> |
| 86 |
<xs:complexType name="Instance"> |
| 87 |
<xs:sequence> |
| 88 |
<xs:choice maxOccurs="unbounded"> |
| 89 |
<xs:element name="PRIMARY_KEY" |
| 90 |
type="dm-mapping:PrimaryKey" minOccurs="0" /> |
| 91 |
</xs:choice> <!-- can this now be an xs:all --> |
| 92 |
<xs:choice maxOccurs="unbounded"> |
| 93 |
<xs:element name="REFERENCE" type="dm-mapping:Reference" |
| 94 |
minOccurs="0" /> |
| 95 |
<xs:element name="ATTRIBUTE" type="dm-mapping:Attribute" |
| 96 |
minOccurs="0" /> |
| 97 |
<xs:element name="INSTANCE" type="dm-mapping:Instance" |
| 98 |
minOccurs="0" /> |
| 99 |
<xs:element name="COLLECTION" |
| 100 |
type="dm-mapping:Collection" minOccurs="0" /> |
| 101 |
</xs:choice> |
| 102 |
</xs:sequence> |
| 103 |
<xs:attribute type="xs:string" name="dmrole" |
| 104 |
use="optional" /> |
| 105 |
<xs:attribute type="xs:string" name="dmtype" |
| 106 |
use="required" /> |
| 107 |
<xs:attribute type="xs:string" name="dmid" /> |
| 108 |
</xs:complexType> |
| 109 |
|
| 110 |
<!-- Atomic attribute --> |
| 111 |
<xs:complexType name="Attribute"> |
| 112 |
<xs:attribute type="xs:string" name="dmrole" |
| 113 |
use="optional" /> |
| 114 |
<xs:attribute type="xs:string" name="dmtype" |
| 115 |
use="required" /> |
| 116 |
<xs:attribute type="xs:string" name="ref" /> |
| 117 |
<xs:attribute type="xs:string" name="value" /> |
| 118 |
<xs:attribute type="xs:string" name="unit" /> |
| 119 |
<xs:attribute type="xs:string" name="arrayindex" /> |
| 120 |
|
| 121 |
|
| 122 |
</xs:complexType> |
| 123 |
|
| 124 |
<!-- Data list mapping block --> |
| 125 |
<xs:complexType name="Collection"> |
| 126 |
<xs:choice maxOccurs="unbounded"> |
| 127 |
<xs:element name="REFERENCE" type="dm-mapping:Reference" |
| 128 |
minOccurs="0" /> |
| 129 |
<xs:element name="INSTANCE" type="dm-mapping:Instance" |
| 130 |
minOccurs="0" /> |
| 131 |
<xs:element name="ATTRIBUTE" type="dm-mapping:Attribute" |
| 132 |
minOccurs="0" /> |
| 133 |
<xs:element name="COLLECTION" type="dm-mapping:Collection" |
| 134 |
minOccurs="0" /> |
| 135 |
<xs:element name="JOIN" type="dm-mapping:Join" |
| 136 |
minOccurs="0" maxOccurs="1" /> |
| 137 |
</xs:choice> |
| 138 |
<xs:attribute type="xs:string" name="dmrole" |
| 139 |
use="optional" /> |
| 140 |
<xs:attribute type="xs:string" name="size" /> |
| 141 |
<xs:attribute type="xs:string" name="dmid" /> |
| 142 |
|
| 143 |
|
| 144 |
</xs:complexType> |
| 145 |
|
| 146 |
<xs:complexType name="Reference"> |
| 147 |
<xs:sequence> |
| 148 |
<xs:element name="FOREIGN_KEY" |
| 149 |
type="dm-mapping:ForeignKey" minOccurs="0" maxOccurs="unbounded" /> |
| 150 |
</xs:sequence> |
| 151 |
<xs:attribute type="xs:string" name="dmrole" |
| 152 |
use="optional" /> |
| 153 |
<xs:attribute type="xs:string" name="sourceref" /> |
| 154 |
<xs:attribute type="xs:string" name="dmref" /> |
| 155 |
</xs:complexType> |
| 156 |
|
| 157 |
<!-- Join with another table. --> |
| 158 |
<xs:complexType name="Join"> |
| 159 |
<xs:sequence> |
| 160 |
<xs:element name="WHERE" type="dm-mapping:Where" |
| 161 |
minOccurs="0" maxOccurs="unbounded" /> |
| 162 |
</xs:sequence> |
| 163 |
<xs:attribute type="xs:string" name="sourceref" /> |
| 164 |
<xs:attribute type="xs:string" name="dmref" /> |
| 165 |
</xs:complexType> |
| 166 |
|
| 167 |
<!-- Select table rows with value of the column @ref = @value --> |
| 168 |
<xs:complexType name="Where"> |
| 169 |
<xs:attribute type="xs:string" name="foreignkey" /> |
| 170 |
<xs:attribute type="xs:string" name="primarykey" /> |
| 171 |
<xs:attribute type="xs:string" name="value" /> |
| 172 |
</xs:complexType> |
| 173 |
|
| 174 |
<xs:complexType name="PrimaryKey"> |
| 175 |
<xs:attribute type="xs:string" name="ref" /> |
| 176 |
<xs:attribute type="xs:string" name="dmtype" /> |
| 177 |
<xs:attribute type="xs:string" name="value" /> |
| 178 |
</xs:complexType> |
| 179 |
|
| 180 |
<xs:complexType name="ForeignKey"> |
| 181 |
<xs:attribute type="xs:string" name="ref" use="required" /> |
| 182 |
|
| 183 |
</xs:complexType> |
| 184 |
|
| 185 |
</xs:schema> |