PureQL.CSharp.Model.Graph
0.1.0-preview.1.1.0
dotnet add package PureQL.CSharp.Model.Graph --version 0.1.0-preview.1.1.0
NuGet\Install-Package PureQL.CSharp.Model.Graph -Version 0.1.0-preview.1.1.0
<PackageReference Include="PureQL.CSharp.Model.Graph" Version="0.1.0-preview.1.1.0" />
<PackageVersion Include="PureQL.CSharp.Model.Graph" Version="0.1.0-preview.1.1.0" />
<PackageReference Include="PureQL.CSharp.Model.Graph" />
paket add PureQL.CSharp.Model.Graph --version 0.1.0-preview.1.1.0
#r "nuget: PureQL.CSharp.Model.Graph, 0.1.0-preview.1.1.0"
#:package PureQL.CSharp.Model.Graph@0.1.0-preview.1.1.0
#addin nuget:?package=PureQL.CSharp.Model.Graph&version=0.1.0-preview.1.1.0&prerelease
#tool nuget:?package=PureQL.CSharp.Model.Graph&version=0.1.0-preview.1.1.0&prerelease
PureQL.CSharp.Model.Graph
Generated, driver-free mapping of a PureQL query model to a property graph and back.
Overview
PureQL.CSharp.Model.Graph turns a PureQLQuery of
PureQL.CSharp.Model into a list of
nodes and relationships that a property-graph store can write in one statement (for
example one UNWIND over the nodes and one over the relationships), and reads a stored
graph back into the model. It has no database driver dependency: store bindings, such as
the PureQL.CSharp.Model.Graph.Neo4j.* packages, pass the lists to their driver and build
ReadNodes from what the driver returns.
The writers and readers of every model record and union are generated ahead of time from the model, so the library uses no reflection and is trim- and Native AOT-compatible.
Graph shape
- One node per model record. Labels: the record's type name (
AddIntegerRow) andNode; the root record also hasQuery. Every node hasqueryId(the query's id, a "D" uuid string); the root also hasid(the same value). - One relationship per child. Its type is the C# property that holds the child
(
Where,Left,Values,Columns, …). Each item of a list gets its own relationship with an integerposition(0-based); a single child has none. - Unions are transparent. Only the case a union holds is stored; on read, the node's
record label picks the case.
PaginationSkipandPaginationTake(long | ParamInteger) store a number as the propertyskip/takeof thePaginationnode and a parameter as aSkip/Takerelationship to aParamIntegernode. - Scalars are node properties named after the constructor parameter (
source,field,param,value,alias,kind,direction,over, …), spelled asPureQL.CSharp.Model.Serializationwrites them in JSON:long,boolandstringas they are;decimalas an invariant string without exponent or trailing zeros ("12.5");Guidin the "D" format;DateOnlyasyyyy-MM-dd;TimeOnlyasHH:mm:ss[.fffffff]andDateTimeOffsetasyyyy-MM-ddTHH:mm:ss[.fffffff]Zin UTC, the fraction without trailing zeros. Lists of scalars (distinctBy, list literals) arestring[],long[]orbool[]. Enums are stored by name (Inner,Desc,All), defaults included. The computedTypeis not stored. - Absent and empty. An absent optional value is not stored. An optional list of
records that is present but empty is stored as an empty-array property named after the
list (
joins = []), so[]and absent read back apart.
Reading accepts that representation, any integer CLR type where a long is expected, the
CLR value itself, and any list where an array is expected; a property holding null is
absent. A graph that does not map to the model (a missing or extra relationship, a
missing or mistyped property, a label that is not a case of the union expected there)
throws a GraphMappingException naming the node and the property or relationship.
Dependencies
PureQL.CSharp.Model0.1.0-preview.14.0.0
Target Frameworks
- .NET 11
Installation
dotnet add package PureQL.CSharp.Model.Graph
Usage
using PureQL.CSharp.Model;
using PureQL.CSharp.Model.Graph;
QueryGraph graph = QueryGraphs.Of(query, id: Guid.NewGuid());
foreach (WrittenNode node in graph.Nodes)
{
// node.Index, node.Labels (record label, "Node", and "Query" on node 0),
// node.Properties (strings, longs, booleans and arrays of them)
}
foreach (WrittenRelationship relationship in graph.Relationships)
{
// relationship.From, relationship.To (node indexes), relationship.Type, relationship.Position
}
// Reading back: a store binding builds one ReadNode per stored node, with its record
// label, its properties and its children by relationship type in position order.
Dictionary<string, IReadOnlyList<IReadNode>> children =
new Dictionary<string, IReadOnlyList<IReadNode>>();
ReadNode root = new ReadNode("MainPlainQueryWithoutPagination", properties, children);
// ... fill children["From"], children["Select"], ... with the nodes they point to
PureQLQuery read = QueryGraphs.Read(root);
ReadNode also takes the children as an ILookup<string, IReadNode> or as a function
from relationship type to children; any other IReadNode implementation works too.
Related packages
PureQL.CSharp.Model— the modelPureQL.CSharp.Model.Serialization— JSON for the same modelPureQL.CSharp.Model.Graph.Neo4j.*— storing, querying, updating and deleting query graphs in Neo4j
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- PureQL.CSharp.Model (>= 0.1.0-preview.14.1.0)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on PureQL.CSharp.Model.Graph:
| Package | Downloads |
|---|---|
|
PureQL.CSharp.Model.Graph.Neo4j.Insertion
Inserts PureQL query graphs into Neo4j: one query, one transaction, one batched Cypher statement. |
|
|
PureQL.CSharp.Model.Graph.Neo4j.Deletion
Deletes PureQL query graphs from Neo4j by query id or by a set of ids. |
|
|
PureQL.CSharp.Model.Graph.Neo4j.Querying
Reads PureQL query graphs from Neo4j by id, by ids or all, with structural lookups, rebuilding the PureQLQuery. |
|
|
PureQL.CSharp.Model.Graph.Neo4j.Creation
Creates the Neo4j schema for PureQL query graphs: the uniqueness constraint and the indexes, applied idempotently. |
|
|
PureQL.CSharp.Model.Graph.Neo4j.Updating
Replaces a stored PureQL query graph in Neo4j in one transaction. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview.1.1.0 | 167 | 11/11/2026 |
| 0.1.0-preview.1.0.0 | 211 | 11/9/2026 |
| 0.1.0-preview.0.1.0 | 54 | 11/9/2026 |