Optional
authorThe model author, if available.
Indicates if this DataModel has been built.
Optional
createdThe date the model was created, if available.
Optional
creatingThe application that created the model, if available.
Readonly
dataThe Data that contains this DataModel.
True once this Component has been destroyed.
Don't use this Component if this is true
.
Protected
dirtyReadonly
idUnique ID of this DataModel.
DataModels are stored against this ID in Data.models.
Optional
nameThe model name, if available.
The DataObjects in this DataModel, mapped to DataObject.id.
DataObjects have globally-unique IDs and will also be stored in Data.objects.
The DataObjects in this DataModel, mapped to DataObject.type, sub-mapped to DataObject.id.
Optional
projectThe project ID, if available.
Readonly
propertyThePropertySets in this DataModel, mapped toPropertySet.id.
PropertySets have globally-unique IDs and will also be stored in Data.propertySets.
The Relationships in this DataModel.
Optional
revisionThe revision ID, if available.
The root DataObjects in this DataModel, mapped to DataObject.id.
Optional
schemaThe model schema version, if available.
Readonly
typeThe count of each type of DataObject in this DataModel, mapped to DataObject.type.
Finalizes this DataModel, making it ready for use.
true
.dataModel.onBuilt.subscribe(() => {
// The DataModel is built and ready for use
});
data.onModelCreated.subscribe((dataModel) => {
// Another way to listen for DataModel readiness
});
const result = dataModel.build();
if (result instanceof SDKError) {
console.error(result.message);
} else {
// Success
}
See @xeokit/sdk/data for more details.
Protected
cleanProtected
cleanCreates a new DataObject and registers it within the DataModel and Data.
const myDataObject = dataModel.createObject({
id: "myDataObject",
type: BasicEntity, // @xeokit/basictypes!basicTypes
name: "My Object",
propertySetIds: ["myPropertySet"]
});
const myDataObject2 = dataModel.createObject({
id: "myDataObject2",
name: "My Other Object",
type: BasicEntity,
propertySetIds: ["myPropertySet"]
});
if (myDataObject instanceof SDKError) {
console.error(myDataObject.message);
} else if (myDataObject2 instanceof SDKError) {
console.error(myDataObject2.message);
} else {
// Success
const gotMyDataObject = dataModel.objects["myDataObject"];
const gotMyDataObjectAgain = data.objects["myDataObject"];
}
See @xeokit/sdk/data for more details.
Configuration parameters for the new DataObject.
DataObject on success.
Creates a new PropertySet and registers it within the DataModel and Data.
const propertySet = dataModel.createPropertySet({
id: "myPropertySet",
name: "My properties",
properties: [
{
name: "Weight",
value: 5,
type: "",
valueType: "",
description: "Weight of a thing"
},
{
name: "Height",
value: 12,
type: "",
valueType: "",
description: "Height of a thing"
}
]
});
if (propertySet instanceof SDKError) {
console.error(propertySet.message);
} else {
// PropertySet successfully created
}
See @xeokit/sdk/data for more details.
Configuration parameters for the new PropertySet.
PropertySet on success.
Creates a new Relationship between two existing DataObjects.
const myRelationship = dataModel.createRelationship({
type: BasicAggregation, // @xeokit/basictypes!basicTypes
relatingObjectId: "myDataObject",
relatedObjectId: "myDataObject2"
});
if (myRelationship instanceof SDKError) {
console.error(myRelationship.message);
} else {
// Success
const myDataObject = dataModel.objects["myDataObject"];
const myDataObject2 = dataModel.objects["myDataObject2"];
const gotMyRelationship = myDataObject.related[BasicAggregation][0];
const gotMyRelationshipAgain = myDataObject2.relating[BasicAggregation][0];
}
See @xeokit/sdk/data for more details.
Configuration parameters for the new Relationship.
Relationship on success.
Destroys this DataModel.
This method performs the following actions:
For detailed usage, refer to @xeokit/sdk/data.
void
Protected
errorAdds components from the specified DataModelParams
to the data model.
For detailed usage, refer to @xeokit/sdk/data.
The parameters to configure and populate the data model.
void
Protected
logProtected
setGets this DataModel as a DataModelParams.
Protected
warnReadonly
onEmits an event when the DataModel has been built.
Emits an event when the Component has been destroyed.
Represents an entity-relationship data model.
This model is:
For detailed usage, refer to @xeokit/sdk/data.