I am new to the graph databases and Gremlin. What I am trying to achieve is to ask a simple question to the database. Provided id of the Entity and id of the File, I want to find all other entites who have access to this file via the Share and return the result with the property "type" of the share. Here is the graph itself:
What I tried:
g.V("Enity:1").out("Created").hasLabel("Share").where(out("Shared").hasId("File:1")).in("Access").path()
This returns me:
[
{
//Omitted empty aray
"objects": [
{
"id": "dseg:/Entity/1",
"label": "Entity",
"type": "vertex",
"properties": {}
},
{
"id": "dseg:/Share/1",
"label": "Share",
"type": "vertex",
"properties": {}
},
{
"id": "dseg:/Entity/1",
"label": "Entity",
"type": "vertex",
"properties": {}
}
]
},
{
//Omitted empty aray
"objects": [
{
"id": "dseg:/Entity/1",
"label": "Entity",
"type": "vertex",
"properties": {}
},
{
"id": "dseg:/Share/1",
"label": "Share",
"type": "vertex",
"properties": {}
},
{
"id": "dseg:/Entity/3",
"label": "Entity",
"type": "vertex",
"properties": {}
}
]
}
]
It shows the path taken from the entry point(Entity:1) to the target(s) Entity 2 and 3
My question with technical details: Is there a way to start gathering path() after Entity:1 or intermediate verticle I chose, so that in result I will get only Share + Entity who has Access to it?
You just need to tell path step where to start from. You can do something like this:
Another way to do this is :