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 allclose all

Basic Examples  (2)

Register an entity store that contains data about fruit:

List all "fruit" entities:

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:

Scope  (2)

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:

Unregister type "t1":

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.

Text

Wolfram Research (2018), EntityRegister, Wolfram Language function, https://reference.wolfram.com/language/ref/EntityRegister.html.

BibTeX

@misc{reference.wolfram_2020_entityregister, author="Wolfram Research", title="{EntityRegister}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/EntityRegister.html}", note=[Accessed: 19-April-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_entityregister, organization={Wolfram Research}, title={EntityRegister}, year={2018}, url={https://reference.wolfram.com/language/ref/EntityRegister.html}, note=[Accessed: 19-April-2021 ]}

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