Hi László,
I found this site is very useful http://gremlindocs.com/
This is how I look for all paths between 2 vertices, with rids #21:7 and
#16:10
g.v('#21:7').as('person').both('RELATED').loop('person'){it.object.id.toString()
> != '#16:10' && it.loops < 4}.filter{it.id.toString()=='#16:10'}.path()
This is how java code looks like
OrientGraph graph =
> DatabaseManager.getInstance().getDatabase("remote:192.168.200.128/ePersona
> ").getConnection();
> Pipe pipe =
> Gremlin.compile("_().as('person').both('RELATED').loop('person'){it.object.id.toString()
> != '#16:10' && it.loops <
> 4}.filter{it.id.toString()=='#16:10'}.path()[10..20]");
> pipe.setStarts(new
> SingleIterator<Vertex>(graph.getVertex("#21:7")));
> Merger m = new Merger();
> Path paths = m.mergePathsResults(pipe);
> for(Object o : pipe) {
> ArrayList<Vertex> path = (ArrayList<Vertex>)o;
> for(Vertex v:path){
> System.out.print("->" + v.getProperty("name") + "[" +
> v.getProperty("@class") + "]");
> }
> System.out.println();
> }
example with weights you can find on gremlindocs site.
-Andrey
On 27 March 2014 01:44, László Rékasi <[email protected]> wrote:
> Hi,
>
> Thank you!
> Thought that it could not be easy :-) Meantime realized that there are
> nodes and egdes in chain :-) but not projected result sets like in rdbms
> world.
>
> Unfortunately I am not a developer, but a guy in business side with some
> it skill, so somehow I need to make it with out of the box solution to
> proof that it worth to spend time on it. So maybe javascript function can
> be the answer somehow.
>
> @Andrey, could you please share your use case and solution with me?
> Orientdb lacks of complete, step by step tutorial, or at least I did not
> find too many.
>
> Thx!
> L.
> 2014.03.27. 2:08 ezt írta ("Andrey Yesyev" <[email protected]>):
>
> Hi there,
>>
>> I have the similar problems. I solved them using Gremlin-Groovy.
>> I doubt you can do what you need using SQL.
>>
>>
>> -Andrey
>>
>> On Tuesday, March 25, 2014 3:58:06 PM UTC-4, László Rékasi wrote:
>>>
>>> Hi,
>>>
>>> I have the following datastructure (every entity has its own class):
>>> vertexes : vA, vB, vC, vD, vE
>>> there is eAB between vA and vB with one to many relation
>>> eBC between vB and vC with one to many relation
>>> eDC between vD and vC with one to many relation from D to C (so vC is a
>>> for resolving many to many between vB and vD, but having lots of properties)
>>> eED between vE and vD with one to many relation from E to D
>>>
>>> Now I would like to find vA and vD nodes where there is a path between
>>> with the following conditions and expectations:
>>>
>>> - I need the ID and some fields from both vA and vD
>>> - want to know the number of path between vA and vD
>>> - want to sum() some fields in vC as weight
>>> - want to filter on fields of all vertexes (vA.fld='X', vB.fld_b =
>>> 'Y', etc
>>>
>>> Basically the situation is something like:
>>> [person] - (having)->[user accounts]
>>> [user account]-(post)->[message]-(to)->[recepients' account]
>>> [recepient's account]-(belongs to)->[user]
>>>
>>> So want to know who sent messages in certain time to X type of user and
>>> how many times. Wants to know the first and last date. The sender belongs
>>> to Y domain.
>>> person.domain = 'Y'
>>> message.sent_date between D1 and D2
>>> user.type = 'hacker'
>>>
>>> I need it in SQL.
>>>
>>> Any suggestion is very appreciated!
>>> Thank you in advance!
>>> L.
>>>
>> --
>>
>> ---
>> 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/topic/orient-database/IKbefI2QA3M/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, 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 a topic in the
> Google Groups "OrientDB" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/orient-database/IKbefI2QA3M/unsubscribe.
> To unsubscribe from this group and all its topics, 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.