EntityRegister[estore]
registers the entities in the entity store estore so that they can be accessed directly using Entity.
EntityRegister
EntityRegister[estore]
registers the entities in the entity store estore so that they can be accessed directly using Entity.
Details
- 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.
Examples
open all close allBasic Examples (2)
Register an entity store that contains data about fruit:
EntityRegister[EntityStore["fruit" -> <|
"Entities" -> <|
"banana" -> <|"color" -> Yellow|>,
"strawberry" -> <|"color" -> Red|>
|>
|>]]EntityList["fruit"]Look up the color of a banana:
Entity["fruit", "banana"]["color"]Add data of an additional fruit:
Entity["fruit", "kiwi"]["color"] = Green;Find the entity store that is accessed when retrieving data of the "fruit" entity type:
Entity["fruit"]["EntityStore"]List all registered entity stores:
EntityStores[]Unregister the "fruit" entity store:
EntityUnregister["fruit"]Register an SQL-based EntityStore:
EntityRegister[EntityStore[RelationalDatabase[FindFile["ExampleData/ecommerce-database.sqlite"]]]]Scope (2)
During assignments, separate entity stores are created for each new entity type:
Entity["MyType1", "e"]["p"] = 915;
Entity["MyType2", "f"]["q"] = "abc";EntityStores[]EntityUnregister /@ {"MyType1", "MyType2"};To direct data into the same entity store, register one store containing both types before making assignments:
EntityRegister[EntityStore[{"MyType1", "MyType2"}]];Entity["MyType1", "e"]["p"] = 915;
Entity["MyType2", "f"]["q"] = "abc";EntityStores[]Referencing any of the types is enough to unregister the whole entity store:
EntityUnregister["MyType1"]EntityStores[]Register an entity store that contains two types:
EntityRegister[EntityStore[{
"t1" -> <|
"Entities" -> <|"e" -> <|"p" -> Entity["t2", "f"]|>|>
|>,
"t2" -> <|
"Entities" -> <|"f" -> <|"q" -> 19|>|>
|>
}]]Entity["t1", "e"]["p"]
%["q"]Register another store that shadows the type "t2":
EntityRegister[EntityStore[
"t2" -> <|
"Entities" -> <|"f" -> <|"q" -> 7891|>|>
|>
]];Now the entity Entity["t2","f"] refers to the entity in the newly registered store:
Entity["t1", "e"]["p"]
%["q"]Unregistering type "t2" will restore the previous result:
EntityUnregister["t2"]Entity["t1", "e"]["p"]
%["q"]EntityUnregister["t1"]Possible Issues (1)
When dealing with external databases, one might encounter a database where the primary key was not set for some tables:
EntityRegister[EntityStore[RelationalDatabase[URLDownload[CloudObject["https://www.wolframcloud.com/obj/documentation/nopk.sqlite"]]]]]When this happens, EntityStore will emit a message. This means that some functionality involving single entities will be disabled:
EntityList["table"]But EntityValue will generally keep working:
EntityValue["table", "col"]The only way around this problem is to set the primary key constraint in the external database.
Tech Notes
History
Text
Wolfram Research (2018), EntityRegister, Wolfram Language function, https://reference.wolfram.com/language/ref/EntityRegister.html.
CMS
Wolfram Language. 2018. "EntityRegister." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/EntityRegister.html.
APA
Wolfram Language. (2018). EntityRegister. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/EntityRegister.html
BibTeX
@misc{reference.wolfram_2026_entityregister, author="Wolfram Research", title="{EntityRegister}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/EntityRegister.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_entityregister, organization={Wolfram Research}, title={EntityRegister}, year={2018}, url={https://reference.wolfram.com/language/ref/EntityRegister.html}, note=[Accessed: 12-June-2026]}