Single UID assigned to predicate


(Calum Moore) #1

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, 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 have the added benefit of being able to return an object instead of an array when the predicate is being queried, as it would know there could only ever be one object.


(janardhan reddy) #2

Hey,
@calummoore Can you please file an issue on github for the same.


(Calum Moore) #3

Sure :slight_smile:


(system) #4

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.