@abstract annotation
The @abstract annotation is used
to specify that a type is abstract.
Usage
When defined for a type, the @abstract annotation enforces the abstract constraint, making the type abstract.
An abstract type cannot be instantiated, but can be used in a query (e.g., in an isa constraint to match instances of its subtypes).
define
entity element @abstract;
Subtyping
The abstract constraint is not inherited.
This means all subtypes of an abstract type are concrete by default, enabling the creation of their instances.
However, it is possible to define an abstract subtype of an abstract type.
#!test[schema]
define
attribute id @abstract, value string;
attribute page-id @abstract, sub id;
attribute username sub page-id;
It is impossible to define an abstract subtype of a concrete type.
Wrong definition!
#!test[schema, fail_at=runtime]
define
attribute categorized-username @abstract, sub username;
Specialization of role types
Similarly, abstract role types cannot be instantiated.
A concrete sub role type can be defined using specialization (keyword as).
#!test[schema]
define
relation interaction @abstract,
relates subject @abstract,
relates content;
relation viewing sub interaction,
relates viewer as subject,
relates viewed as content;