my question is not completely cayley-specific although i think that the solution for one graph database is not always the same for another so in that sense my question is related to cayley specifically.
how should i model my data using a graph database (specifically cayley)?
my initial thought is that i use the graph database to model relationships and maintain another database for the details of an entity - e.g. A views B is something modeled in a graph but A and B in the graph are simply identifiers that can be used to retrieve the full representations from another database. i've seen that some graph databases allow you to store arbitrary data on nodes and edges but if i'm not mistaken, cayley doesn't allow that. is that right?
this naive approach of mine leaves me struggling with how i can associate data with edges - e.g. A views B and i want to store the time that the viewing happened.
so, i'm wondering if my approach is fundamentally flawed and maybe i could get some help to shift my thinking to be more graph-oriented. i realize this is such a broad, general question and i'd be happy to be referred to sites, blogs, books, etc to read more about this.
thanks,
ben...
i'm having some success pursuing the idea of using CVTs to provide a way to store more descriptive data about a relationship.
i now want to follow up with a few more questions about manipulating data in a graph db.
* how should i approach updating data via the HTTP API? for example, let's say that i've got a person with predicates like height and weight and over time those values change so i want to update them. i'm assuming that i need to explicitly delete the quads that represent the current values and then write quads that represent the new values. if that's so, i have 2 pain points here
1. i need to know the previous values in order to delete them
2. updating is not atomic
do you already have something in mind for the future of cayley that may address these points?
* how do i easily delete an "entity"? continuing with the person example, if a person has predicates for height, weight, name, dob, and follows then it seems like currently i would need to query for all of those predicates to get the objects in order to be able to generate the necessary quads to delete those values. in addition, if the follows predicate was a CVT with predicates like follower, following, and, since_date then i would also need to query for those in order to delete them. i've seen https://github.com/google/cayley/issues/123 and the corresponding PR to try and move that forward and the thought just occurred to me that for the HTTP API maybe an MQL-based delete could be useful for describing which predicates to delete.
[{
"id": "/person/123",
"height": null,
"weight": null,
"name": null,
"dob": null,
"follows": [{ "follower": null, "following": null, "since_date": null }]
}]
in case i've got my head tied in knots and that MQL is something that seems like nonsense, the idea is that any quads matching the MQL query, would be deleted.
thanks for your help.
ben...