LosManos
LosManos

Reputation: 7692

Neo4jClient/Cypher query returns object but without setting properties

I just can't get an object out of Neo4j through Neo4jClient and Cypher.

var client = new GraphClient(new Uri("http://mymachine:7474/db/data"));
client.Connect();
var myList = client.RootNode.StartCypher("root")
    .Match("root-[:RELATED_TO]->(user)")
    .Return<User>("user").Results;

I get a User object in myList[0] alright but its properties are empty.

I get the same (object with empty properties) through

client.ExecuteGetCypherResults<User>(
    new CypherQuery("start n=node(1) return n;",null, CypherResultMode.Set)
);

What obvious thing have I overlooked?

(Neo4j 1.8 MS5, Neo4jClient 1.0.0.388)

/Neo4jClient/Neo4j noob.

Upvotes: 1

Views: 1870

Answers (1)

LosManos
LosManos

Reputation: 7692

Yay! I changed to Node like so:

var myList = client.RootNode.StartCypher("root")
    .Match("root-[:RELATED_TO]->(user)")
    .Return<Node<User>>("user").Results;

and finally

var myList = client.RootNode.StartCypher("root")
    .Match("root-[:RELATED_TO]->(user)")
    .Return<Node<User>>("user").Results
    .Select( nu => nu.Data );

The simplest example should be:

var myList = client.ExecuteGetCypherResults<Node<User>>(
    new CypherQuery("start n=node(1) return n;", null, CypherResultMode.Set))
.Select(un => un.Data);

where 1 is the ID of the User node.

Upvotes: 1

Related Questions