I'm trying to compose one query to get all incoming and outgoing vertices, including their edges and directions, which would however return those vertices without edges as well.
I was able to work around the problem for now by forcing everything to have at least one edge, but it's something I'd like to avoid.
Maybe worth noting that I use the Graph API of Azure CosmosDB: https://learn.microsoft.com/en-us/azure/cosmos-db/gremlin-support
This is the query I'm using to return all vertices with their edges and related vertices:
g.V().hasLabel('User').as('User').bothE().as('Edge').otherV().as('RelatedObject').path()
I got this from: Gremlin get all incoming and outgoing vertex, including their edges and directions
This query produces the result which I am able to easily parse in a C# application later, however this query doesn't return vertices which don't have edges.
Any ideas?
EDIT
The closest I've got is this:
g.V().hasLabel("User").as("User").map(bothE().otherV().fold()).as("RelatedObjects").select("User", "RelatedObjects")
However this approach doesn't display edges between User
and RelatedObjects
. I also need edges to be able to map these related objects to parent object properly.