PureQL.CSharp.Model.Graph.Neo4j.Creation 0.1.0-preview.0.2.0

This is a prerelease version of PureQL.CSharp.Model.Graph.Neo4j.Creation.
dotnet add package PureQL.CSharp.Model.Graph.Neo4j.Creation --version 0.1.0-preview.0.2.0
                    
NuGet\Install-Package PureQL.CSharp.Model.Graph.Neo4j.Creation -Version 0.1.0-preview.0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PureQL.CSharp.Model.Graph.Neo4j.Creation" Version="0.1.0-preview.0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PureQL.CSharp.Model.Graph.Neo4j.Creation" Version="0.1.0-preview.0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="PureQL.CSharp.Model.Graph.Neo4j.Creation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PureQL.CSharp.Model.Graph.Neo4j.Creation --version 0.1.0-preview.0.2.0
                    
#r "nuget: PureQL.CSharp.Model.Graph.Neo4j.Creation, 0.1.0-preview.0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PureQL.CSharp.Model.Graph.Neo4j.Creation@0.1.0-preview.0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PureQL.CSharp.Model.Graph.Neo4j.Creation&version=0.1.0-preview.0.2.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PureQL.CSharp.Model.Graph.Neo4j.Creation&version=0.1.0-preview.0.2.0&prerelease
                    
Install as a Cake Tool

PureQL.CSharp.Model.Graph.Neo4j.Creation

Creates the Neo4j schema, constraints and indexes, for stored PureQL query graphs.

.NET build & test Build and Deploy NuGet License: MIT

Overview

PureQL.CSharp.Model.Graph.Neo4j.Creation is the schema creation package of the PureQL.CSharp.Model.Graph family: it creates, idempotently, the uniqueness constraint and the indexes that the other Neo4j packages rely on to store and look up PureQL query graphs.

Schema

Name (SchemaNames) Kind Cypher
pureql_query_id (QueryId) Uniqueness constraint CREATE CONSTRAINT pureql_query_id IF NOT EXISTS FOR (q:Query) REQUIRE q.id IS UNIQUE
pureql_node_query_id (NodeQueryId) Range index CREATE INDEX pureql_node_query_id IF NOT EXISTS FOR (n:Node) ON (n.queryId)
pureql_node_field_source (NodeFieldSource) Composite range index CREATE INDEX pureql_node_field_source IF NOT EXISTS FOR (n:Node) ON (n.field, n.source)
pureql_node_param (NodeParam) Range index CREATE INDEX pureql_node_param IF NOT EXISTS FOR (n:Node) ON (n.param)

The statements run in this order. The constraint keeps query ids unique and backs the lookup of a query by id; queryId finds every node of a query; field, source and param serve the structural lookups (queries reading a field of a source, queries using a parameter). Every statement is IF NOT EXISTS, so applying the schema again changes nothing. The Existence and Destruction packages repeat these names without depending on this package: they must stay identical.

Public API

Namespace PureQL.CSharp.Model.Graph.Neo4j.Creation:

Name Description
SchemaCreationStatements sealed record : IEnumerable<Neo4j.Driver.Query>: the four statements above, in order, without parameters
CreatedSchema sealed record CreatedSchema(IAsyncQueryRunner Runner); ApplyAsync(CancellationToken ct = default) runs the statements in order on the session or transaction
CreatedSchemaOf sealed record CreatedSchemaOf(INeo4jStoredQueries Store); ApplyAsync(CancellationToken ct = default) opens a session on Store.Driver against Store.Database and runs each statement in its own auto-commit transaction
SchemaNames The names of the constraint and the indexes, as constants

The cancellation token is checked before each statement; the driver does not cancel a statement that is running. Neo4j does not mix schema statements and data writes in one transaction, so a transaction passed to CreatedSchema must hold schema statements only.

Usage

using Neo4j.Driver;
using PureQL.CSharp.Model.Graph.Neo4j.Abstractions;
using PureQL.CSharp.Model.Graph.Neo4j.Creation;

await using IDriver driver = GraphDatabase.Driver(
    "neo4j://localhost:7687",
    AuthTokens.Basic("neo4j", "password")
);
INeo4jStoredQueries store = new Neo4jStoredQueries(driver);

// Once at startup, before storing queries; safe to repeat.
await new CreatedSchemaOf(store).ApplyAsync();

// Or on a session (or a schema-only transaction) you manage:
await using IAsyncSession session = driver.AsyncSession(
    builder => builder.WithDatabase(store.Database)
);
await new CreatedSchema(session).ApplyAsync();

Design Principles

  • Idempotent — every statement is IF NOT EXISTS
  • Composable — CreatedSchema runs on any IAsyncQueryRunner; the statements are plain Query values for callers that run them themselves
  • AOT-compatible — IsAotCompatible=true, no reflection

Dependencies

Target Frameworks

  • .NET 11

Installation

dotnet add package PureQL.CSharp.Model.Graph.Neo4j.Creation
Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.0.2.0 84 11/11/2026
0.1.0-preview.0.1.0 69 11/9/2026