Cyphoid 0.8.0
dotnet add package Cyphoid --version 0.8.0
NuGet\Install-Package Cyphoid -Version 0.8.0
<PackageReference Include="Cyphoid" Version="0.8.0" />
<PackageVersion Include="Cyphoid" Version="0.8.0" />
<PackageReference Include="Cyphoid" />
paket add Cyphoid --version 0.8.0
#r "nuget: Cyphoid, 0.8.0"
#:package Cyphoid@0.8.0
#addin nuget:?package=Cyphoid&version=0.8.0
#tool nuget:?package=Cyphoid&version=0.8.0
C# Cyphoid parser for Cypher query language
This project implements a Cypher parser that can be used in C# to query any sort of graph backend.
Cyphoid expects developers to implement various operators that interact with their own backend.
Features
- Implements a subset of Cyhper.
- Fast parser implementation with Antlr.
- In-memory implementation of query plans for any backend.
Example usage
// This is your implementation of the backend
IOperatorFactory factory = new OperatorFactory(Graph);
// Query input
var input = "MATCH (n:city) RETURN n.name LIMIT 1";
// Parse query
ICypherParser parser = new CypherAstParser();
var queryNode = parser.ParseQuery(input);
// Print parsed query
var prettyPrint = queryNode.PrettyPrint();
// Build logical query plan
var plan = queryNode.BuildQueryPlan();
// Build executable query plan (using your backend)
var execution = plan.BuildExecutionPlan(factory);
// Prepare query context
var context = new QueryContext(queryNode.RowSize);
// Execute actual query
var result = await execution.ExecuteAsync(context).ToListAsync();
Architecture
Source Code
↓
ANTLR Lexer/Parser
↓
AST Builder (Visitor)
↓
Abstract Syntax Tree (AST)
↓
Cypher logical plan
↓
Cypher executable query plan
↓
<Your implementation>
Backend implementation
Guidance for third-party backends is in BACKEND_GUIDE.md.
Developer instructions
For developing the Cyphoid library.
Building a release
- Update version number and more in Cyphoid.Core.csproj.
- Build in release mode to generate NuGet package.
- Upload package Cyphoid.N.N.N.nupkg from Src\Cyphoid.Core\bin\Release\ folder.
ANTLR
The compiler is built using Antlr. See https://github.com/antlr/antlr4/blob/master/doc/getting-started.md
Antlr is made with Java. There are some Windows tools that make setup easier. See https://github.com/antlr/antlr4-tools
Run ANTLR Compiler
cd into "Cyphoid.Core/Antlr".
java org.antlr.v4.Tool -Dlanguage=CSharp -visitor -o Generated Cypher.g4
Manual Antlr installation
Install Java (version 1.7 or higher) - NOT from java.com but rather one of the newer SDKs.
Download antlr-4.13.2-complete.jar (or whatever version) from https://www.antlr.org/download.html Save to your directory for 3rd party Java libraries, say C:\Javalib
Add antlr-4.13.2-complete.jar to CLASSPATH, either: Permanently: Using System Properties dialog > Environment variables > Create or append to CLASSPATH variable Temporarily, at command line.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Antlr4.Runtime.Standard (>= 4.13.1)
- System.Linq.Async (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
0.8.0 - Add unidirectional pattern -[]-.