@webtic, @chris.skardon, thank you both for your suggestions. I experimented with them and other approaches and was able to get what I wanted by using apoc.export.json.all
to stream in a JSON dataset of the entire database. I leveraged the examples at https://neo4j.com/docs/labs/apoc/current/export/json/#export-database-json. I apologize for what turned out to be the misdirection of my question. db.schema.nodeTypeProperties()
was not going to get me what I really needed.
using Newtonsoft.Json.Linq;
public async void TestNeo4j()
{
// Set up the graph database driver and connect the session to the Neo4J database.
IDriver driver = GraphDatabase.Driver(Neo4JBoltURI, AuthTokens.Basic(Neo4JUser, Neo4JPassword));
IAsyncSession session = driver.AsyncSession();
IResultCursor cursor;
try
{
// Bring the JSON text in as a stream
string query = "CALL apoc.export.json.all(null,{stream:true,useTypes:true}) " +
"YIELD file, nodes, relationships, properties, data " +
"RETURN file, nodes, relationships, properties, data";
cursor = await session.RunAsync(query);
string sJsonData = await cursor.SingleAsync(record => record["data"].As<string>());
//Debug.Log(sJsonData);
//// Save the JSON to a file.
//string path = @"C:\Users\Public\Documents\Neo4JExportAll.json";
//if (File.Exists(path)) File.Delete(path);
//File.WriteAllText(path, sJsonData);
// Each line is a separate JSON statement describing a node or a relationship
// Iterate all statements
using (StringReader reader = new StringReader(sJsonData))
{
string line = string.Empty;
do
{
line = reader.ReadLine();
if (line != null)
{
// Deserialize the JSON line into JObject jo.
JObject jo = JObject.Parse(line);
// Dig into the JObject to get the data from the stream.
}
} while (line != null);
}
}
finally
{
await session.CloseAsync();
}
}