How do i call apoc procedure from neo4j client .net?
I want to count all nodes
My query is:
"
CALL db.labels() YIELD label
CALL apoc.cypher.run('MATCH (:'+label+') RETURN count(*) as count',{}) YIELD value
RETURN label, value.count
"
Thanks
ok, I see that maybe you want to use the APOC methods so you can leverage the count store. If so, try the following. It will return a map containing each label and its count.
Map<String, Long> labelCountMap = neo4jClient
.query("""
CALL db.labels() YIELD label
CALL apoc.cypher.run('MATCH (:'+label+') RETURN count(*) as count',{}) YIELD value
RETURN label, value.count as cnt""")
.fetch()
.all()
.stream()
.collect(Collectors.toMap(
x -> (String) x.get("label"),
x -> (long) x.get("cnt")
));