domain.rnc 4.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
# - domain.rng
# -
# - Version 4.0
# -
# - This work is released by the MAS Working Group of oneM2M, December 2018.
# - The work is created and released under the 3-Clause BSD License.
# - See the license text at [https://opensource.org/licenses/BSD-3-Clause for
# - full details.

start = Domain
Domain =
  element Domain {
    attribute xml:base { xsd:anyURI }?,
ankraft's avatar
ankraft committed
14
    attribute id { xsd:Name },
15
    attribute semanticURI { xsd:anyURI }?,
16 17
    DocDef,
    element Imports { Domain+ }?,
18
    element DataTypes { DataTypeDef+ }?,
19 20 21
    ModuleClasses?,
    element DeviceClasses {
      element DeviceClass {
22
        attribute id { xsd:Name },
23
        attribute semanticURI { xsd:anyURI }?,
24 25
        DocDef,
        PropertiesDef?,
26
        ModuleClasses?,
27 28 29
        element SubDevices {
          element SubDevice {
            attribute id { xsd:Name },
30
            attribute semanticURI { xsd:anyURI }?,
31 32
            DocDef,
            PropertiesDef?,
33
            ModuleClasses?
34 35 36 37 38 39 40 41
          }+
        }?
      }+
    }?
  }
PropertiesDef =
  element Properties {
    element Property {
42
      attribute name { xsd:Name },
43 44
      attribute optional { xsd:boolean }?,
      attribute value { text }?,
45
      attribute semanticURI { xsd:anyURI }?,
46 47 48 49 50 51
      DocDef,
      SimpleType
    }+
  }
DataTypeDef =
  element DataType {
52
    attribute name { xsd:Name }?,
53
    attribute unitOfMeasure { text }?,
54
    attribute semanticURI { xsd:anyURI }?,
55
    DocDef,
56
    (ExtendsDef | (StructType | ArrayType | SimpleType | EnumType)),
57 58 59 60 61 62 63 64
    ConstraintsDef?
  }
StructType = element Struct { DataTypeDef+ }
ArrayType = element Array { DataTypeDef }
SimpleType =
  element SimpleType {
    attribute type { BasicType }
  }
65
EnumType = element EnumType { EnumValueDef+ }
66 67 68 69 70 71 72 73 74 75 76 77
BasicType =
  "integer"
  | "boolean"
  | "string"
  | "byte"
  | "float"
  | "array"
  | "date"
  | "time"
  | "datetime"
  | "blob"
  | "uri"
ankraft's avatar
ankraft committed
78
  | "void"
79 80
EnumValueDef =
  element EnumValue {
81
    attribute name { xsd:Name },
82 83
    attribute value { text },
    attribute type { BasicType }?,
84
    attribute semanticURI { xsd:anyURI }?,
85 86
    DocDef
  }
87 88 89
ConstraintsDef =
  element Constraints {
    element Constraint {
90
      attribute name { xsd:Name },
91 92
      attribute type { BasicType }?,
      attribute value { text }?,
93
      attribute semanticURI { xsd:anyURI }?,
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
      DocDef
    }+
  }
DocText =
  (text
   | element em { text }
   | element b { text }
   | element tt { text })*
# <Doc> element is always optional
DocDef =
  element Doc {
    DocText
    | (element p { DocText }
       | element img {
           attribute src { text },
           element caption { text }
         })*
  }?
112 113 114
ModuleClasses =
  element ModuleClasses {
    element ModuleClass {
115
      attribute name { xsd:Name },
116
      attribute optional { xsd:boolean }?,
117
      attribute semanticURI { xsd:anyURI }?,
118
      DocDef,
119 120
      ExtendsDef,
      # TODO: singular
121 122 123 124 125
      PropertiesDef?,
      Actions?,
      Data?,
      Events?
    }+
126 127 128 129
  }
Actions =
  element Actions {
    element Action {
130
      attribute name { xsd:Name },
131
      attribute optional { xsd:boolean }?,
132
      attribute semanticURI { xsd:anyURI }?,
133 134 135 136 137 138 139 140
      DocDef,
      DataTypeDef?,
      ArgDef?
    }+
  }
ArgDef =
  element Args {
    element Arg {
141
      attribute name { xsd:Name },
142
      attribute semanticURI { xsd:anyURI }?,
143 144 145 146 147 148 149
      DocDef,
      DataTypeDef
    }+
  }
Data =
  element Data {
    element DataPoint {
150
      attribute name { xsd:Name },
151 152 153 154
      attribute optional { xsd:boolean }?,
      attribute writable { xsd:boolean }?,
      attribute readable { xsd:boolean }?,
      attribute eventable { xsd:boolean }?,
155
      attribute semanticURI { xsd:anyURI }?,
156 157 158 159 160 161 162
      DocDef,
      DataTypeDef
    }+
  }
Events =
  element Events {
    element Event {
163
      attribute name { xsd:Name },
164
      attribute optional { xsd:boolean }?,
165
      attribute semanticURI { xsd:anyURI }?,
166 167 168 169
      DocDef,
      Data?
    }+
  }
170
ExtendsDef =
171
  # TODO: singular
172
  element extends {
173
    #  TODO: Uppercase , singular
ankraft's avatar
ankraft committed
174
    attribute domain { xsd:Name },
175 176 177 178 179 180 181 182 183 184 185 186
    attribute class { text },
    element excludes {
      #  TODO: Uppercase + "...s" -> Excludes
      element exclude {
        attribute name { text },
        attribute type {
          text
          # TODO: add ExcludeTypes
          
        }
      }+
    }?
187
  }?