Apologies if I'm not clear, I'm new to graph databases & gremlin.
I'm using Azure Cosmos, which has some limitations. I can't use sack for example.
I've created a gremlify sample https://gremlify.com/v19w2qtiu3i/2.
If the starting vertex is above the vertex/edge in the traversal and the lower edge in the tree has hideFromParentLevels set to true, then I want to exclude it from the results. However if the starting vertex is at the level of the edge then I do want to include it.
In the sample query:
For "Head Office" I don't want to see "Area 3 NOT ABOVE" as the hideFromParentLevels is true in the edge
But if I swapped "Head Office" for "Saffron Walden" I do want to see it.
I hope the sample makes sense, please let me know if you have any questions!
For completeness here is the data:
g.addV('hierarchy').as('1').
property(single, 'name', 'Head Office').
property(single, 'type', 0).addV('hierarchy').
as('2').
property(single, 'name', 'Region 1').
property(single, 'type', 1).addV('hierarchy').
as('3').
property(single, 'name', 'Area 1').
property(single, 'type', 2).addV('hierarchy').
as('4').
property(single, 'name', 'Area 2').
property(single, 'type', 2).addV('hierarchy').
as('5').
property(single, 'name', 'Area 3').
property(single, 'type', 2).
addV('communication').as('6').
property(single, 'title', 'Communication A').
addV('hierarchy').as('7').
property(single, 'name', 'Saffron Walden').
property(single, 'type', 3).addV('hierarchy').
as('8').
property(single, 'name', 'Brighton').
property(single, 'type', 3).addV('hierarchy').
as('9').
property(single, 'name', 'St Albans').
property(single, 'type', 3).addV('hierarchy').
as('10').
property(single, 'name', 'Southend on Sea').
property(single, 'type', 3).addV('hierarchy').
as('11').
property(single, 'name', 'Cheltenham').
property(single, 'type', 3).addV('hierarchy').
as('12').
property(single, 'name', 'South Harrow').
property(single, 'type', 3).addV('hierarchy').
as('13').
property(single, 'name', 'Epsom').
property(single, 'type', 3).addV('hierarchy').
as('14').
property(single, 'name', 'Dorking').
property(single, 'type', 3).addV('hierarchy').
as('15').
property(single, 'name', 'Stevenage').
property(single, 'type', 3).
addV('communication').as('16').
property(single, 'title', 'Area 3 NOT ABOVE').
addE('child').from('1').to('2').addE('child').
from('2').to('4').addE('child').from('2').
to('5').addE('child').from('2').to('3').
addE('child').from('3').to('10').
addE('child').from('3').to('11').
addE('child').from('3').to('12').
addE('child').from('4').to('13').
addE('child').from('4').to('14').
addE('child').from('4').to('15').
addE('child').from('5').to('9').addE('child').
from('5').to('7').addE('child').from('5').
to('8').addE('audience').from('6').to('7').
property('hideFromParentLevels', false).
addE('audience').from('6').to('8').
property('hideFromParentLevels', false).
addE('audience').from('6').to('9').
property('hideFromParentLevels', false).
addE('audience').from('16').to('7').
property('hideFromParentLevels', true).
addE('audience').from('16').to('8').
property('hideFromParentLevels', true).
addE('audience').from('16').to('9').
property('hideFromParentLevels', true)
And here is my query:
g.V()
.has('name', 'Head Office')
.emit()
.repeat(__.out())
.in()
.hasLabel('communication')
.dedup()
.values('title')
I can filter on the hideFromParentLevels but not with a check on the vertex to see if the hierarchy is above or not.