registers the entities in the entity store estore so that they can be accessed directly using Entity.
- The list of entity stores whose contents have been registered is given by EntityStores.
- Entity["type","name"] is interpreted as an entity from the first entity store in EntityStores[ ] that contains "type".
- Entity types that appear in EntityStores are considered before built-in entity types.
- During assignments Entity["type","name"][property]=value, data is stored in the first EntityStore in EntityStores that contains "type". If no EntityStore in EntityStores contains "type", a new EntityStore is registered.
- EntityRegister[…] returns the list of entity types that it has registered.
Examplesopen allclose all
Basic Examples (2)
Register an entity store that contains data about fruit:
Look up the color of a banana:
Add data of an additional fruit:
Find the entity store that is accessed when retrieving data of the "fruit" entity type:
List all registered entity stores:
Unregister the "fruit" entity store:
Register an SQL-based EntityStore:
During assignments, separate entity stores are created for each new entity type:
To direct data into the same entity store, register one store containing both types before making assignments:
Referencing any of the types is enough to unregister the whole entity store:
Register an entity store that contains two types:
Register another store that shadows the type "t2":
Now the entity Entity["t2","f"] refers to the entity in the newly registered store:
Unregistering type "t2" will restore the previous result:
Possible Issues (1)
When dealing with external databases, one might encounter a database where the primary key was not set for some tables:
When this happens, EntityStore will emit a message. This means that some functionality involving single entities will be disabled:
But EntityValue will generally keep working:
The only way around this problem is to set the primary key constraint in the external database.
Wolfram Research (2018), EntityRegister, Wolfram Language function, https://reference.wolfram.com/language/ref/EntityRegister.html.
Wolfram Language. 2018. "EntityRegister." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EntityRegister.html.
Wolfram Language. (2018). EntityRegister. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EntityRegister.html