Model: Entity Instance
An entity instance is an object with characteristics that is of a specific entity type. An entity instance contains a property instance for each property type defined either in the entity type or in one of the entity type's components.
In contrast to entity types, property instances are contained and each property instance contains a data stream and its last value.
UUIDs
Entity instances can be uniquely identified via a UUID. This is particularly important when entity instances are synchronized in a distributed system. For example, a player's representation exists not only in the local client, but also on the server and on clients connected to it.
- UUIDs are unique and unique across distributed systems
- UUIDs can be represented as string and as a 128 bit unsigned integer
Labels
Labels are also unique, but optional. While UUIDs are hard to remember, labels are easier to remember. This allows entity instances to be addressed using labels, for example in GraphQL queries.
If you compare the query with and without a label, you will find that the query is easier to understand thanks to the label and transports significantly more information about what is actually happening.
query {
instances {
entities(label: "/io/reactive-graph/input/any_device/key/key_f7") {
properties(name: "key_down") {
value
}
}
}
}
query {
instances {
entities(id: "c7ec76e0-40e8-587e-bc89-e9cd31fa75a0") {
properties(name: "key_down") {
value
}
}
}
}
Data Model
Field | DataType | Description |
---|---|---|
Type | EntityType | The type of the entity instance |
ID | UUID | The unique identifier of the entity instance |
Label | String (optional) | The label of the entity instance |
Description | String | Textual description of the entity type |
Properties | Vec<Property Instance> | The properties of the entity instance |
Components | Vec | The currently applied components |
Behaviours | Vec | The currently applied behaviours |
Graph
graph LR; EI(Entity Instance); I1(Entity Instance)===>|"Relation Instance"|EI; I2(Entity Instance)===>|"Relation Instance"|EI; I3(Entity Instance)===>|"Relation Instance"|EI; EI===>|"Relation Instance"|O1(Entity Instance); EI===>|"Relation Instance"|O2(Entity Instance); EI===>|"Relation Instance"|O3(Entity Instance);
ER Diagram
erDiagram Entity-Type { string namespace string name } Entity-Instance { string id string label } Relation-Type { string namespace string name } Relation-Instance { string namespace string name string instanceId } Property-Type { string name enum DataType enum SocketType enum Mutability } Property-Instance { string name JSON value } Entity-Instance ||--}o Property-Instance : stores Entity-Instance o{--}o Relation-Instance : outbound Entity-Instance o{--}o Relation-Instance : inbound Relation-Instance ||--}o Property-Instance : stores Relation-Instance o{--|| Relation-Type : is-a Property-Instance o{--|| Property-Type : is-a Entity-Instance o{--|| Entity-Type : is-a Relation-Type ||--}o Property-Type : defines Entity-Type ||--}o Relation-Type : outbound Entity-Type ||--}o Relation-Type : inbound Entity-Type ||--}o Property-Type : defines