Skip to content

Assign single UID to predicate #1519

@calummoore

Description

@calummoore

As posted on the community forum:

It would be useful to be able to assign a uid to a predicate directly without adding it to a Posting List. For example, I might have a predicate teacher, where it is only ever possible to have one teacher at a time.

At the moment I would have to do the following to update the predicate, which means 2 round trips and is unnecessarily verbose.

mutation {
  delete  {
    <0x4> teacher * .
  }
}

mutation {
  set {
    <0x4> teacher <0x9> .
  }
}

Ideally, you would want to be able to specify in the schema that that predicate only accepts a single uid.

mutation {
  schema {
    teacher: uid @unary
  }
}

It would also have the added benefit of being able to return an object instead of an array when the unary predicate is being queried, as it would know there could only ever be one node/object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureSomething completely new we should consider.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions