Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion How to find something using the Java code Gremlin or Pipe
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
pShah  
View profile  
 More options May 8 2012, 12:32 am
From: pShah <pranav.shah....@gmail.com>
Date: Mon, 7 May 2012 21:32:10 -0700 (PDT)
Local: Tues, May 8 2012 12:32 am
Subject: Re: [TinkerPop] How to find something using the Java code Gremlin or Pipe

How do you specify the "filter" on "scatter"?

I tried multiple things before posting here, but I cannot solve it.

I wrote this small function which is called from inside the filter, but all
I know is the Object class, but no clue on how to work with it.

PipeFunction GetFilter = new PipeFunction<Object, Boolean>() {
            public Boolean compute(Object o) {
                System.out.println(o.getClass());
                    return false;
            }
        };

Output:  class java.util.HashMap$Entry

Almost everything I try to get the avle gives me a ClassCastException:
Exception in thread "main" java.lang.ClassCastException:
java.util.HashMap$Entry cannot be cast to java.util.Map

Please help.

On Monday, April 30, 2012 12:42:22 PM UTC-4, Marko A. Rodriguez wrote:

> Hi,

> > What I am trying to do is:

> > 1.  Find the vertices for 'marko', 'peter', and 'josh'
> > 2.  Find what they 'created' together.

> There are various ways to do this. First, lets get the vertices marko,
> peter, and josh using the default Vertex index.

> marko = g.idx(T.v)[[name:'marko']].next()
> peter = g.idx(T.v)[[name:'peter']].next()
> josh = g.idx(T.v)[[name:'josh']].next()

> -------------------------------------

> 1. No set intersection
>         * count the number of times a project is traversed too, if its
> been traversed to three times, it must have been created by all marko,
> peter, and josh.

> gremlin> [marko, peter,
> josh]._().out('created').groupCount.cap.scatter.filter{it.value ==
> 3}.transform{it.key}.name
> ==>lop

> 2. Set intersection
>         * intersect the projects that marko, josh, and peter have created
> --- note that this requires memory.

> gremlin>
> marko.out('created').toList().intersect(peter.out('created').toList()).inte rsect(josh.out('created').toList()).name

> ==>lop

> I'm sure there are other ways of attacking the problem. However, I believe
> this provides you the two extremes (data flow vs. set-based). If you come
> up with some new ways, please post them.

> Good luck,
> Marko.

> http://markorodriguez.com


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.