I've been using OrientDB SQL with Gremlin and it's been a huge help,
especially that I can also test queries in Orient Studio.
However, I'm running into problems when it comes to passing in an input
variable. The docs gave this example:
Map<String, Object> params = new HashMap<String, Object>();
params.put("map1", new HashMap());
params.put("map2", new HashMap());
db.command(new OCommandSQL("select
gremlin('current.as('id').outE.label.groupCount(map1).optional('id').sideEffect{map2=it.map();map2+=map1;}')")).execute(params);
In my own use case in scala, I tried passing in an OrientVertex as a
variable like so ("player"):
val params = new util.HashMap[String, Object]()
params.put("player", player)
session.graph.asInstanceOf[OrientTransactionalGraph].command(
new OCommandSQL(s"""SELECT
EXPAND(gremlin('current.in("PresentIn").retain(player.both("FriendOf"))')) FROM
Location WHERE lid = 'home'""")
).execute(params).asInstanceOf[Iterable[Vertex]]
The basic jist of the above query is "Give me all the friends ('FriendOf'
edge) of 'player' who are in a given location (lid = 'home')". Or more
specifically "Get me all the nodes connected to the current location with a
'PresentIn' edge, and only retain those that are connected to 'player' with
a 'FriendOf' edge.
Is passing in a vertex a no-no? Is there a way to look up the vertex I want
within the retain pattern? Is there a way to do this just with OrientDB SQL?
Any input would be a big help! Thanks!
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.