1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
RELAX NG Schema for OpenMath 2
$Id: openmath3.rnc 7618 2008-06-03 06:32:15Z kohlhase $
$HeadURL: https://svn.omdoc.org/repos/omdoc/trunk/schema/rnc/openmath3.rnc $
See the documentation and examples at http://www.openmath.org
-->
<grammar ns="http://www.openmath.org/OpenMath" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<ref name="OMOBJ"/>
</start>
<!-- OpenMath object constructor -->
<define name="OMOBJ">
<element name="OMOBJ">
<ref name="compound.attributes"/>
<optional>
<attribute name="version">
<data type="string"/>
</attribute>
</optional>
<ref name="omel"/>
</element>
</define>
<!-- Elements which can appear inside an OpenMath object -->
<define name="omel">
<choice>
<ref name="OMS"/>
<ref name="OMV"/>
<ref name="OMI"/>
<ref name="OMB"/>
<ref name="OMSTR"/>
<ref name="OMF"/>
<ref name="OMA"/>
<ref name="OMBIND"/>
<ref name="OME"/>
<ref name="OMATTR"/>
<ref name="OMR"/>
</choice>
</define>
<!-- things which can be variables -->
<define name="omvar">
<choice>
<ref name="OMV"/>
<ref name="attvar"/>
</choice>
</define>
<define name="attvar">
<element name="OMATTR">
<ref name="common.attributes"/>
<group>
<ref name="OMATP"/>
<choice>
<ref name="OMV"/>
<ref name="attvar"/>
</choice>
</group>
</element>
</define>
<define name="cdbase">
<optional>
<attribute name="cdbase">
<data type="anyURI"/>
</attribute>
</optional>
</define>
<!-- attributes common to all elements -->
<define name="common.attributes">
<optional>
<attribute name="id">
<data type="ID"/>
</attribute>
</optional>
</define>
<!-- attributes common to all elements that construct compount OM objects. -->
<define name="compound.attributes">
<ref name="common.attributes"/>
<ref name="cdbase"/>
</define>
<!-- symbol -->
<define name="OMS">
<element name="OMS">
<ref name="common.attributes"/>
<attribute name="name">
<data type="NCName"/>
</attribute>
<attribute name="cd">
<data type="NCName"/>
</attribute>
<ref name="cdbase"/>
</element>
</define>
<!-- variable -->
<define name="OMV">
<element name="OMV">
<ref name="common.attributes"/>
<attribute name="name">
<data type="NCName"/>
</attribute>
</element>
</define>
<!-- integer -->
<define name="OMI">
<element name="OMI">
<ref name="common.attributes"/>
<data type="string">
<param name="pattern">\s*(-\s?)?[0-9]+(\s[0-9]+)*\s*</param>
</data>
</element>
</define>
<!-- byte array -->
<define name="OMB">
<element name="OMB">
<ref name="common.attributes"/>
<data type="base64Binary"/>
</element>
</define>
<!-- string -->
<define name="OMSTR">
<element name="OMSTR">
<ref name="common.attributes"/>
<text/>
</element>
</define>
<!-- IEEE floating point number -->
<define name="OMF">
<element name="OMF">
<ref name="common.attributes"/>
<choice>
<attribute name="dec">
<data type="double"/>
</attribute>
<attribute name="hex">
<data type="string">
<param name="pattern">[0-9A-F]+</param>
</data>
</attribute>
</choice>
</element>
</define>
<!-- apply constructor -->
<define name="OMA">
<element name="OMA">
<ref name="compound.attributes"/>
<oneOrMore>
<ref name="omel"/>
</oneOrMore>
</element>
</define>
<!-- binding constructor -->
<define name="OMBIND">
<element name="OMBIND">
<ref name="compound.attributes"/>
<ref name="omel"/>
<ref name="OMBVAR"/>
<optional>
<ref name="OMC"/>
</optional>
<ref name="omel"/>
</element>
</define>
<!-- the condition element -->
<define name="OMC">
<element name="OMC">
<ref name="common.attributes"/>
<ref name="omel"/>
</element>
</define>
<!-- variables used in binding constructor -->
<define name="OMBVAR">
<element name="OMBVAR">
<ref name="common.attributes"/>
<oneOrMore>
<ref name="omvar"/>
</oneOrMore>
</element>
</define>
<!-- error constructor -->
<define name="OME">
<element name="OME">
<ref name="common.attributes"/>
<ref name="OMS"/>
<zeroOrMore>
<choice>
<ref name="omel"/>
<ref name="OMFOREIGN"/>
</choice>
</zeroOrMore>
</element>
</define>
<!-- attribution constructor and attribute pair constructor -->
<define name="OMATTR">
<element name="OMATTR">
<ref name="compound.attributes"/>
<ref name="OMATP"/>
<ref name="omel"/>
</element>
</define>
<define name="OMATP">
<element name="OMATP">
<ref name="compound.attributes"/>
<oneOrMore>
<ref name="OMS"/>
<choice>
<ref name="omel"/>
<ref name="OMFOREIGN"/>
</choice>
</oneOrMore>
</element>
</define>
<!-- foreign constructor -->
<define name="OMFOREIGN">
<element name="OMFOREIGN">
<ref name="compound.attributes"/>
<optional>
<attribute name="encoding">
<data type="string"/>
</attribute>
</optional>
<zeroOrMore>
<choice>
<ref name="omel"/>
<ref name="notom"/>
</choice>
</zeroOrMore>
</element>
</define>
<!--
Any elements not in the om namespace
(valid om is allowed as a descendant)
-->
<define name="notom">
<text/>
</define>
<!--
(element * - om:* {attribute * { text }*,(omel|notom)*}
| text)
-->
<!-- reference constructor -->
<define name="OMR">
<element name="OMR">
<ref name="common.attributes"/>
<attribute name="href">
<data type="anyURI"/>
</attribute>
</element>
</define>
</grammar>
|