You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by pieter-gmail <pi...@gmail.com> on 2015/03/22 20:58:00 UTC

GraphTraversal from Vertex or Element

Hi,

I have just started looking at the recent changes regarding GraphTraversal.

If I understand correctly all traversal code, previously written from an 
Element using the Traversal api is now to be replaced with,

Vertex v = xxx;
graph.traversal().V(xxx.id()).outE("knows")...

My issue is that this is causing the element to be reloaded which is 
unnecessary.

Is there some other way to continue a traversal without accessing the 
vertex again with its id.

Thanks
Pieter

Re: GraphTraversal from Vertex or Element

Posted by pieter-gmail <pi...@gmail.com>.
Ok,
Thanks
Pieter


On 23/03/2015 16:05, Marko Rodriguez wrote:
> Hello,
>
> I just haven't written a more optimal GraphStep implementation, but the API is what you are looking for. If you want to provide a pull request, please do.
>
> Thanks,
> Marko.
>
> http://markorodriguez.com
>
> On Mar 23, 2015, at 7:59 AM, pieter-gmail <pi...@gmail.com> wrote:
>
>> Hi,
>>
>> I tried that, GraphStep indeed does have some logic, but precisely to convert the element to an id.
>>
>> In the constructor...
>>
>> for(inti =0;i <this.ids.length;i++) {
>>     if(this.ids[i]instanceofElement)
>>         this.ids[i] = ((Element)this.ids[i]).id();
>> }
>>
>>
>> Cheers
>> Pieter
>>
>> On 23/03/2015 15:36, Marko Rodriguez wrote:
>>> Hi,
>>>
>>> You just do:
>>>
>>> 	g.V(v).
>>>
>>> GraphStep will know its a "vertex" and not an "id."
>>>
>>> HTH,
>>> Marko.
>>>
>>> http://markorodriguez.com
>>>
>>> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Looking at it some more, how about,
>>>>
>>>> GraphTraversalSource. fromV(final Vertex vertex)
>>>>
>>>> and a
>>>>
>>>> VertexStartStep
>>>>
>>>> Cheers
>>>> Pieter
>>>>
>>>>
>>>> On 22/03/2015 21:58, pieter-gmail wrote:
>>>>> Hi,
>>>>>
>>>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>>>
>>>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>>>
>>>>> Vertex v = xxx;
>>>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>>>
>>>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>>>
>>>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>>>
>>>>> Thanks
>>>>> Pieter
>


Re: GraphTraversal from Vertex or Element

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi Pieter,

Nice PR. Thanks. Merged.

Marko.

http://markorodriguez.com

On Mar 26, 2015, at 3:53 PM, Marko Rodriguez <ok...@gmail.com> wrote:

> Hi,
> 
> I like the idea of either all elements or all ids.
> 
> If you make a JIRA ticket for that, that would be appreciated.
> 
> Thank you,
> Marko.
> 
> http://markorodriguez.com
> 
> On Mar 26, 2015, at 10:57 AM, pieter-gmail <pi...@gmail.com> wrote:
> 
>> Hi,
>> 
>> I am working on implementing this.
>> 
>> Do we want to insist that the ids array is either Elements or ids or can it be mixed ids and Elements?
>> 
>> For now I am going with its either ids or elements and will throw an exception when its mixed.
>> 
>> Thanks
>> Pieter
>> 
>> On 23/03/2015 16:05, Marko Rodriguez wrote:
>>> Hello,
>>> 
>>> I just haven't written a more optimal GraphStep implementation, but the API is what you are looking for. If you want to provide a pull request, please do.
>>> 
>>> Thanks,
>>> Marko.
>>> 
>>> http://markorodriguez.com
>>> 
>>> On Mar 23, 2015, at 7:59 AM, pieter-gmail <pi...@gmail.com> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I tried that, GraphStep indeed does have some logic, but precisely to convert the element to an id.
>>>> 
>>>> In the constructor...
>>>> 
>>>> for(inti =0;i <this.ids.length;i++) {
>>>>    if(this.ids[i]instanceofElement)
>>>>        this.ids[i] = ((Element)this.ids[i]).id();
>>>> }
>>>> 
>>>> 
>>>> Cheers
>>>> Pieter
>>>> 
>>>> On 23/03/2015 15:36, Marko Rodriguez wrote:
>>>>> Hi,
>>>>> 
>>>>> You just do:
>>>>> 
>>>>> 	g.V(v).
>>>>> 
>>>>> GraphStep will know its a "vertex" and not an "id."
>>>>> 
>>>>> HTH,
>>>>> Marko.
>>>>> 
>>>>> http://markorodriguez.com
>>>>> 
>>>>> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> Looking at it some more, how about,
>>>>>> 
>>>>>> GraphTraversalSource. fromV(final Vertex vertex)
>>>>>> 
>>>>>> and a
>>>>>> 
>>>>>> VertexStartStep
>>>>>> 
>>>>>> Cheers
>>>>>> Pieter
>>>>>> 
>>>>>> 
>>>>>> On 22/03/2015 21:58, pieter-gmail wrote:
>>>>>>> Hi,
>>>>>>> 
>>>>>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>>>>> 
>>>>>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>>>>> 
>>>>>>> Vertex v = xxx;
>>>>>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>>>>> 
>>>>>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>>>>> 
>>>>>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>>>>> 
>>>>>>> Thanks
>>>>>>> Pieter
>>> 
>> 
> 


Re: GraphTraversal from Vertex or Element

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi,

I like the idea of either all elements or all ids.

If you make a JIRA ticket for that, that would be appreciated.

Thank you,
Marko.

http://markorodriguez.com

On Mar 26, 2015, at 10:57 AM, pieter-gmail <pi...@gmail.com> wrote:

> Hi,
> 
> I am working on implementing this.
> 
> Do we want to insist that the ids array is either Elements or ids or can it be mixed ids and Elements?
> 
> For now I am going with its either ids or elements and will throw an exception when its mixed.
> 
> Thanks
> Pieter
> 
> On 23/03/2015 16:05, Marko Rodriguez wrote:
>> Hello,
>> 
>> I just haven't written a more optimal GraphStep implementation, but the API is what you are looking for. If you want to provide a pull request, please do.
>> 
>> Thanks,
>> Marko.
>> 
>> http://markorodriguez.com
>> 
>> On Mar 23, 2015, at 7:59 AM, pieter-gmail <pi...@gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> I tried that, GraphStep indeed does have some logic, but precisely to convert the element to an id.
>>> 
>>> In the constructor...
>>> 
>>> for(inti =0;i <this.ids.length;i++) {
>>>    if(this.ids[i]instanceofElement)
>>>        this.ids[i] = ((Element)this.ids[i]).id();
>>> }
>>> 
>>> 
>>> Cheers
>>> Pieter
>>> 
>>> On 23/03/2015 15:36, Marko Rodriguez wrote:
>>>> Hi,
>>>> 
>>>> You just do:
>>>> 
>>>> 	g.V(v).
>>>> 
>>>> GraphStep will know its a "vertex" and not an "id."
>>>> 
>>>> HTH,
>>>> Marko.
>>>> 
>>>> http://markorodriguez.com
>>>> 
>>>> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>>>> 
>>>>> Hi,
>>>>> 
>>>>> Looking at it some more, how about,
>>>>> 
>>>>> GraphTraversalSource. fromV(final Vertex vertex)
>>>>> 
>>>>> and a
>>>>> 
>>>>> VertexStartStep
>>>>> 
>>>>> Cheers
>>>>> Pieter
>>>>> 
>>>>> 
>>>>> On 22/03/2015 21:58, pieter-gmail wrote:
>>>>>> Hi,
>>>>>> 
>>>>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>>>> 
>>>>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>>>> 
>>>>>> Vertex v = xxx;
>>>>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>>>> 
>>>>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>>>> 
>>>>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>>>> 
>>>>>> Thanks
>>>>>> Pieter
>> 
> 


Re: GraphTraversal from Vertex or Element

Posted by pieter-gmail <pi...@gmail.com>.
Hi,

I am working on implementing this.

Do we want to insist that the ids array is either Elements or ids or can 
it be mixed ids and Elements?

For now I am going with its either ids or elements and will throw an 
exception when its mixed.

Thanks
Pieter

On 23/03/2015 16:05, Marko Rodriguez wrote:
> Hello,
>
> I just haven't written a more optimal GraphStep implementation, but the API is what you are looking for. If you want to provide a pull request, please do.
>
> Thanks,
> Marko.
>
> http://markorodriguez.com
>
> On Mar 23, 2015, at 7:59 AM, pieter-gmail <pi...@gmail.com> wrote:
>
>> Hi,
>>
>> I tried that, GraphStep indeed does have some logic, but precisely to convert the element to an id.
>>
>> In the constructor...
>>
>> for(inti =0;i <this.ids.length;i++) {
>>     if(this.ids[i]instanceofElement)
>>         this.ids[i] = ((Element)this.ids[i]).id();
>> }
>>
>>
>> Cheers
>> Pieter
>>
>> On 23/03/2015 15:36, Marko Rodriguez wrote:
>>> Hi,
>>>
>>> You just do:
>>>
>>> 	g.V(v).
>>>
>>> GraphStep will know its a "vertex" and not an "id."
>>>
>>> HTH,
>>> Marko.
>>>
>>> http://markorodriguez.com
>>>
>>> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> Looking at it some more, how about,
>>>>
>>>> GraphTraversalSource. fromV(final Vertex vertex)
>>>>
>>>> and a
>>>>
>>>> VertexStartStep
>>>>
>>>> Cheers
>>>> Pieter
>>>>
>>>>
>>>> On 22/03/2015 21:58, pieter-gmail wrote:
>>>>> Hi,
>>>>>
>>>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>>>
>>>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>>>
>>>>> Vertex v = xxx;
>>>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>>>
>>>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>>>
>>>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>>>
>>>>> Thanks
>>>>> Pieter
>


Re: GraphTraversal from Vertex or Element

Posted by Marko Rodriguez <ok...@gmail.com>.
Hello,

I just haven't written a more optimal GraphStep implementation, but the API is what you are looking for. If you want to provide a pull request, please do.

Thanks,
Marko.

http://markorodriguez.com

On Mar 23, 2015, at 7:59 AM, pieter-gmail <pi...@gmail.com> wrote:

> Hi,
> 
> I tried that, GraphStep indeed does have some logic, but precisely to convert the element to an id.
> 
> In the constructor...
> 
> for(inti =0;i <this.ids.length;i++) {
>    if(this.ids[i]instanceofElement)
>        this.ids[i] = ((Element)this.ids[i]).id();
> }
> 
> 
> Cheers
> Pieter
> 
> On 23/03/2015 15:36, Marko Rodriguez wrote:
>> Hi,
>> 
>> You just do:
>> 
>> 	g.V(v).
>> 
>> GraphStep will know its a "vertex" and not an "id."
>> 
>> HTH,
>> Marko.
>> 
>> http://markorodriguez.com
>> 
>> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>> 
>>> Hi,
>>> 
>>> Looking at it some more, how about,
>>> 
>>> GraphTraversalSource. fromV(final Vertex vertex)
>>> 
>>> and a
>>> 
>>> VertexStartStep
>>> 
>>> Cheers
>>> Pieter
>>> 
>>> 
>>> On 22/03/2015 21:58, pieter-gmail wrote:
>>>> Hi,
>>>> 
>>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>> 
>>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>> 
>>>> Vertex v = xxx;
>>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>> 
>>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>> 
>>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>> 
>>>> Thanks
>>>> Pieter
>> 
> 


Re: GraphTraversal from Vertex or Element

Posted by pieter-gmail <pi...@gmail.com>.
Hi,

I tried that, GraphStep indeed does have some logic, but precisely to 
convert the element to an id.

In the constructor...

for(inti =0;i <this.ids.length;i++) {
     if(this.ids[i]instanceofElement)
         this.ids[i] = ((Element)this.ids[i]).id();
}


Cheers
Pieter

On 23/03/2015 15:36, Marko Rodriguez wrote:
> Hi,
>
> You just do:
>
> 	g.V(v).
>
> GraphStep will know its a "vertex" and not an "id."
>
> HTH,
> Marko.
>
> http://markorodriguez.com
>
> On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:
>
>> Hi,
>>
>> Looking at it some more, how about,
>>
>> GraphTraversalSource. fromV(final Vertex vertex)
>>
>> and a
>>
>> VertexStartStep
>>
>> Cheers
>> Pieter
>>
>>
>> On 22/03/2015 21:58, pieter-gmail wrote:
>>> Hi,
>>>
>>> I have just started looking at the recent changes regarding GraphTraversal.
>>>
>>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>>>
>>> Vertex v = xxx;
>>> graph.traversal().V(xxx.id()).outE("knows")...
>>>
>>> My issue is that this is causing the element to be reloaded which is unnecessary.
>>>
>>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>>>
>>> Thanks
>>> Pieter
>


Re: GraphTraversal from Vertex or Element

Posted by Marko Rodriguez <ok...@gmail.com>.
Hi,

You just do:

	g.V(v).

GraphStep will know its a "vertex" and not an "id."

HTH,
Marko.

http://markorodriguez.com

On Mar 22, 2015, at 2:31 PM, pieter-gmail <pi...@gmail.com> wrote:

> Hi,
> 
> Looking at it some more, how about,
> 
> GraphTraversalSource. fromV(final Vertex vertex)
> 
> and a
> 
> VertexStartStep
> 
> Cheers
> Pieter
> 
> 
> On 22/03/2015 21:58, pieter-gmail wrote:
>> Hi,
>> 
>> I have just started looking at the recent changes regarding GraphTraversal.
>> 
>> If I understand correctly all traversal code, previously written from an Element using the Traversal api is now to be replaced with,
>> 
>> Vertex v = xxx;
>> graph.traversal().V(xxx.id()).outE("knows")...
>> 
>> My issue is that this is causing the element to be reloaded which is unnecessary.
>> 
>> Is there some other way to continue a traversal without accessing the vertex again with its id.
>> 
>> Thanks
>> Pieter
> 


Re: GraphTraversal from Vertex or Element

Posted by pieter-gmail <pi...@gmail.com>.
Hi,

Looking at it some more, how about,

GraphTraversalSource. fromV(final Vertex vertex)

and a

VertexStartStep

Cheers
Pieter


On 22/03/2015 21:58, pieter-gmail wrote:
> Hi,
>
> I have just started looking at the recent changes regarding 
> GraphTraversal.
>
> If I understand correctly all traversal code, previously written from 
> an Element using the Traversal api is now to be replaced with,
>
> Vertex v = xxx;
> graph.traversal().V(xxx.id()).outE("knows")...
>
> My issue is that this is causing the element to be reloaded which is 
> unnecessary.
>
> Is there some other way to continue a traversal without accessing the 
> vertex again with its id.
>
> Thanks
> Pieter