Recreating objects with data retrieved by Neo4j .NET driver

Hi
I am new to both Neo4j and the Neo4j .NET driver. I am serializing and deserializing specific “patterns” from .NET to Neo4j and back (which is why I am trying to keep it simple without any other libraries). An example is this:

public class Car
{
	public string Name { get; set; }
	public IList<Engine> Engines { get; set; }
}

public class Engine
{
	public string Name { get; set; }
	public Maker Maker { get; set; }
	public Material Material { get; set; }
}

public class Maker
{
	public string Name { get; set; }
}

public class Material
{
	public string Name { get; set; }
}

My data in Neo4j looks like this (create statement attached in the end):

3X_c_d_cdb2040b413a3b9b02095578e5f4075a46559ed0.jpeg

I am trying to re-create the Car based upon the above data. However, my query:

MATCH(from:Car { Name: "Hybrid" })-[r:USES|CREATOR|MADE_OF*1..2]->(to) RETURN from, r, to

Returns an IList with 5 records that seems overly difficult to use to re-create the above Car object, which suggest I am on the wrong path. My current attempt is not working yet and growing in complexity and works by iterating through the List and looking at the type of relationship, the to node and ascertaining where it is in the pattern.

I can re-create the Car as this is the from Node, however the Engine, Maker and Material is causing me problems. It seems like I need a combination of Node and Relationship to re-create the correct object, however I don't see how.

Is there a better path? Either by using Cypher to return an object that is easier to deserialize (for example containing the hierarchy of the objects) or some way to return subgraphs so the results are easier to work with?

Thank you in advance!

Best regards
Andreas:

Create.txt (478 Bytes)

Hi Charlotte,

Looks like the Neo4j.Driver.Extensions nuget package needs an old version (4.3.2.2) of Neo4j.Driver. Does that sound right to you? I am wondering if there are plans to get the Neo4j.Driver.Extensions Package up to date with the current nuget Neo4j.Driver package... (5.1.0)

Thanks!!