IntersectedEntityClass

IntersectedEntityClass[class1,class2,]

represents an entity class containing all the entities common to all classi.

Details and Options

  • IntersectedEntityClass[class1,class2,] is effectively equivalent to the unsorted intersection of the entities in each classi as they appear when applying EntityList.
  • When the classes appearing in IntersectedEntityClass effectively have the same type after the simplification in EntityList, the resulting entities will have that type. When performing the intersection of incompatible types, the resulting entities will have a new type.
  • IntersectedEntityClass[class1,class2,,SameTestProperties {props1,props2,}] uses properties propsi from classi to test for entity equality.
  • EntityProperties[IntersectedEntityClass[class1,class2,]] returns all the properties of each classi, along with EntityProperty[IntersectedEntityClass[],"propj"], where "propj" are any of the properties that appear in at least two of the classi when those classes have different entity types.

Examples

open allclose all

Basic Examples  (3)

Compute the complement of two entity classes:

Mixing different entity types will effectively result in an empty entity class:

Redefining equality by name yields the correct result:

When used with relational-database-backed entities, IntersectedEntityClass corresponds to an INTERSECT statement:

Scope  (2)

Use IntersectedEntityClass with entity classes of the same type:

Entities of different types are considered different by default:

Use SameTestProperties to match them by name:

Options  (1)

SameTestProperties  (1)

SameTestProperties can be used to define equality between entities:

Properties & Relations  (2)

IntersectedEntityClass is usually equivalent to Intersection

When performing the intersection of implicit EntityClass or FilteredEntityClass expressions, it is often more efficient to use conjunction in the condition:

The resulting classes are equivalent apart from ordering:

Introduced in 2020
 (12.1)