domain.rnc 3.12 KB
Newer Older
ankraft's avatar
ankraft committed
1 2 3 4 5 6 7 8 9 10
start = Domain
Domain =
  element Domain {
    # still having some problems with included documents ... 
    #      the included document is given the attribute xml:base ...
    #      but my schema does not permit this ... 
    # 
    #      This almost generates the correct schema ... but it
    #      doesn't have the correct schemaLocation
    # 
11 12
    # <attribute ns="http://www.w3.org/XML/1998/namespace" name="base">
    #	<data type="anyURI"/>
ankraft's avatar
ankraft committed
13 14 15
    # </attribute>
    attribute xml:base { xsd:anyURI }?,
    attribute id { xsd:ID },
16
    DocDef,
ankraft's avatar
ankraft committed
17
    element Imports { Domain* }?,
ankraft's avatar
ankraft committed
18 19 20 21 22 23
    element Modules {
      element ModuleClass { ModuleDef }*
    }?,
    element Devices {
      element Device {
        attribute id { xsd:Name },
24
        DocDef,
25
        Characteristics?,
ankraft's avatar
ankraft committed
26 27
        Modules?,
        element SubDevices {
ankraft's avatar
ankraft committed
28 29
          element SubDevice {
            attribute id { xsd:Name },
30
            DocDef,
31
            Characteristics?,
ankraft's avatar
ankraft committed
32 33
            Modules?
          }*
ankraft's avatar
ankraft committed
34 35 36 37
        }?
      }*
    }?
  }
38 39 40 41 42 43 44 45 46 47
Characteristics =
  element Characteristics {
    element Characteristic {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      attribute value { text }?,
      DocDef,
      SimpleType
    }+
  }
ankraft's avatar
ankraft committed
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
DataTypeDef =
  # Discuss: Doc on DataType?
  attribute unitOfMeasure { text }?,
  (StructType | ArrayType | SimpleType)
StructType =
  element Struct {
    attribute name { text }?,
    DataTypeDef+
  }
ArrayType =
  element Array {
    attribute name { text }?,
    DataTypeDef
  }
SimpleType =
  element SimpleType {
    attribute name { text }?,
    attribute type { BasicType }
66
    #  TODO Constraints Perhaps directly in DataTypeDef
ankraft's avatar
ankraft committed
67 68 69
    
  }
BasicType =
ankraft's avatar
ankraft committed
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
  "integer"
  | "boolean"
  | "string"
  | "byte"
  | "float"
  | "array"
  | "enum"
  | "date"
  | "time"
  | "datetime"
  | "blob"
  | "uri"
DocText =
  (text
   | element em { text }
   | element b { text }
   | element tt { text })*
87 88
# <Doc> element is always optional
DocDef =
ankraft's avatar
ankraft committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
  element Doc {
    DocText
    | (element p { DocText }
       | element img {
           attribute src { text },
           element caption { text }
         })*
  }?
ModuleDef =
  attribute name { text },
  attribute optional { xsd:boolean }?,
  element extends {
    attribute domain { xsd:IDREF },
    attribute class { text }
  }?,
104
  DocDef,
105
  Characteristics?,
ankraft's avatar
ankraft committed
106 107 108 109 110 111 112 113 114 115 116 117
  Actions?,
  Data?,
  Events?
Modules =
  element Modules {
    element Module { ModuleDef }*
  }
Actions =
  element Actions {
    element Action {
      attribute name { text },
      attribute optional { xsd:boolean }?,
118
      DocDef,
ankraft's avatar
ankraft committed
119
      DataTypeDef?,
120 121 122 123 124 125 126 127 128
      ArgDef?
    }*
  }
ArgDef =
  element Args {
    element Arg {
      attribute name { text },
      DocDef,
      DataTypeDef
ankraft's avatar
ankraft committed
129 130 131 132 133 134 135 136 137 138
    }*
  }
Data =
  element Data {
    element DataPoint {
      attribute name { text },
      attribute optional { xsd:boolean }?,
      attribute writable { xsd:boolean }?,
      attribute readable { xsd:boolean }?,
      attribute eventable { xsd:boolean }?,
139
      DocDef,
ankraft's avatar
ankraft committed
140
      DataTypeDef
ankraft's avatar
ankraft committed
141 142 143 144 145 146 147
    }*
  }
Events =
  element Events {
    element Event {
      attribute name { text },
      attribute optional { xsd:boolean }?,
148
      DocDef,
149
      Data?
ankraft's avatar
ankraft committed
150 151
    }*
  }