Connection and Data. Connection specifies how nodes are connected; Data specifies the data stored on the node. These map to Entity and Literal in semantic modeling. Use PascalCase for views; NEAT uses camelCase for data properties. Check the Value Type column to distinguish them.
Data property
A data property specifies the data stored on the node (node attributes). The following table shows an example.
This specifies that
WindTurbine has a capacity property of type float64 (unit power:megaw), stored in the GeneratingUnit container.
For supported value types, see the Containers API. The container.properties.type.type field specifies the property type.
Two Value Type options support extra parameters:
float32andfloat64— Specify floating-point numbers. Use theunitparameter for the unit. See Units for available units.enum— Specify an enumeration. Setcollectionto the enumeration name and, optionally,unknownValuefor unknown values. A correspondingenumsheet with values is required in the physical data model file.
Index
For data properties, you can specify an index to speed up queries. The following table shows the syntax.
You can specify whether the index is cursorable. See Performance considerations.
To index multiple properties, use the same
Index name for each and specify the property order.
Two index types:
btree for non-list properties, inverted for list properties. Omit the type to default to btree (non-list) or inverted (list).
Constraint
Use constraints to restrict values stored in a property or container. Constraints ensure data integrity and reflect the real world. CDF supports two constraint types:uniqueness: Ensures values of a property or set of properties are unique within the container. SetbySpaceto apply uniqueness per space.requires: Points to another container; the instance must have data there to populate this container.
uniqueness constraint on a property. The following table shows an example.
The
bySpace parameter applies uniqueness per space. For multiple properties, use the order parameter to specify property significance, as with indexes.
Set requires constraints in the Containers sheet. The following table shows an example.
For the
requires constraint, the container parameter specifies which container must have data to populate this one. For multiple containers, list all constraints in the Constraint column:
Connection property
All connections have aValue type that specifies the type of the connected node. The following table shows an example.
This connection specifies that
WindTurbine has a blades property that is a direct relation to the Blade view. The Max Count column specifies that there can be at most 3 blades connected to a wind turbine. If Max Count is not specified, there is no upper limit on the number of connections.
Connection implementation
TheConnection column specifies how the connection is implemented in CDF and can be:
- Direct relation — Low storage and query cost
- Edge connection — More flexible but higher storage and query cost
- Reverse connection — Points to the other end of a direct relation or edge
direct— Direct relation. No extra parameters. SpecifyContainerandContainer propertybecause direct connections are stored in the container.edge— Edge connection. Optional:type,properties,directionreverse— Reverse connection. Specify thepropertybeing reversed.
This specifies that
WindTurbine has a metmasts property that is an edge connection to MetMast. The edges use type distance and store properties in the Distance view. The Distance view has a distance property of type float64 (unit length:m).
Why are both type and properties needed? The type specifies the edge type for filtering when querying. The properties parameter specifies which properties are stored on the edge. For example, you can query all MetMast (Weather Station) nodes connected to a WindTurbine within 100 meters.
Reverse example:
This specifies that
MetMast has a windTurbines property that reverses the metmasts property in WindTurbine. The Max Count column indicates multiple wind turbines can connect to a MetMast.
Tying to the edge example above, this reverse is an edge pointing the opposite direction of WindTurbine.metmasts. Reverse connections let you reuse the same edge for both directions.