I'm having the same issue...

On Tuesday, February 10, 2015 at 11:00:44 AM UTC-5, Charles Bandes wrote:
>
> It's possible that I'm getting hung up by using the studio rather than the 
> console. The first query:
>
> select shortestPath(#11:35954, #11:65193, "Both")
>
>
> {
>     "result": [
>         {
>             "@type": "d",
>             "@rid": "#-2:1",
>             "@version": 0,
>             "shortestPath": [
>                 "#11:35954",
>                 "#11:37443",
>                 "#11:45856",
>                 "#11:57605",
>                 "#11:65193"
>             ],
>             "@fieldTypes": "shortestPath=z"
>         }
>     ],
>     "notification": "Query executed in 3.318 sec. Returned 1 record(s)"
> }
>
> The second returns nothing:
>
> select expand(shortestPath(#11:35954, #11:65193, "Both"))
>
> Query executed in 0.007 sec. Returned 0 record(s)
>
> But the more I think about it, the less it seems to matter since if I were 
> accessing the raw result I'd just access result[0].shortestPath to get the 
> array of @rids right?
>
> This leads me to a related question though - can shortestPath take 
> subqueries instead of @rids? I'd like to be able to write
>
> SELECT shortestPath((SELECT @rid FROM Character WHERE char_id = 10), (SELECT 
> @rid FROM Character WHERE char_id = 15), "Both")
>
> Or something like that. I tried with LET blocks but I couldn't get it to 
> work
>
> SELECT shortestPath($A, $B, "Both") LET $A = (SELECT @rid FROM Character 
> WHERE char_id = 1440), $B = (SELECT @rid FROM Character WHERE char_id = 
> 1443)
>
> That returns an empty array
>
> But 
> SELECT shortestPath(#11:35931, #11:35954, "Both")
> (which are the @rid for 1440 and 1443 respectively) returns:
>
> {
>     "result": [
>         {
>             "@type": "d",
>             "@rid": "#-2:1",
>             "@version": 0,
>             "shortestPath": [
>                 "#11:35931",
>                 "#11:35954"
>             ],
>             "@fieldTypes": "shortestPath=z"
>         }
>     ],
>     "notification": "Query executed in 0.007 sec. Returned 1 record(s)"
> }
>
>
> On Tuesday, February 10, 2015 at 10:44:05 AM UTC-5, Lvc@ wrote:
>>
>> Hi Charles,
>> Could you write the result of first query? By the way don't use FLATTEN 
>> (deprecated long time ago), but rather EXPAND ?
>>
>> Lvc@
>> ᐧ
>>
>> On 10 February 2015 at 16:15, Charles Bandes <[email protected]> 
>> wrote:
>>
>>> Hi Luca, is this still the preferred method? If I execute:
>>>
>>> select shortestPath(#11:35954, #11:65193, "Both")
>>>
>>> I get an object with five @rid as I'd expect but if I try
>>>
>>> select flatten(shortestPath(#11:35954, #11:65193, "Both"))
>>>
>>> I get no result at all
>>>
>>> On Monday, May 27, 2013 at 6:49:43 AM UTC-4, Lvc@ wrote:
>>>>
>>>> Hi,
>>>> these cases are resolved by the expand (ex flatten) function: Try this:
>>>>
>>>> select expand( shortestpath(#9:290, #9:298) )
>>>>
>>>> Lvc@
>>>>
>>>>
>>>> On 25 May 2013 14:38, venkat yanamandala <[email protected]> wrote:
>>>>
>>>>> Hi Luca,
>>>>>
>>>>> I am facing the same problem. I am using Orient DB 1.4.0 version. I 
>>>>> have written a SQL query to return the shortest path between the given 
>>>>> two 
>>>>> vertices.
>>>>> Here is the query:
>>>>>
>>>>> select shortestpath(#9:290, #9:298)
>>>>>
>>>>> It is returning ArrayList which consists of only one ODocument object. 
>>>>> If I introspect the result, I am able to see the result
>>>>> in the ODocument fields. 
>>>>>
>>>>> How should I write a query to get the list of Vertices/Edges in the 
>>>>> path.
>>>>>
>>>>> PS: I tried to invoke this from JAVA.
>>>>>
>>>>> Thanks,
>>>>> Venkat
>>>>>
>>>>>
>>>>> On Fri, Apr 26, 2013 at 3:10 AM, Luca Garulli <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> Hi Lucia,
>>>>>> the answer is on Stack Overflow ;-)
>>>>>>
>>>>>> Lvc@
>>>>>>
>>>>>>
>>>>>> On 25 April 2013 23:26, Lucía Pasarin <[email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am also new to OrientDB and I would like to use shortestPath() to 
>>>>>>> get the edges in the path. I have already asked it in Stack Overflow (
>>>>>>> http://stackoverflow.com/questions/16222813/get-
>>>>>>> visited-edges-in-orientdbs-shortestpath) so there you can see more 
>>>>>>> details about what I tried :)
>>>>>>>
>>>>>>> Thanks in advance!
>>>>>>>
>>>>>>> Lucía
>>>>>>>
>>>>>>>
>>>>>>> On Friday, 15 February 2013 10:07:07 UTC+1, Maigl Oeckchen wrote:
>>>>>>>>
>>>>>>>> Hello, 
>>>>>>>>
>>>>>>>> I'm really new to orient, I used the object/document side .. but 
>>>>>>>> now I want to dive into the graph world.
>>>>>>>> My use case involves a simple set of way points (vertex) connected 
>>>>>>>> by ways (edges) and of course I need to 
>>>>>>>> find the shortest path.
>>>>>>>>
>>>>>>>> But the 'select shortestpath(#8:0, #8:4)' functions seems to only 
>>>>>>>> give me the depth of the shortest path .. not the path itself.
>>>>>>>>
>>>>>>>> My Question: How do I get a list of vertices of the shortest path ?
>>>>>>>>
>>>>>>>> example:
>>>>>>>>
>>>>>>>> orientdb> traverse * from v
>>>>>>>>
>>>>>>>> ---+---------+--------------------
>>>>>>>>   #| RID     |out
>>>>>>>> ---+---------+--------------------
>>>>>>>>   0|     #8:0|[1]
>>>>>>>>   1|     #9:0|#8:0                |#8:1
>>>>>>>>   2|     #8:1|[2]                 |[1]
>>>>>>>>   3|     #9:1|#8:1                |#8:2
>>>>>>>>   4|     #8:2|[1]                 |[1]
>>>>>>>>   5|     #9:3|#8:2                |#8:3
>>>>>>>>   6|     #8:3|[1]                 |[1]
>>>>>>>>   7|     #9:4|#8:3                |#8:4
>>>>>>>>   8|     #8:4|null                |[2]
>>>>>>>>   9|     #9:2|#8:1                |#8:4
>>>>>>>> ---+---------+--------------------+--------------------
>>>>>>>>
>>>>>>>> 10 item(s) found. Traverse executed in 0.089 sec(s).
>>>>>>>>
>>>>>>>> orientdb> select shortestpath(#8:0, #8:4)
>>>>>>>>
>>>>>>>> ---+---------+--------------------
>>>>>>>>   #| RID     |shortestpath
>>>>>>>> ---+---------+--------------------
>>>>>>>>   0|    #-2:1|[3]
>>>>>>>> ---+---------+--------------------
>>>>>>>>
>>>>>>>> 1 item(s) found. Query executed in 0.056 sec(s).
>>>>>>>>
>>>>>>>> orientdb> select shortestpath(#8:0, #8:3)
>>>>>>>>
>>>>>>>> ---+---------+--------------------
>>>>>>>>   #| RID     |shortestpath
>>>>>>>> ---+---------+--------------------
>>>>>>>>   0|    #-2:1|[4]
>>>>>>>> ---+---------+--------------------
>>>>>>>>
>>>>>>>> 1 item(s) found. Query executed in 0.044 sec(s).
>>>>>>>>
>>>>>>> -- 
>>>>>>>  
>>>>>>> --- 
>>>>>>> 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/groups/opt_out.
>>>>>>>  
>>>>>>>  
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>>  
>>>>>> --- 
>>>>>> 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/groups/opt_out.
>>>>>>  
>>>>>>  
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Venkat Rao.Yanamandala 
>>>>>
>>>>> -- 
>>>>>  
>>>>> --- 
>>>>> 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/groups/opt_out.
>>>>>  
>>>>>  
>>>>>
>>>>
>>>> -- 
>>>
>>> --- 
>>> 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.
>>>
>>
>>

-- 

--- 
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.

Reply via email to