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
| Field | Type | Description |
|---|---|---|
projectIdrequired | string | The project to write to. |
predicaterequired | PredicateDef | The predicate: id, label, object (entity, value or none), cardinality (one or many) and optionally subjectTypes. |
Result
| Field | Type | Description |
|---|---|---|
idalways | string | The predicate’s id. Ids beginning with umwelt: are reserved. |
labelalways | string | How 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. |
subjectTypes | string[] | 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?