hi there peform following cypher query counts how many nodes specified node has relationship , pass in nodename
in example.
here query:
start n=node:nameindex(name = "mike") match (n)-->(x) return n, count(*)
here attempt:
public ienumerable<versionnode> graphnodecount(string nodename) { graphquerylogger.trace("now entering graphnodecount(string nodename) method"); ienumerable<versionnode> queryresult = null; clientconnection = graphoperations.graphgetconnection(); var query = clientconnection .cypher .start(new cypherstartbitwithnodeindexlookup("n", "nameindex", "name", nodename)) .match("n", "-->", "x") .return<versionnode>("n, count(*)"); queryresult = query.results.tolist(); return queryresult; }
here main method:
graphquery graphquery = new graphquery(); var query = graphquery.graphnodecount("mike"); foreach (var item in query) { console.writeline(item.name); }
here stacktrace:
at system.threading.tasks.task.waitall(task[] tasks, int32 millisecondstimeout, cancellationtoken cancellationtoken) @ system.threading.tasks.task.waitall(task[] tasks, int32 millisecondstimeout) @ system.threading.tasks.task.waitall(task[] tasks) @ neo4jclient.graphclient.neo4jclient.irawgraphclient.executegetcypherresults[tresult](cypherquery query) @ neo4jclient.cypher.cypherfluentquery`1.get_results() @ contentmanager_test.contentmanager_library.level_1_api.graph.query.graphquery.graphnodecount(string nodename)
i nullreferenceexception unhandled
object reference not set instance of object. missing?
i think you're running old version of neo4jclient. think because a) don't have pdbs , b) it's not blowing nice error why can't use commands in return
calls that.
- please update neo4jclient
- if still crashes, post new stack trace https://bitbucket.org/readify/neo4jclient/issues/new can track , fix bug
these days, query should this:
var queryresults = clientconnection .cypher .start(new { n = node.byindexlookup("nameindex", "name", nodename) }) .match("n-->x") .return(n => new { foo = n.as<versionnode>(), countofallnodes = all.count() }) .results .tolist();
(note: i've typed out hand in textbox here, haven't tested it, should correct.)
Comments
Post a Comment