Skip to content

Commit 10662be

Browse files
authored
Merge pull request #79 from one-data-model/sdf-md-update-for-optionality
F2F4D2 updates
2 parents 4141aef + 0c3b061 commit 10662be

File tree

1 file changed

+48
-42
lines changed

1 file changed

+48
-42
lines changed

sdf.md

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ For example, this reference :
119119
```
120120
Creates a new definition "temperatureProperty" that contains all of the qualities defined in the definition at /odmData/temperatureData.
121121

122-
If a JSON Pointer is used without the "$ref" tag, it simply points to an SDF element. See the sections on "odmRequired" for an example.
122+
If a JSON Pointer is used without the "$ref" tag, it points to an SDF element. See the sections on "odmRequired" for an example.
123123

124124
### Namespace Prefix
125125

@@ -153,8 +153,6 @@ The keyword "odmRequired" is provided to apply a constraint for which definition
153153

154154
The value of "odmRequired" is an array JSON pointers, each indicating one mandatory definition.
155155

156-
The example uses [Relative JSON Pointer][] syntax to point to nearby definitions.
157-
158156
``` json
159157
{
160158
"odmObject": {
@@ -186,6 +184,29 @@ The example uses [Relative JSON Pointer][] syntax to point to nearby definitions
186184
}
187185
```
188186

187+
The above example uses [Relative JSON Pointer][] syntax to point to nearby definitions.
188+
189+
The prefix of a relative JSON pointer indicates how many levels above the parent element of the JSON Pointer the following path string is relative to.
190+
191+
In this section, the pointer prefix "0" indicates that the following path is relative to the parent element "temperatureWithAlarm".
192+
193+
```json
194+
"temperatureWithAlarm": {
195+
"odmRequired": [
196+
"0/odmData/temperatureData",
197+
"0/odmEvent/overTemperatureEvent"
198+
],
199+
}
200+
```
201+
202+
In this section, the pointer prefix of "4" indicates that the following path is relative to the element four levels above the parent element, in this case also pointing to the element "temperatureWithAlarm".
203+
204+
```json
205+
"temperature": {
206+
"odmType": { "$ref": "4/odmData/temperatureData" }
207+
}
208+
```
209+
189210
## Keywords for type definitions
190211

191212
The following SDF keywords are used to create type definitions in the target namespace.
@@ -206,14 +227,12 @@ The odmObject keyword denotes zero or more Object definitions. A object may cont
206227
|odmType|object|no|reference to a definition to be used as a template for a new definition|N/A |
207228
|odmRequired|array|no|Array of JSON Pointers to mandatory items in a valid definition | N/A |
208229

209-
- odmObject may define or include
230+
odmObject may define or include the following odmTypes:
210231

211-
|odmType|
212-
|---|
213-
|odmProperty|
214-
|odmAction|
215-
|odmEvent|
216-
|odmData|
232+
- odmProperty
233+
- odmAction
234+
- odmEvent
235+
- odmData
217236

218237

219238
### odmProperty
@@ -256,11 +275,9 @@ Properties are used to model elements of state.
256275
|const|number, boolean, string|no|specifies a constant value for a data item or property| N/A |
257276

258277

259-
- odmProperty may define or include
278+
odmProperty may define or include the following odmTypes:
260279

261-
|odmType|
262-
|---|
263-
|odmData|
280+
- odmData
264281

265282
### odmAction
266283

@@ -283,11 +300,9 @@ Actions are used to model commands and methods which are invoked. Actions have p
283300
|odmInclude|array|no|Array of JSON Pointers to definitions to be included|N/A|
284301
|odmType|object|no|reference to a definition to be used as a template for a new definition|
285302

286-
- odmAction may define or include
303+
odmAction may define or include the following odmTypes:
287304

288-
|odmType|
289-
|---|
290-
|odmData|
305+
- odmData
291306

292307

293308
### odmEvent
@@ -309,11 +324,9 @@ Events are used to model asynchronous occurrences that may be communicated proac
309324
|odmInclude|array|no|Array of JSON Pointers to definitions to be included|N/A|
310325
|odmType|object|no|reference to a definition to be used as a template for a new definition|
311326

312-
- odmTypes Event may define or include
327+
odmEvent may define or include the following odmTypes:
313328

314-
|odmType|
315-
|---|
316-
|odmData|
329+
- odmData
317330

318331

319332
### odmData
@@ -353,11 +366,9 @@ odmData is used for Action parameters, for Event data, and for reusable constrai
353366
|default|number, boolean, string|no|specifies the default value for initialization|
354367
|const|number, boolean, string|no|specifies a constant value for a data item or property|
355368

356-
- odmData may define or contain
369+
odmData may define or contain the following odmTypes:
357370

358-
|odmType|
359-
|---|
360-
|(JSON Schema Types with numeric constraint extensions)|
371+
- JSON Schema Types with numeric constraint extensions
361372

362373

363374
## Example Simple Object Definition:
@@ -419,10 +430,9 @@ Modular composition of definitions enables an existing definition (could be in t
419430
An existing definition may be used as a template for a new definition, that is, a new definition is created in the target namespace which uses the defined qualities of some existing definition. This pattern will use the keyword "odmType" as a quality of a new definition with a value consisting of a reference to the existing definition that is to be used as a template. Optionally, new qualities may be added and values of optional qualities and quality values may be defined.
420431

421432
#### The "odmInclude" keyword
422-
An existing definition may be used, with its name and its path in the model namespace, as virtual element in a new definition. This has the effect of linking to an instance when the model is deployed as run time. This pattern is useful to link properties, actions, and events from one object to another object, or to link objects together in a complex thing definition. This, aling with named views, supports modeling of the OCF "interface type" feature denoted by the "if" query parameter.
433+
One or more existing definition may be used, with its name and its path in the model namespace, as virtual element in a new definition. This has the effect of linking to an instance when the model is deployed as run time. This pattern is useful to link properties, actions, and events from one object to another object, or to link objects together in a complex thing definition. This, aling with named views, supports modeling of the OCF "interface type" feature denoted by the "if" query parameter.
423434

424435
### odmView
425-
426436
The odmView element provides a composed type that defines a named view, and which uses the odmInclude keyword to populate the view with one or more instances of odmThing, odmObject, odmProperty, odmEvent, or odmAction.
427437

428438
- Qualities of odmView
@@ -437,15 +447,13 @@ The odmView element provides a composed type that defines a named view, and whic
437447
|odmInclude|array|no|Array of JSON Pointers to definitions to be included|N/A|
438448

439449

440-
- odmView may define or include
450+
odmView may define or include the following odmTypes:
441451

442-
|odmType|
443-
|---|
444-
|odmThing|
445-
|odmObject|
446-
|odmProperty|
447-
|odmAction|
448-
|odmEvent|
452+
- odmThing
453+
- odmObject
454+
- odmProperty
455+
- odmAction
456+
- odmEvent
449457

450458

451459
### odmThing
@@ -468,13 +476,11 @@ Thing definitions carry semantic meaning, such as a defined refrigerator compart
468476
|odmInclude|array|no|Array of JSON Pointers to definitions to be included|N/A|
469477
|odmType|object|no|reference to a definition to be used as a template for a new definition|
470478

471-
- odmThing may define or include
479+
odmThing may define or include the following odmTypes:
472480

473-
|odmType|
474-
|---|
475-
|odmView|
476-
|odmThing|
477-
|odmObject|
481+
- odmView
482+
- odmThing
483+
- odmObject
478484

479485
### odmProduct
480486

0 commit comments

Comments
 (0)