domain.rnc 3.64 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 16
    DocDef,
    element Imports { Domain+ }?,
17
    element DataTypes { DataTypeDef+ }?,
18 19 20
    ModuleClasses?,
    element DeviceClasses {
      element DeviceClass {
21
        attribute id { xsd:Name },
22 23
        DocDef,
        PropertiesDef?,
24
        ModuleClasses?,
25 26 27 28 29
        element SubDevices {
          element SubDevice {
            attribute id { xsd:Name },
            DocDef,
            PropertiesDef?,
30
            ModuleClasses?
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
          }+
        }?
      }+
    }?
  }
PropertiesDef =
  element Properties {
    element Property {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      attribute value { text }?,
      DocDef,
      SimpleType
    }+
  }
DataTypeDef =
  element DataType {
    attribute name { text }?,
    attribute unitOfMeasure { text }?,
    DocDef,
51
    (ExtendsDef | (StructType | ArrayType | SimpleType | EnumType)),
52 53 54 55 56 57 58 59
    ConstraintsDef?
  }
StructType = element Struct { DataTypeDef+ }
ArrayType = element Array { DataTypeDef }
SimpleType =
  element SimpleType {
    attribute type { BasicType }
  }
60
EnumType = element EnumType { EnumValueDef+ }
61 62 63 64 65 66 67 68 69 70 71 72
BasicType =
  "integer"
  | "boolean"
  | "string"
  | "byte"
  | "float"
  | "array"
  | "date"
  | "time"
  | "datetime"
  | "blob"
  | "uri"
ankraft's avatar
ankraft committed
73
  | "void"
74 75 76 77 78 79 80
EnumValueDef =
  element EnumValue {
    attribute name { text },
    attribute value { text },
    attribute type { BasicType }?,
    DocDef
  }
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
ConstraintsDef =
  element Constraints {
    element Constraint {
      attribute name { text },
      attribute type { BasicType }?,
      attribute value { text }?,
      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 }
         })*
  }?
105 106 107 108 109 110
ModuleClasses =
  element ModuleClasses {
    element ModuleClass {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      DocDef,
111 112
      ExtendsDef,
      # TODO: singular
113 114 115 116 117
      PropertiesDef?,
      Actions?,
      Data?,
      Events?
    }+
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
  }
Actions =
  element Actions {
    element Action {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      DocDef,
      DataTypeDef?,
      ArgDef?
    }+
  }
ArgDef =
  element Args {
    element Arg {
      attribute name { text },
      DocDef,
      DataTypeDef
    }+
  }
Data =
  element Data {
    element DataPoint {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      attribute writable { xsd:boolean }?,
      attribute readable { xsd:boolean }?,
      attribute eventable { xsd:boolean }?,
      DocDef,
      DataTypeDef
    }+
  }
Events =
  element Events {
    element Event {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      DocDef,
      Data?
    }+
  }
158
ExtendsDef =
159
  # TODO: singular
160
  element extends {
161
    #  TODO: Uppercase , singular
ankraft's avatar
ankraft committed
162
    attribute domain { xsd:Name },
163 164 165 166 167 168 169 170 171 172 173 174
    attribute class { text },
    element excludes {
      #  TODO: Uppercase + "...s" -> Excludes
      element exclude {
        attribute name { text },
        attribute type {
          text
          # TODO: add ExcludeTypes
          
        }
      }+
    }?
175
  }?