Hi Steve,

Try this

SELECT expand(person) FROM (
  MATCH {class: Person, as: person, where: (givenname =
'William')}.in(){while: ($depth = 0 OR givenname != 'George'), where:
(givenname = 'George')} RETURN person
)

The $depth = 0 guarantees that you don't stop traversing immediately;
the givenname
!= 'George' just stops traversing as soon as you find a "George", I guess
it is what you want (you don't need duplicates)

Thanks

Luigi

2018-03-13 14:52 GMT+01:00 Steven Tomer <steven.to...@gmail.com>:

> Hello Luigi,
>
> That's sad news indeed.  It will require a major task to rip out all of
> the places we're using traverse().
>
> I've been playing around with the MATCH operator, and I can't get it to
> model the former query:
>
> SELECT FROM Person WHERE givenname = 'William' and in traverse(0,-1,'in')
> ( givenname = 'George' )
>
> I've tried:
>
> MATCH {class: Person, as: person, where: (givenname =
> 'William')}.in(){while: ($depth > 0), where: (givenname = 'George')} RETURN
> person
> MATCH {class: Person, as: person, where: (givenname =
> 'William')}.in('in'){while: ($depth > 0), where: (givenname = 'George')}
> RETURN person
> MATCH {class: Person, as: person, where: (givenname =
> 'William')}.in('MyEdge'){while: ($depth > 0), where: (givenname =
> 'George')} RETURN person
>
> None of your examples have an intermediary 'edge' type between them.  We
> have Person -> MyEdge -> Person -> MyEdge -> Person.  The traverse
> operator lets me hop over the edges.  How do you do it with MATCH?
>
> Steve
>
>
>
> On Tue, Mar 13, 2018 at 2:07 AM, Luigi Dell'Aquila <
> luigi.dellaqu...@gmail.com> wrote:
>
>> Hi Steven,
>>
>> The traverse() operator was deprecated long time ago and is not fully
>> supported anymore.
>> I strongly suggest you to use TRAVERSE queries (
>> https://orientdb.com/docs/2.2.x/SQL-Traverse.html) or even better MATCH
>> queries (https://orientdb.com/docs/2.2.x/SQL-Match.html)
>>
>> Another thing: if you are migrating now, you could probably consider v
>> 3.0 (see https://orientdb.com/orientdb-labs/), the final GA will be
>> released this week
>>
>> Thanks
>>
>> Luigi
>>
>>
>> 2018-03-12 23:00 GMT+01:00 StevenTomer <steven.to...@gmail.com>:
>>
>>> Hello,
>>>
>>> I'm using OrientDB 2.2.32.  We're updating our software from 2.0.8.
>>>
>>> The traverse() operator in selects does not appear to be working.
>>>
>>> When I run the attached program, I get a com.orientechnologies.orient
>>> .core.sql.OCommandSQLParsingException.
>>>
>>> Exception in thread "main" com.orientechnologies.orient.c
>>> ore.sql.OCommandSQLParsingException: Error parsing query:
>>> SELECT FROM Person WHERE givenname = 'William' and in
>>> traverse(0,-1,'in') ( givenname = 'George' )
>>>                                                     ^
>>> Encountered "" at line 1, column 52.
>>> Was expecting one of:
>>>
>>> DB name="familytree"
>>>
>>> I hope it hasn't been removed.  We use both the TRAVERSE FROM and
>>> SELECT FROM WHERE traverse() extensively.
>>>
>>> TRAVERSE FROM is wonderful for gathering a group of records from a given
>>> point.
>>> The traverse() operator is wonderful for queries like the above (return
>>> all people named William
>>> descended from a person named George.
>>>
>>> We really need both.
>>>
>>> Thanks,
>>>
>>> Steven Tomer
>>>
>>> --
>>>
>>> ---
>>> 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 orient-database+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "OrientDB" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/orient-database/ic5UE-kyi-w/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> orient-database+unsubscr...@googlegroups.com.
>> 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 orient-database+unsubscr...@googlegroups.com.
> 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 orient-database+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to