one-data-model / language

(Old repo:) Simple Definition Format (SDF) for One Data Model definitions
7 stars 4 forks source link

Provide for multiple instances of a definition within a declaration #96

Open mjkoster opened 4 years ago

mjkoster commented 4 years ago

To support array style constructs in implementations, the data model definition needs to allow for some kind of multi-instance concept in declarations, to use a definition in a way that may result in multiple instances within an implementation.

This could be multiple instances of a property to model OMA LWM2M resources, or something like an outlet strip model with some unspecified number of outlet elements.

mjkoster commented 4 years ago

I propose to take an explicit approach and define two new qualities, applied to types odmProperty, odmObject, and odmThing:

multiInstance without a maxInstances constraint is valid maxInstances without multiInstance is unambiguous, but we should require multiInstance to be present if maxInstances is used

These qualities should be allowed to be added to new definitions that reuse other definitions, e.g. multiInstance in the definition of an outlet thing, and maxInstances defined when the outlet thing definition is used in an outlet strip thing definition.

WAvdBeek commented 4 years ago

i think this will work for odmThing, where multiple instances of the odmObject can be instantiated. not sure if this should be done inside odmObject or odmThing, here we can use an array/link concept

mjkoster commented 4 years ago

We need to support multiple instances of odmProperty to model multi-instance Resource types in LWM2M. In LWM2M, they are addressable as an array or as individual elements. There is no need to require any particular structure in the SDF model, thus can leave it to the binding.

We also need to allow odmThing to have multiple instances of odmObject or odmThIng for use cases like the outlet strip. We could work out some examples to discuss from.

WAvdBeek commented 4 years ago

if LWM2M can access the data as an array then we should also model that with SDF.

akeranen commented 4 years ago

Having the same multi* qualities on both Thing/Object and A/E/P level sounds like a good way forward to me. That allows modeling well the LwM2M models and those models that don't have this feature don't have to use it. I guess we'll learn more how well that works when we do more cross-ecosystem model conversions and then can re-visit this, if needed.