I have a query which needs to satisfy some criteria which works well at the moment. The problem is that I'm also trying to include its incoming and outgoing edges to the response as below.
{
"id": "ba872479-90be-4478-b54b-00ea6540fb23",
"label": "link",
"type": "vertex",
"properties": {
ListOfIncomingVerticesForThisObject: [],
ListOfOutgoingVerticesForThisObject: [],
"state": [
{
"id": "71d5c4e5-e89f-424b-9894-af1177ea2294",
"value": 1
}
],
"title": [
{
"id": "024fde3e-70ce-4d15-8ba1-92e488ffa36e",
"value": "Some title"
}
],
"modified": [
{
"id": "6cb6e49f-16a8-4308-af41-8b68b14d3d97",
"value": "2021-02-01"
}
]
}
}
So far this is my query (I have omitted some info for obvious reasons)
g.V().
hasLabel('link').
has("created", between("2020-03-15", "2022-03-15")).
has("path", TextP.containing("sometext")).
has('type', within('some types')).
has('domain', within('domain.com')).
fold().as('files', 'count').
select('files', 'count').by(range(local, 0, 1000)).by(count(local))
How can I add the incoming and outgoing vertices to this request?
I'm not sure if CosmosDB supports all these Gremlin steps, but trying to keep with the query formulation you already have, using some sample data from a graph I had handy, the desired result can be achieved using:
which gives
The
unfoldat the end is just to aid readability a little. In general I would look for other query patterns that avoid doing thefoldso early in the query. Perhaps using agroupstep or even two nestedgroups.