What are the parts of a data model?

DataModel

A data model is a collection of related data types.

DataType

A data type describes an object in terms of the properties that it has.

DataProperty

A data property describes a named value in an object. The value itself has a type as well.

DataAnnotation

A data annotation can be added to data models, types and properties to associate application knowledge with that item.

DataPropertyPath

A data property path describes how to delve into a given data type to arrive at a potentially nested value.

Together, these allow you to describe the structure of the Feature objects provided by an IFeatureModel.

Feature objects have a DataType that describes what values can be retrieved from them. Next to the full DataModel, IFeatureModel objects also provide access to the list of DataTypes of all features that actually appear in the model.

Creating a data model

You use the builder pattern to create data models, types, and properties. Data annotations are simple objects. You can create them like any other regular object type.

For example:

Program: Creating a data property
return DataProperty::newBuilder().name("geometry").valueType(DataType::getGeometryType()).build();
Program: Creating a data type with a property and an annotation
return DataType::newBuilder()
.name("TestDataType")
.addProperty(someProperty)
.addProperty(geometryProperty)
.addAnnotation(IDataAnnotationFactory::create([&](const auto& dataType) {
return std::make_shared<GeometryDataAnnotation>(DataPropertyPath::newBuilder().originType(dataType).property(geometryProperty).build());
}))
.build();
Program: Creating a data model with a data type
return DataModel::newBuilder().name("http://www.mydomain.com/datamodel/TestFeatureModel").addDataType(dataType).build();