I am trying to use Neo4jClient (and am new to C#) to build and retrieve data from Neo4j. First, I build the items and relations to a search:
NodeReference<Search> searchNode = client.Create(searches[i]);
itmNode = client.Create(items[j], new IRelationshipAllowingParticipantNode<Item>[0],
new[]
{
new IndexEntry("Item")
{
{"Type", items[j].Type },
{"ItemDescription", items[j].ItemDescription },
{"ItemNumber", items[j].ItemNumber }
}
});
client.CreateRelationship(itmNode, new SearchedFor(searchNode, 1));
Then, I am testing the retrieval of the node back from Neo4j:
var results = client.Cypher.Start("n", itemDict[firstitem])
.Match("n-[r]->()<-[r2]-other")
.Return<Node<Item>>("other")
.Results;
var node6 = ((IRawGraphClient)client).ExecuteGetCypherResults<Node<Item>>(new Neo4jClient.Cypher.CypherQuery("start n=node(6) return n;", null,Neo4jClient.Cypher.CypherResultMode.Set)).Select(un => un.Data);
"results" returns the 2 nodes that are related to node(6). "node6" is other code I found that I thought would return node 6. Both of these return the nodes, but the properties returned are all blank. I can see the properties in the Neo4j Monitoring Tool, but not when they are returned using Neo4jClient. Am I missing something in how I am setting up the nodes, or on how I am retrieving the data?
My object return shows Data.ItemDescription="", Data.ItemNumber=0, Reference=Node 5
Adding the "Select(un => un.Data)" after .Results did not work like I saw in other examples like this
Please let me know if you need more information.
Neo4jClient version 1.0.0.579
Neo4j version 1.8.2
Here is the item class:
public class Item
{
private string _name;
private string _desc;
private long _id;
public Item(string name, string desc, long id)
{
_name = name;
_desc = desc;
_id = id;
}
public Item()
{
_name = "";
_desc = "";
_id = 0;
}
public long ItemNumber
{
get
{
return _id;
}
}
public string ItemDescription
{
get
{
return _desc;
}
}
public string Type
{
get
{
return "Item";
}
}
}