Skip to content
SepiaGroup edited this page Dec 9, 2011 · 2 revisions

Home > Cypher Index

  1. Count nodes
  2. Group Count Relationship Types
  3. Count entities
  4. Count non null values
  5. SUM
  6. AVG
  7. MAX
  8. MIN
  9. COLLECT
  10. DISTINCT

1. Count nodes

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2));
cypher.Match(m => m.Node("n").To().Node("x"));
cypher.Return(r => r.Node("n").Count("*"));
var tblResults = cypher.post();

2. Group Count Relationship Types

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2));
cypher.Match(m => m.Node("n").To("r", null).Node());
cypher.Return(r => r.Type("r").Count("*"));
var tblResults = cypher.post();

3. Count entities

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2));
cypher.Match(m => m.Node("n").To().Node("x"));
cypher.Return(r => r.Count("x"));
var tblResults = cypher.post();

4. Count non null values

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2, 3, 4, 1));
cypher.Return(r => r.Count("n.property?"));
var tblResults = cypher.post();

5. SUM

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2, 3, 4));
cypher.Return(r => r.Sum("n.property"));
var tblResults = cypher.post();

6. AVG

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2, 3, 4));
cypher.Return(r => r.Avg("n.property"));
var tblResults = cypher.post();

7. MAX

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2, 3, 4));
cypher.Return(r => r.Max("n.property"));
var tblResults = cypher.post();

8. Min

var cypher = new Cypher();
cypher.Start(s => s.Node("n", 2, 3, 4));
cypher.Return(r => r.Min("n.property"));
var tblResults = cypher.post();

9. Collect

NOT SUPPORTED AT THIS TIME

8. Distinct

var cypher = new Cypher();
cypher.Start(s => s.Node("a", 2));
cypher.Match(m => m.Node("a").To().Node("b"));
cypher.Return(r => r.Count("distinct b.eyes"));
var tblResults = cypher.post();

Clone this wiki locally