13 Metadata annotations

Metadata is a sequence of source annotations attached to a schema declaration or member. Each metadata item is written as @name or @name(arguments...). The arguments are ordinary Predica expressions. The leading @ attaches the item to the declaration that follows; it is not part of the metadata name.

Metadata may be attached where the grammar admits MetaData, including nominal type declarations, type aliases, constants, functions, folds, procedures, generic parameters, attributes, derived attributes, variant attributes, subtype embeddings, dropped attributes, and external function declarations.

Unless a metadata form is given a meaning by the spec, metadata is preserved annotation data. It does not add declarations, constraints, predicates, or denotations by itself.

The Predica schema can be annotated with domain and predicate definitions in natural language. For example:


@domain("A supplier in the shipments system")
entity Supplier
{
    @predicate("id(I) ⇔ The supplier has id I")
    Integer id;

    @predicate("name(N) ⇔ The supplier has name N")
    String name;

    @predicate("status(S) ⇔ The supplier has status S")
    Integer status;

    @predicate("city(C) ⇔ The supplier is located in city C")
    String city;

    key {id};
}

Notice that the domain definition uses "a supplier" whereas the predicates use "the supplier".

The predicates use the definite article because the domain is the subject of the predicates.