Reporting back, I came up with the following query that does what I need:
m = [:];
g.idx(user).get(key, %query%*)._()[0..5].sideEffect { x = it.key
}.out.in.uniqueObject.loop(3) { it.loops 2 }.sideEffect {
if (!m[x]) { m[x] = 0; };
m[x]++
} -1;
m;
* I didn't use mapWithDefault because I'm
Hey,
m = [:];
g.idx(user).get(key, %query%*)._()[0..5].sideEffect { x = it.key
}.out.in.uniqueObject.loop(3) { it.loops 2 }.sideEffect {
if (!m[x]) { m[x] = 0; };
m[x]++
} -1;
m;
Tips:
1. do g.idx(user).get(key, %query%*)[0..5]
- _() is not needed.
2.
._().both.groupCount(m).loop(2){it.loops depth}
m.size()
- James
--
View this message in context:
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Aggregate-queries-tp3317720p3317876.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com
+
*)
However, I am not sure/can't remember if you can do a wildcard query without
at least one leading character.
- James
--
View this message in context:
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Aggregate-queries-tp3317720p3319768.html
Sent from the Neo4j Community
Hey,
Won't this count dupes more than once?
Xavier's requirements of how many other nodes are they connected sounds
like you should only count uniques, and that's why I am checking the size of
groupCount map instead of using count(). Instead of a map you could use a
Set with aggregate(),
Thanks everyone, this gives me plenty to work with. Will report back.
On Thu, Sep 8, 2011 at 7:03 AM, Marko Rodriguez okramma...@gmail.comwrote:
Hey,
Won't this count dupes more than once?
Xavier's requirements of how many other nodes are they connected sounds
like you should only
Hello,
Is there an effective way to run aggregate queries over neo4j database? I'm
currently running a stock install of the REST server, and want to answer
questions like:
For all nodes in a particular index, how many other nodes are they
connected to at depth X?
Currently I have a script that
Xavier,
I would put the load on the server side by either scripting something
with Gremlin, http://docs.neo4j.org/chunked/snapshot/gremlin-plugin.html
or write a Server Plugin taking your parameters and do the heavy
lifting in Java,
http://docs.neo4j.org/chunked/snapshot/server-plugins.html
Would
(index_name).get(index_key,Neo4jTokens.QUERY_HEADER +
*).
index_nodes._().both.groupCount(m).loop(2){it.loops depth}
m.size()
- James
--
View this message in context:
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Aggregate-queries-tp3317720p3317876.html
Sent from the Neo4j Community
9 matches
Mail list logo