I have this scenario where each (source) Entity
has Properties
that have a target pointing to another Entity
. Those property mappings are grouped together. What I want to do is query those Entities that have specific properties with corresponding targets but are under the same group.
The hypergraph would like that (rectangles are the hyperedges):
The JSON
would look like that:
{
id: 1, label: "Entity",
propertyGroups: [
{
propertyGroupUuid: GroupUuid1,
property: {id: 1, label: "Property", name: "aName1"},
target: {id: 2, label: "Entity"}
},
{
propertyGroupUuid: GroupUuid2,
property: {id: 2, label: "Property", name: "aName2"},
target: {id: 3, label: "Entity"}
},
{
propertyGroupUuid: GroupUuid2,
property: {id: 3, label: "Property", name: "aName3"},
target: {id: 4, label: "Entity"}
}]
}
The flattest version of this in the graph database could look like that:
While the most expanded version of it could look like that:
So if I want to:
- get all
Entities
that haveProperty 2
andProperty 3
under the same PropertyGroupUuid "targeting"Entity 3
andEntity 4
respectively I should get backEntity 1
- get all
Entities
that haveProperty 1
andProperty 2
under the same PropertyGroupUuid "targeting"Entity 2
andEntity 3
respectively I should NOT get backEntity 1
How is it possible to do that with gremlin against the two versions of the graph and which one is more flexible/performant using the correct indices like the ones incorporated by DSE Graph? Are there better alternatives that I haven't thought of? If the answer is detailed and well explained I will give a bounty of at least 50 :)
Thank you!
I don't understand your first model with decoupled property nodes, but here's the traversal for model 2:
Not knowing anything about the data in your graph, it's hard to predict the performmance for this traversal. But in general, the performance should be okay if a) property names are indexed and b) the branching factor is low.