UmweltDocs
Reference/Commands/predicate.define
predicate.definecommandsince 0.1

Declares a predicate before claims use it: what its object is, and how many values a subject may have.

Request
umwelt call story.umw predicate.define '{
  "projectId": "ball",
  "predicate": {
    "id": "stole",
    "label": "stole",
    "object": "entity",
    "cardinality": "many"
  }
}'
Request
const result = await client.predicateDefine({
  projectId: 'ball',
  predicate: { id: 'stole', label: 'stole', object: 'entity', cardinality: 'many' },
});
Request
var result = engine.PredicateDefine(new DefinePredicateInput
{
    ProjectId = "ball",
    Predicate = new PredicateDef
    {
        Id = "stole",
        Label = "stole",
        Object = ObjectKind.Entity,
        Cardinality = Cardinality.Many,
    },
});
Response
{
  "id": "stole",
  "label": "stole",
  "object": "entity",
  "cardinality": "many"
}

Payload

FieldTypeDescription
projectIdrequiredstringThe project to write to.
predicaterequiredPredicateDefThe predicate: id, label, object (entity, value or none), cardinality (one or many) and optionally subjectTypes.

Result

FieldTypeDescription
idalwaysstringThe predicate’s id. Ids beginning with umwelt: are reserved.
labelalwaysstringHow it reads.
objectalways"entity" | "value" | "none"What its object is: an entity, a value, or none.
cardinalityalways"one" | "many"one makes it functional: one value per subject at a time. many allows several.
subjectTypesstring[]The entity types its subject may have. Absent: any.

Rules

Cardinality one is functional. A subject has one value at a time, so two values in the same slot are a contradiction (contradictions, check.utterance).

Reserved predicates. Ids beginning with umwelt: are built in: umwelt:member-of, umwelt:name, umwelt:title, umwelt:alias, umwelt:holds.

Defining it again is a no-op. The same definition returns it unchanged; a different one is a CONFLICT.

Errors

VALIDATION_FAILEDThe payload is malformed, or the id begins with umwelt:.
CONFLICTThe predicate exists with another definition. details.predicate has the stored one.
NOT_FOUNDThe project does not exist.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?