CombinedEntityClass

CombinedEntityClass[class1,class2,prop]

represents a class of entities obtained by combining the properties of those pairs of entities from class1 and class2 for which the value of the property prop is the same for the two entities in the pair.

CombinedEntityClass[class1,class2,prop1prop2]

combines pairs of entities from class1 and class2 for which the value of prop1 of the entity from class1 is the same as the value of prop2 for the entity from class2.

CombinedEntityClass[class1,class2,{pspeca,pspecb,}]

combines pairs of entities for which all the property specifications pspeck agree.

CombinedEntityClass[class1,class2,f]

combines pairs of entities for which the application of the entity function f yields True.

CombinedEntityClass[class1,class2,spec,"jspec"]

uses "jspec" to determine when to allow entities with missing properties to be included.

Details

  • EntityProperties[CombinedEntityClass[class1,class2,]] is effectively Join[EntityProperties[class1],EntityProperties[class2]].
  • In CombinedEntityClass[class1,class2,f], the function f must be of the form EntityFunction[{e1,e2},], where e1 and e2 stand respectively for entities in class1 and class2.
  • The properties in the result from CombinedEntityClass[class1,class2,] are of the form EntityProperty[typei,], where the typei are the entity types of the classi.
  • CombinedEntityClass["alias1"->class1,"alias2"->class2,] can be used to give properties of the form EntityProperty["aliasi"->typei,].
  • In CombinedEntityClass[class1,class2,], the classi must be distinct. CombinedEntityClass[class,"alias"->class] can be used for identical classes.
  • In CombinedEntityClass[ca,cb,spec,"jspec"], the join specification jspec determines which entities ai from class ca and bj from class cb should be kept, depending on whether the condition defined by cond is met. The possible join specifications are the same as for JoinAcross:
  • "Inner"keep only ai, bj for which the condition is met (default)
    "Left"allow ai for which there is no matching bj
    "Right"allow bi for which there is no matching aj
    "Outer"allow both unmatched ai and bj
  • When a property value is absent, Missing["Unmatched"] is used in its place.
  • CombinedEntityClass[class1,class2,EntityFunction[{x,y},True]] effectively implements the SQL CROSS JOIN. It is roughly equivalent to Outer[Join,] applied to the "PropertyAssociation" obtained from both classes.

Examples

open allclose all

Basic Examples  (6)

Combine elements of period 1 with their isotopes to compare their atomic masses:

A CombinedEntityClass has all the properties of both classes:

Combine elements and isotopes according to a predicate:

Different join specifications will result in different behavior with respect to unmatched entities:

When combining the same type with itself, an alias must be used:

When used with relational-database-backed entities, a CombinedEntityClass is effectively equivalent to a JOIN statement:

Scope  (2)

Define a new CombinedEntityClass:

Filter the resulting class by element group:

Register an EntityStore:

Construct a CombinedEntityClass:

The new class has the properties of all original classes:

The resulting entities are a composite of the original entities:

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

Text

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

CMS

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

APA

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

BibTeX

@misc{reference.wolfram_2023_combinedentityclass, author="Wolfram Research", title="{CombinedEntityClass}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/CombinedEntityClass.html}", note=[Accessed: 28-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_combinedentityclass, organization={Wolfram Research}, title={CombinedEntityClass}, year={2019}, url={https://reference.wolfram.com/language/ref/CombinedEntityClass.html}, note=[Accessed: 28-March-2024 ]}