represents an entity class containing all the entities in classall that are not in any of the classi.

Details and Options

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


open allclose all

Basic Examples  (3)

Compute the complement of two entity classes:

Mixing different entity types will effectively result in the first entity class:

Redefining equality by name yields the correct result:

When used with relational-database-backed entities, ComplementedEntityClass corresponds to an EXCEPT statement:

Scope  (2)

Use ComplementedEntityClass with entities of the same class:

Entities of different types are considered different by default:

Use SameTestProperties to match entities with the same name:

Options  (1)

SameTestProperties  (1)

SameTestProperties can be used to define equality between entities:

Properties & Relations  (2)

ComplementedEntityClass is usually equivalent to Complement:

When performing the complement of implicit EntityClass or FilteredEntityClass expressions, it is often more efficient to use And and Not in the condition:

The resulting classes are equivalent apart from ordering:

Introduced in 2020