Thanks a lot for examples. As I understand Blueprints does not allow me to write that kind of queries. I probably won't go with Blueprints until OrientDB implementation of GremlinPipeline doesn't appear.
The best approach is to use sql-like queries: database.command(new OCommandSQL(sqlString)).execute(parameters); I think it also performs well. On Friday, 11 July 2014 12:00:29 UTC+1, Lvc@ wrote: > > Hi Andrey, > My responses below. > > On 11 July 2014 01:17, Andrey Kovalev <[email protected] <javascript:>> > wrote: > >> First of all I've already tried to google for a solution but without any >> luck. >> I have a simple relation: User->owns->Group. I want to check that a >> particular group really belongs to a particular user. >> I am trying to run this query: >> >> final Vertex groupVx = database.getVertex(groupId); >> long count = groupVx.query().direction(Direction.IN).labels("owns"). >> labels("User").has("@rid", userId); >> >> >> 1. The query above fails, because User is not an edge. Is it possible >> to fix the query above to get a desired result using Blueprints? >> >> Try this solution: > > long count = 0; > for( OrientVertex v : groupVx.getVertices(Direction.IN, "owns") ){ > if( v.getIdentity().equals(userId) ) > count++; > } > > Or even this: > > boolean isPresent = groupVx.command(new OSQLPredicate(userId + " in > out('owns'))); > > >> >> 1. Am I right that GremlinPipeline is implemented by Tinkerpop and >> all queries are done in-memory without using native query syntax of >> OrientDB? >> >> Gremlin works on top of Blueprints that most of the times (depends by > many things) translates query in OrientDB SQL, the rest works in memory by > fetching vertices and edges from OrientDB. > > Lvc@ > > >> >> >> -- >> >> --- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- 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.
