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
Feature
Feature
objects provided by an IFeatureModel
IFeatureModel
IFeatureModel
.
Feature
Feature
Feature
objects have a DataType
DataType
DataType
that describes what values can be retrieved from them.
Next to the full DataModel
DataModel
DataModel
, IFeatureModel
IFeatureModel
IFeatureModel
objects also provide
accessaccessaccess
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:
return DataProperty::newBuilder().name("geometry").valueType(DataType::getGeometryType()).build();
return DataProperty.NewBuilder().Name("geometry").ValueType(DataType.GeometryType).Build();
return DataProperty.newBuilder()
.name("geometry")
.valueType(DataType.getGeometryType())
.build();
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();
return DataType.NewBuilder()
.Name("TestDataType")
.AddProperty(someProperty)
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();
return DataType.newBuilder()
.name("TestDataType")
.addProperty(TestFeatureModelFactory.SomeProperty)
.addProperty(geometryProperty)
.addAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.build();
return DataModel::newBuilder().name("http://www.mydomain.com/datamodel/TestFeatureModel").addDataType(dataType).build();
return DataModel.NewBuilder()
.Name("http://www.mydomain.com/datamodel/TestFeatureModel")
.AddDataType(dataType)
.Build();
return DataModel.newBuilder()
.name("http://www.mydomain.com/datamodel/TestFeatureModel")
.addDataType(dataType)
.build();