You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are trying to convert the Neo4j cypher query into a Gremlin query, but we are stuck on some extract methods in the cypher query that need to be converted into the Gremlin query.
The cypher query that we are trying to convert is as follows:
MATCH (from: `Person` {title: "John"}), (to: `Location` {title: "New York City"})
MATCH p = (from)-[rel*..5]->(to)
RETURN extract(x IN nodes(p) | x.title) as title,
extract(i IN relationships(p)| type(i)) as relation,
extract(j IN nodes(p) | j.nt) as node,
length(p) as len,
extract(x IN nodes(p) | x) as node_data,
extract (i in nodes(p)| id(i)) as id,
extract(i IN relationships(p)| id(i)) as rel_id,
extract(rel IN relationships(p) | id(startNode(rel))) as start,
extract(rel IN relationships(p) | id(endNode(rel))) as end
Output of the above query as follow:
[
{
"title": ["John", "new york city"], // 'title' is property of the vertices
"relation": ["WORKIGN_AT"], // Edge label between 'person' and 'location'
"node": ["Person", "Location"], // List of labels
"len": 1, // Node hop between two node label
"node_data": [ // List of node property data (valueMap())
{
"Employee_Status": "Active",
"FT_or_PT": "Full Time",
"title": "john"
},
{
"Office_Type": "Headquarters",
"Mailing_Code": 10022,
"ISO_Alpha_Two_Country_Code": "US",
"City": "New York",
"title": "New York City",
"Display": "New York City",
"Name": "New York City"
}
],
"id": [5432,5125], // List of node id in the hopes
"rel_id": [17409], // list of edge id in the hopes
"start": [5432], // id of from nodes in the hopes
"end": [5125] // id of to nodes in the l
}
]
I'm looking for a Gremlin query that can effectively replace the extract method for Neo4j and produce the same output. Your insights would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We are trying to convert the Neo4j cypher query into a Gremlin query, but we are stuck on some extract methods in the cypher query that need to be converted into the Gremlin query.
The cypher query that we are trying to convert is as follows:
Output of the above query as follow:
I'm looking for a Gremlin query that can effectively replace the extract method for Neo4j and produce the same output. Your insights would be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions