ExtendedEntityClass

ExtendedEntityClass[class,"name"f]

represents an entity class derived from class by adding a new computed property "name" whose value for each entity is obtained by applying the entity function f.

ExtendedEntityClass[class,{"name1"f1,"name2"f2,}]

adds the properties namei defined by the functions fi.

Details

  • In ExtendedEntityClass[class,"name"->f], the function f must be an EntityFunction object.
  • ExtendedEntityClass works with any EntityStore object, whether defined explicitly or based on a RelationalDatabase object.
  • ExtendedEntityClass[class,"new"->f] effectively represents a virtual database table derived from class, with a new column named new added, with values f[entityi] for each entity entityi.
  • For an extended entity class ExtendedEntityClass[class,"new"->f], the full name of the new property added is EntityProperty[ExtendedEntityClass[class,"new"f],"new"].
  • ExtendedEntityClass[class,"new"->f] adds a new computed property even if class already has a property whose name is "new". In this case, however, the new computed property must be referred to using the full name EntityProperty[ExtendedEntityClass[class,"new"f],"new"].
  • If the name of a new property does not conflict with the names of any existing properties, then EntityValue[class,"new"] can be used to get values of the new property.

Examples

open allclose all

Basic Examples  (3)

Use ExtendedEntityClass to add a computed property to a class of entities:

Add an alias for a property:

When used with relational-database-backed entities, ExtendedEntityClass is equivalent to adding an expression in the SELECT statement:

Scope  (1)

Add multiple properties at the same time:

Applications  (1)

ExtendedEntityClass can be used to avoid repeating code:

It can be rewritten as:

Possible Issues  (1)

When dealing with SQL-backed entities, it is not possible to extend an entity class with nonscalar values:

Neat Examples  (1)

Colorful flags:

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

Text

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

BibTeX

@misc{reference.wolfram_2021_extendedentityclass, author="Wolfram Research", title="{ExtendedEntityClass}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/ExtendedEntityClass.html}", note=[Accessed: 17-June-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_extendedentityclass, organization={Wolfram Research}, title={ExtendedEntityClass}, year={2019}, url={https://reference.wolfram.com/language/ref/ExtendedEntityClass.html}, note=[Accessed: 17-June-2021 ]}

CMS

Wolfram Language. 2019. "ExtendedEntityClass." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ExtendedEntityClass.html.

APA

Wolfram Language. (2019). ExtendedEntityClass. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ExtendedEntityClass.html