forked from OpenMath/OMSTD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openmath2.rnc
88 lines (61 loc) · 2.42 KB
/
openmath2.rnc
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
# RELAX NG Schema for OpenMath 2
default namespace om = "http://www.openmath.org/OpenMath"
start = OMOBJ
# OpenMath object constructor
OMOBJ = element OMOBJ { compound.attributes,
attribute version { xsd:string }?,
omel }
# Elements which can appear inside an OpenMath object
omel =
OMS | OMV | OMI | OMB | OMSTR | OMF | OMA | OMBIND | OME | OMATTR |OMR
# things which can be variables
omvar = OMV | attvar
attvar = element OMATTR { common.attributes,(OMATP , (OMV | attvar))}
cdbase = attribute cdbase { xsd:anyURI}?
# attributes common to all elements
common.attributes = (attribute id { xsd:ID })?
# attributes common to all elements that construct compount OM objects.
compound.attributes = common.attributes,cdbase
# symbol
OMS = element OMS { common.attributes,
attribute name { xsd:NCName},
attribute cd { xsd:NCName},
cdbase }
# variable
OMV = element OMV { common.attributes,
attribute name { xsd:NCName} }
# integer
OMI = element OMI { common.attributes,
xsd:string {pattern = "\s*(-\s?)?[0-9]+(\s[0-9]+)*\s*"}}
# byte array
OMB = element OMB { common.attributes, xsd:base64Binary }
# string
OMSTR = element OMSTR { common.attributes, text }
# IEEE floating point number
OMF = element OMF { common.attributes,
( attribute dec { xsd:double } |
attribute hex { xsd:string {pattern = "[0-9A-F]+"}}) }
# apply constructor
OMA = element OMA { compound.attributes, omel+ }
# binding constructor
OMBIND = element OMBIND { compound.attributes, omel, OMBVAR, omel }
# variables used in binding constructor
OMBVAR = element OMBVAR { common.attributes, omvar+ }
# error constructor
OME = element OME { common.attributes, OMS, (omel|OMFOREIGN)* }
# attribution constructor and attribute pair constructor
OMATTR = element OMATTR { compound.attributes, OMATP, omel }
OMATP = element OMATP { compound.attributes, (OMS, (omel | OMFOREIGN) )+ }
# foreign constructor
OMFOREIGN = element OMFOREIGN {
compound.attributes, attribute encoding {xsd:string}?,
(omel|notom)* }
# Any elements not in the om namespace
# (valid om is allowed as a descendant)
notom =
(element * - om:* {attribute * { text }*,(omel|notom)*}
| text)
# reference constructor
OMR = element OMR { common.attributes,
attribute href { xsd:anyURI }
}