I have push a code update that implements the Cypher plugin

https://github.com/SepiaGroup/Neo4jRestNet

The interface supports all of the START, MATCH, WHERE and RETURN clauses
(except the Type function on the Where clause – coming soon.) Blow are some
examples.  The last two examples show an alternate syntax that can be used
with any clause.  I have not implemented the Order by, Skip, Limit or
Funcitons yet.  

Romiko/Tatham if you can review the syntax and make suggestions I will try
to implement them, otherwise you should be able to incorporate this into
your code with minimal modifications.   Also you may want to look at how I
parse the Expression tree.  I have not had time to review the update you
just posted for paging queries but that sounds very interesting.   

// Basic Cypher query
CypherQuery c1 = new CypherQuery();

c1.Start(s => s.Node("A", 0));
c1.Return( r => r.Node("A"));

DataTable tbl = Cypher.Post(c1);

// c1.ToString() = "START A=node(0) RETURN A"


// Cypher with Match clause
CypherQuery c2 = new CypherQuery();

c2.Start(s => s.Node("A", 0));
c2.Match(m => m.Node("A").To("r", "Likes").Node("B"));
c2.Return(r => r.Node("A").Relationship("r").Node("B"));

tbl = Cypher.Post(c2);

// c2.ToString() = "START A=node(0) MATCH (A) -[r:Likes]-> (B)  RETURN A, r,
B"


// Cypher with multi start and return optional property
CypherQuery c3 = new CypherQuery();
c3.Start(s => s.Node("A", 0, 1));
c3.Match(m => m.Node("A").Any("r", "Likes").Node("C"));
c3.Return(r => r.Node("C").Node("C").Property("Name?"));

tbl = Cypher.Post(c3);

// c3.ToString() = "START A=node(0,1) MATCH (A) -[r:Likes]- (C)  RETURN C,
C.Name?"

// Multi Start
CypherQuery c4 = new CypherQuery();
c4.Start(s => s.Node("A", 0).Node("B",1));
c4.Return(r => r.Node("A").Node("B"));

tbl = Cypher.Post(c4);

// C4.ToString() = "START A=node(0), B=node(1) RETURN A, B"

// Cypher with Where clause
CypherQuery c5 = new CypherQuery();
c5.Start(s => s.Node("A", 0, 1));
c5.Where(w => w.Node("A").Property("Age?") < 30 &&
w.Node("A").Property("Name?") == "Tobias" || !(w.Node("A").Property("Name?")
== "Tobias"));
c5.Return(r => r.Node("A"));

tbl = Cypher.Post(c5.ToString());

// C5.ToString() = "START A=node(0,1) WHERE A.Age? < 30 and A.Name? =
'Tobias' or not(A.Name? = 'Tobias') RETURN A"

// Alt syntax
CypherQuery c6 = new CypherQuery();
c6.Start(s =>   {
                        s.Node("A", 0);
                        s.Node("B", 1);
                        return s;
                });

c6.Return(r =>  {
                        r.Node("A");
                        r.Node("B");
                        return r;
                });

tbl = Cypher.Post(c6);

// c6.ToString = "START A=node(0), B=node(1) RETURN A, B"

// Alt syntax
CypherQuery c7 = new CypherQuery();
c7.Start(s => s.Node("A", 0));
c7.Start(s => s.Node("B", 1));

c7.Return(r => r.Node("A"));
c7.Return(r => r.Node("B"));

tbl = Cypher.Post(c7);
// c7.ToString = "START A=node(0), B=node(1) RETURN A, B"



--
View this message in context: 
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4jRestNet-Cypher-Plugin-tp3449054p3449054.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to