Dgraph: Store list of predicates per entity

Created on 6 Apr 2017  路  6Comments  路  Source: dgraph-io/dgraph

We should be able to store a list of all predicates corresponding to an entity. We can do so by having an internal predicate, say _edge_; where we can SET <entity> <_edge_> "pred"@ts .. This would allow us to query all the predicates corresponding to one entity; which would then allow various sort of queries required by users.

kinfeature

Most helpful comment

Pasting the discussion we had on slack.

mrjn [11:19 AM]
Conclusion: We can store (internal-pred, node) -> (list of predicate values). This would require storing a list of values; which is what @tzdybal has sort of already done; we just need to extend that.

janardhan [11:22 AM]
Yep, for each mutation we would need to send list of (sub, pred) pairs to the server serving internal-pred predicate.
If a user wants to expand on a node, we would query (internal-pred, node) pl right ?

mrjn [11:22 AM]
yeah.

[11:22]
And we'd need to modify the query lang, so we can do that lookup for preds, and expansion on those preds in the same query.

All 6 comments

It you are able to store all the predicates for a given entity, would it make sense to implement the deletion of all predicates for a given entity to simulate deleting a node?

Yes, we could do it then.

Pasting the discussion we had on slack.

mrjn [11:19 AM]
Conclusion: We can store (internal-pred, node) -> (list of predicate values). This would require storing a list of values; which is what @tzdybal has sort of already done; we just need to extend that.

janardhan [11:22 AM]
Yep, for each mutation we would need to send list of (sub, pred) pairs to the server serving internal-pred predicate.
If a user wants to expand on a node, we would query (internal-pred, node) pl right ?

mrjn [11:22 AM]
yeah.

[11:22]
And we'd need to modify the query lang, so we can do that lookup for preds, and expansion on those preds in the same query.

This can be done now 509c28d2f6b36bb345cea0499dd8dfd77111df33
_predicate_ returns the list of predicates.
expand(_all_) helps in expanding on all the predicates.

@ashwin95r Does 509c28d allow the deletion of nodes without the subject and predicate?

For example:

mutation {
  delete {
     <0xf11168064b01135b> .
  }
}

Not yet @F21. I'll create a new issue for that. Though we support S P * deletion if that helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KadoBOT picture KadoBOT  路  5Comments

jeffkhull picture jeffkhull  路  3Comments

jerodsanto picture jerodsanto  路  3Comments

xhochipe picture xhochipe  路  3Comments

yupengfei picture yupengfei  路  4Comments