CypherQueryBuilder 1.6.2
See the version list below for details.
dotnet add package CypherQueryBuilder --version 1.6.2
NuGet\Install-Package CypherQueryBuilder -Version 1.6.2
<PackageReference Include="CypherQueryBuilder" Version="1.6.2" />
paket add CypherQueryBuilder --version 1.6.2
#r "nuget: CypherQueryBuilder, 1.6.2"
// Install CypherQueryBuilder as a Cake Addin #addin nuget:?package=CypherQueryBuilder&version=1.6.2 // Install CypherQueryBuilder as a Cake Tool #tool nuget:?package=CypherQueryBuilder&version=1.6.2
CypherQueryBuilder
CypherQueryBuilder Assembly
Namespaces
<a name='CypherQueryBuilder'></a>
CypherQueryBuilder Namespace
Classes
<a name='CypherQueryBuilder.CreateQuery'></a>
CreateQuery Class
public class CreateQuery : CypherQueryBuilder.MatchQuery
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase 🡒 MatchQuery 🡒 CreateQuery
Methods
<a name='CypherQueryBuilder.CreateQuery.Compile()'></a>
CreateQuery.Compile() Method
Compiles this instance to Cypher Query string.
public override string Compile();
Returns
System.String
Cypher Query string
See Also
<a name='CypherQueryBuilder.CreateQuery.CompileWithParemeters()'></a>
CreateQuery.CompileWithParemeters() Method
Compiles the instance to Cypher Query string with paremeters.
public override ValueTuple<string,Dictionary<string,object?>> CompileWithParemeters();
Returns
System.ValueTuple
ValueTuple<string, Dictionary<string, Nullable<Object>>>
Example
Usage:
var metaDataCount = 2;
var metaDataNodes = new Node<MetaData>[metaDataCount];
for (int i = 0; i < metaDataCount; i++)
{
var id = $"mId_{i}";
metaDataNodes[i] = Node<MetaData>.Instance(i).Where(p => p.Uid == id);
}
var domainNode = Node<Domain>.Instance().Where(p => p.Uid == "TestDomain");
var (mq, parameters) = Query.Match(domainNode, metaDataNodes).CompileAsParemeterized();
See Also
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object)'></a>
CreateQuery.CreateRelation(string, string, Node, Node, bool, object) Method
Creates the relation.
public override CypherQueryBuilder.CreateQuery CreateRelation(string alias, string label, CypherQueryBuilder.Node from, CypherQueryBuilder.Node to, bool toMerge=false, object? properties=null);
Parameters
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).alias'></a>
alias
System.String
The alias.
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).label'></a>
label
System.String
The label.
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).from'></a>
from
Node
From.
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).to'></a>
to
Node
To.
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).toMerge'></a>
toMerge
System.Boolean
if set to true
[to merge].
<a name='CypherQueryBuilder.CreateQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).properties'></a>
properties
System.Object
The properties.
Returns
<a name='CypherQueryBuilder.DeleteQuery'></a>
DeleteQuery Class
public class DeleteQuery : CypherQueryBuilder.MatchQuery
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase 🡒 MatchQuery 🡒 DeleteQuery
Methods
<a name='CypherQueryBuilder.DeleteQuery.Compile()'></a>
DeleteQuery.Compile() Method
Compiles this instance to Cypher Query string.
public override string Compile();
Returns
System.String
Cypher Query string
<a name='CypherQueryBuilder.DeleteQuery.Delete_T_(T[])'></a>
DeleteQuery.Delete<T>(T[]) Method
Deletes the specified entities.
public override CypherQueryBuilder.DeleteQuery Delete<T>(params T[] entities)
where T : CypherQueryBuilder.Entity;
Type parameters
<a name='CypherQueryBuilder.DeleteQuery.Delete_T_(T[]).T'></a>
T
Parameters
<a name='CypherQueryBuilder.DeleteQuery.Delete_T_(T[]).entities'></a>
The entities to delete.
Returns
DeleteQuery
DeleteQuery
<a name='CypherQueryBuilder.DeleteQuery.Detach_T_(T[])'></a>
DeleteQuery.Detach<T>(T[]) Method
Detaches, i.e. delete with all the associated relations (if it is a node), the specified entities.
public override CypherQueryBuilder.DeleteQuery Detach<T>(params T[] entities)
where T : CypherQueryBuilder.Entity;
Type parameters
<a name='CypherQueryBuilder.DeleteQuery.Detach_T_(T[]).T'></a>
T
Parameters
<a name='CypherQueryBuilder.DeleteQuery.Detach_T_(T[]).entities'></a>
The entities to detache and delete.
Returns
DeleteQuery
DeleteQuery
<a name='CypherQueryBuilder.DeleteQuery.ReleaseResources()'></a>
DeleteQuery.ReleaseResources() Method
Releases the resources, used while disposing.
public override void ReleaseResources();
<a name='CypherQueryBuilder.MatchQuery'></a>
MatchQuery Class
public class MatchQuery : CypherQueryBuilder.QueryBase
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase 🡒 MatchQuery
Derived
↳ CreateQuery
↳ DeleteQuery
↳ UpdateQuery
Methods
<a name='CypherQueryBuilder.MatchQuery.Compile()'></a>
MatchQuery.Compile() Method
Compiles this instance to Cypher Query string.
public override string Compile();
Returns
System.String
Cypher Query string
See Also
<a name='CypherQueryBuilder.MatchQuery.CompileWithParemeters()'></a>
MatchQuery.CompileWithParemeters() Method
Compiles the instance to Cypher Query string with paremeters.
public virtual ValueTuple<string,Dictionary<string,object?>> CompileWithParemeters();
Returns
System.ValueTuple
ValueTuple<string, Dictionary<string, Nullable<Object>>>
Example
Usage:
var metaDataCount = 2;
var metaDataNodes = new Node<MetaData>[metaDataCount];
for (int i = 0; i < metaDataCount; i++)
{
var id = $"mId_{i}";
metaDataNodes[i] = Node<MetaData>.Instance(i).Where(p => p.Uid == id);
}
var domainNode = Node<Domain>.Instance().Where(p => p.Uid == "TestDomain");
var (mq, parameters) = Query.Match(domainNode, metaDataNodes).CompileAsParemeterized();
See Also
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object)'></a>
MatchQuery.CreateRelation(string, string, Node, Node, bool, object) Method
Creates the relation.
public virtual CypherQueryBuilder.CreateQuery CreateRelation(string alias, string label, CypherQueryBuilder.Node from, CypherQueryBuilder.Node to, bool toMerge=false, object? properties=null);
Parameters
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).alias'></a>
alias
System.String
The alias.
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).label'></a>
label
System.String
The label.
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).from'></a>
from
Node
From.
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).to'></a>
to
Node
To.
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).toMerge'></a>
toMerge
System.Boolean
if set to true
[to merge].
<a name='CypherQueryBuilder.MatchQuery.CreateRelation(string,string,CypherQueryBuilder.Node,CypherQueryBuilder.Node,bool,object).properties'></a>
properties
System.Object
The properties.
Returns
<a name='CypherQueryBuilder.MatchQuery.Delete_T_(T[])'></a>
MatchQuery.Delete<T>(T[]) Method
Deletes the specified entities.
public virtual CypherQueryBuilder.DeleteQuery Delete<T>(params T[] entities)
where T : CypherQueryBuilder.Entity;
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Delete_T_(T[]).T'></a>
T
Parameters
<a name='CypherQueryBuilder.MatchQuery.Delete_T_(T[]).entities'></a>
The entities.
Returns
<a name='CypherQueryBuilder.MatchQuery.Detach_T_(T[])'></a>
MatchQuery.Detach<T>(T[]) Method
Detaches the specified entities.
public virtual CypherQueryBuilder.DeleteQuery Detach<T>(params T[] entities)
where T : CypherQueryBuilder.Entity;
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Detach_T_(T[]).T'></a>
T
Parameters
<a name='CypherQueryBuilder.MatchQuery.Detach_T_(T[]).entities'></a>
The entities.
Returns
<a name='CypherQueryBuilder.MatchQuery.Limit(int)'></a>
MatchQuery.Limit(int) Method
Limits the specified limit.
public CypherQueryBuilder.MatchQuery Limit(int limit);
Parameters
<a name='CypherQueryBuilder.MatchQuery.Limit(int).limit'></a>
limit
System.Int32
The limit.
Returns
MatchQuery
MatchQuery
<a name='CypherQueryBuilder.MatchQuery.OrderBy_T,K_(Expression_Func_T,K__,string)'></a>
MatchQuery.OrderBy<T,K>(Expression<Func<T,K>>, string) Method
Orders the by.
public virtual CypherQueryBuilder.MatchQuery OrderBy<T,K>(Expression<Func<T,K>> keySelector, string? alias=null);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.OrderBy_T,K_(Expression_Func_T,K__,string).T'></a>
T
Entity (Node or Relation)
<a name='CypherQueryBuilder.MatchQuery.OrderBy_T,K_(Expression_Func_T,K__,string).K'></a>
K
The property of the T type Node or Relation on which order by will be applied.
Parameters
<a name='CypherQueryBuilder.MatchQuery.OrderBy_T,K_(Expression_Func_T,K__,string).keySelector'></a>
keySelector
System.Linq.Expressions.Expression
The key selector.
<a name='CypherQueryBuilder.MatchQuery.OrderBy_T,K_(Expression_Func_T,K__,string).alias'></a>
alias
System.String
The alias.
Returns
MatchQuery
MatchQuery
Example
var movie = new Movie() { ReleaseYear = 2010, Title = "Gambler" };
var mNode = Node<Movie>.Instance(movie);
var q = Query
.Match(mNode, pNode)
.Return<Movie>()
.OrderBy<Movie, int>(m => m.ReleaseYear);
See Also
<a name='CypherQueryBuilder.MatchQuery.OrderByDescending_T,K_(Expression_Func_T,K__,string)'></a>
MatchQuery.OrderByDescending<T,K>(Expression<Func<T,K>>, string) Method
Orders the by descending.
public virtual CypherQueryBuilder.MatchQuery OrderByDescending<T,K>(Expression<Func<T,K>> keySelector, string? alias=null);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.OrderByDescending_T,K_(Expression_Func_T,K__,string).T'></a>
T
Entity (Node or Relation)
<a name='CypherQueryBuilder.MatchQuery.OrderByDescending_T,K_(Expression_Func_T,K__,string).K'></a>
K
The property of the T type Node or Relation on which descending order by will be applied.
Parameters
<a name='CypherQueryBuilder.MatchQuery.OrderByDescending_T,K_(Expression_Func_T,K__,string).keySelector'></a>
keySelector
System.Linq.Expressions.Expression
The key selector.
<a name='CypherQueryBuilder.MatchQuery.OrderByDescending_T,K_(Expression_Func_T,K__,string).alias'></a>
alias
System.String
The alias.
Returns
MatchQuery
MatchQuery
Example
var movie = new Movie() { ReleaseYear = 2010, Title = "Gambler" };
var mNode = Node<Movie>.Instance(movie);
var q = Query
.Match(mNode, pNode)
.Return<Movie>()
.OrderByDescending<Movie, int>(m => m.ReleaseYear);
See Also
<a name='CypherQueryBuilder.MatchQuery.OrWhere(string)'></a>
MatchQuery.OrWhere(string) Method
Ors the where.
public CypherQueryBuilder.MatchQuery OrWhere(string clause);
Parameters
<a name='CypherQueryBuilder.MatchQuery.OrWhere(string).clause'></a>
clause
System.String
The clause.
Returns
<a name='CypherQueryBuilder.MatchQuery.Return(string[])'></a>
MatchQuery.Return(string[]) Method
Returns the specified returns.
public virtual CypherQueryBuilder.MatchQuery Return(params string[] returns);
Parameters
<a name='CypherQueryBuilder.MatchQuery.Return(string[]).returns'></a>
returns
System.String[]
The returns.
Returns
<a name='CypherQueryBuilder.MatchQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool)'></a>
MatchQuery.Return<T>(Node<T>, Expression<Func<T,object>>, bool) Method
Returns the specified node.
public virtual CypherQueryBuilder.MatchQuery Return<T>(CypherQueryBuilder.Node<T> node, Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).node'></a>
node
CypherQueryBuilder.Node<T>
The node.
<a name='CypherQueryBuilder.MatchQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.MatchQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
<a name='CypherQueryBuilder.MatchQuery.Return_T_(Expression_Func_T,object__,bool)'></a>
MatchQuery.Return<T>(Expression<Func<T,object>>, bool) Method
Returns the specified f.
public CypherQueryBuilder.MatchQuery Return<T>(Expression<Func<T,object>>? f=null, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.MatchQuery.Return_T_(Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
<a name='CypherQueryBuilder.MatchQuery.Return_T_(string,Expression_Func_T,object__,bool)'></a>
MatchQuery.Return<T>(string, Expression<Func<T,object>>, bool) Method
Returns the specified alias.
public virtual CypherQueryBuilder.MatchQuery Return<T>(string? alias, Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(string,Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.MatchQuery.Return_T_(string,Expression_Func_T,object__,bool).alias'></a>
alias
System.String
The alias.
<a name='CypherQueryBuilder.MatchQuery.Return_T_(string,Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.MatchQuery.Return_T_(string,Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
Returns
<a name='CypherQueryBuilder.MatchQuery.Skip(int)'></a>
MatchQuery.Skip(int) Method
Skips the specified skip.
public CypherQueryBuilder.MatchQuery Skip(int skip);
Parameters
<a name='CypherQueryBuilder.MatchQuery.Skip(int).skip'></a>
skip
System.Int32
The skip.
Returns
<a name='CypherQueryBuilder.MatchQuery.Union(CypherQueryBuilder.MatchQuery)'></a>
MatchQuery.Union(MatchQuery) Method
Unions the specified other.
public CypherQueryBuilder.UnionQuery Union(CypherQueryBuilder.MatchQuery other);
Parameters
<a name='CypherQueryBuilder.MatchQuery.Union(CypherQueryBuilder.MatchQuery).other'></a>
other
MatchQuery
The other.
Returns
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string)'></a>
MatchQuery.Update<T,K>(Expression<Func<T,K>>, Expression<Func<T,K>>, string) Method
Create Update Query.
public virtual CypherQueryBuilder.UpdateQuery Update<T,K>(Expression<Func<T,K>> propertySelector, Expression<Func<T,K>> valueSelector, string? alias=null);
Type parameters
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string).T'></a>
T
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string).K'></a>
K
Parameters
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string).propertySelector'></a>
propertySelector
System.Linq.Expressions.Expression
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string).valueSelector'></a>
valueSelector
System.Linq.Expressions.Expression
<a name='CypherQueryBuilder.MatchQuery.Update_T,K_(Expression_Func_T,K__,Expression_Func_T,K__,string).alias'></a>
alias
System.String
Returns
UpdateQuery
UpdateQuery
Example
var r = 2010;
var mNode = Node<Movie>.Instance().Where(p => p.ReleaseYear > 500);
var q = Query
.Match(mNode)
.Update<Movie, int>(p => p.ReleaseYear, p => r)
.Return<Movie>()
.OrderBy<Movie, int>(m => m.ReleaseYear)
.Return<Movie>(p => new { p.Title, p.ReleaseYear });
var str = q.Compile();
<a name='CypherQueryBuilder.MatchQuery.Where(string)'></a>
MatchQuery.Where(string) Method
Wheres the specified clause.
public CypherQueryBuilder.MatchQuery Where(string clause);
Parameters
<a name='CypherQueryBuilder.MatchQuery.Where(string).clause'></a>
clause
System.String
The clause.
Returns
<a name='CypherQueryBuilder.Node'></a>
Node Class
public class Node : CypherQueryBuilder.Entity
Inheritance System.Object 🡒 CypherQueryBuilder.Entity 🡒 Node
Derived
↳ Node<T>
Methods
<a name='CypherQueryBuilder.Node.Compile()'></a>
Node.Compile() Method
Compiles this instance Cipher queryable string format.
public override ValueTuple<string,string> Compile();
Implements Compile()
Returns
System.ValueTuple
ValueTuple of (string match, string where).
<a name='CypherQueryBuilder.Node.Instance_T_(int)'></a>
Node.Instance<T>(int) Method
Create a new Instance of node type T with alias suffixed with sequence
public static CypherQueryBuilder.Node<T> Instance<T>(int sequence=0);
Type parameters
<a name='CypherQueryBuilder.Node.Instance_T_(int).T'></a>
T
Parameters
<a name='CypherQueryBuilder.Node.Instance_T_(int).sequence'></a>
sequence
System.Int32
Returns
CypherQueryBuilder.Node<T>
New node of type T
Remarks
sequence will be default to zero if not provided
See Also
<a name='CypherQueryBuilder.Node.Instance_T_(T,int)'></a>
Node.Instance<T>(T, int) Method
Create a new Instance of node type T with alias suffixed with sequence
public static CypherQueryBuilder.Node<T> Instance<T>(T obj, int sequence=0);
Type parameters
<a name='CypherQueryBuilder.Node.Instance_T_(T,int).T'></a>
T
Parameters
<a name='CypherQueryBuilder.Node.Instance_T_(T,int).obj'></a>
obj
T
The object.
<a name='CypherQueryBuilder.Node.Instance_T_(T,int).sequence'></a>
sequence
System.Int32
Returns
CypherQueryBuilder.Node<T>
New node of type T
Remarks
sequence will be default to zero if not provided
See Also
<a name='CypherQueryBuilder.Node.WithLabels(string[])'></a>
Node.WithLabels(string[]) Method
Applies the labels fo the node.
public virtual CypherQueryBuilder.Node WithLabels(params string[] labels);
Parameters
<a name='CypherQueryBuilder.Node.WithLabels(string[]).labels'></a>
labels
System.String[]
The labels.
Implements WithLabels(string[])
Returns
<a name='CypherQueryBuilder.Node.WithProperty(object)'></a>
Node.WithProperty(object) Method
Configure the property.
public virtual CypherQueryBuilder.Node WithProperty(object obj);
Parameters
<a name='CypherQueryBuilder.Node.WithProperty(object).obj'></a>
obj
System.Object
The object.
Implements WithProperty(object)
Returns
Node
The same node
See Also
<a name='CypherQueryBuilder.Node.WithProperty(string,object)'></a>
Node.WithProperty(string, object) Method
Configure the property.
public virtual CypherQueryBuilder.Node WithProperty(string key, object? value);
Parameters
<a name='CypherQueryBuilder.Node.WithProperty(string,object).key'></a>
key
System.String
The key.
<a name='CypherQueryBuilder.Node.WithProperty(string,object).value'></a>
value
System.Object
The value.
Implements WithProperty(string, object)
Returns
Node
The same node
See Also
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[])'></a>
Node.WithRelation(Node, string, object, bool, string[]) Method
Configure the relation with another node.
public CypherQueryBuilder.Node WithRelation(CypherQueryBuilder.Node to, string relationAlias, object? relationProperties=null, bool isForward=true, params string[] labels);
Parameters
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[]).to'></a>
to
Node
To.
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[]).relationAlias'></a>
relationAlias
System.String
The relation alias.
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[]).relationProperties'></a>
relationProperties
System.Object
The relation properties.
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[]).isForward'></a>
isForward
System.Boolean
if set to true
[is forward].
<a name='CypherQueryBuilder.Node.WithRelation(CypherQueryBuilder.Node,string,object,bool,string[]).labels'></a>
labels
System.String[]
The labels.
Returns
Node
The same node
<a name='CypherQueryBuilder.Node_T_'></a>
Node<T> Class
public class Node<T> : CypherQueryBuilder.Node
Type parameters
<a name='CypherQueryBuilder.Node_T_.T'></a>
T
Inheritance System.Object 🡒 CypherQueryBuilder.Entity 🡒 Node 🡒 Node<T>
Methods
<a name='CypherQueryBuilder.Node_T_.Instance(CypherQueryBuilder.Node_T_,int)'></a>
Node<T>.Instance(Node<T>, int) Method
Create a new Instance of node type <span class="typeparameter">T</span> with alias suffixed with sequence
public static CypherQueryBuilder.Node<T> Instance(out CypherQueryBuilder.Node<T> node, int sequence=0);
Parameters
<a name='CypherQueryBuilder.Node_T_.Instance(CypherQueryBuilder.Node_T_,int).node'></a>
node
CypherQueryBuilder.Node<T>
out parameter
<a name='CypherQueryBuilder.Node_T_.Instance(CypherQueryBuilder.Node_T_,int).sequence'></a>
sequence
System.Int32
Returns
CypherQueryBuilder.Node<T>
New node of type T
Example
Node<Domain>.Instance(out var domainNode).Where(p => p.Uid == "TestDomain");
Node<Group>.Instance(out var groupNode).WithProperty(new { Uid = "gId_1", Name = "GName", Domain = "TestDomain" });
var q = Query.Match(domainNode)
.CreateRelation("hg", "HAS_DOMAIN", groupNode, domainNode, false, new { DomainId = "TestDomain", GroupId = "gId_1" });
var (cq, parameters) = q.CompileWithParemeters();
Console.WriteLine(cq);
Remarks
sequence will be default to zero if not provided
See Also
<a name='CypherQueryBuilder.Node_T_.Instance(int)'></a>
Node<T>.Instance(int) Method
Create a new Instance of node type T with alias suffixed with sequence
public static CypherQueryBuilder.Node<T> Instance(int sequence=0);
Parameters
<a name='CypherQueryBuilder.Node_T_.Instance(int).sequence'></a>
sequence
System.Int32
Returns
CypherQueryBuilder.Node<T>
New node of type T
Remarks
sequence will be default to zero if not provided
See Also
<a name='CypherQueryBuilder.Node_T_.Instance(T,int)'></a>
Node<T>.Instance(T, int) Method
Create a new Instance of node type T with alias suffixed with sequence
public static CypherQueryBuilder.Node<T> Instance(T obj, int sequence=0);
Parameters
<a name='CypherQueryBuilder.Node_T_.Instance(T,int).obj'></a>
obj
T
The object.
<a name='CypherQueryBuilder.Node_T_.Instance(T,int).sequence'></a>
sequence
System.Int32
The sequence.
Returns
CypherQueryBuilder.Node<T>
New node of type T
Remarks
sequence will be default to zero if not provided
See Also
<a name='CypherQueryBuilder.Node_T_.Where(Expression_Func_T,bool__)'></a>
Node<T>.Where(Expression<Func<T,bool>>) Method
Applies filter or Where clause.
public CypherQueryBuilder.Node<T> Where(Expression<Func<T,bool>> expr);
Parameters
<a name='CypherQueryBuilder.Node_T_.Where(Expression_Func_T,bool__).expr'></a>
expr
System.Linq.Expressions.Expression
The expr.
Returns
CypherQueryBuilder.Node<T>
The same node of type T
<a name='CypherQueryBuilder.Node_T_.WithProperty(object)'></a>
Node<T>.WithProperty(object) Method
Configure the property.
public virtual CypherQueryBuilder.Node<T> WithProperty(object obj);
Parameters
<a name='CypherQueryBuilder.Node_T_.WithProperty(object).obj'></a>
obj
System.Object
The object.
Implements WithProperty(object)
Returns
CypherQueryBuilder.Node<T>
The same node of type T
See Also
<a name='CypherQueryBuilder.Node_T_.WithProperty(string,object)'></a>
Node<T>.WithProperty(string, object) Method
Configure the property.
public virtual CypherQueryBuilder.Node<T> WithProperty(string key, object? value);
Parameters
<a name='CypherQueryBuilder.Node_T_.WithProperty(string,object).key'></a>
key
System.String
The key.
<a name='CypherQueryBuilder.Node_T_.WithProperty(string,object).value'></a>
value
System.Object
The value.
Implements WithProperty(string, object)
Returns
CypherQueryBuilder.Node<T>
The same node of type T
See Also
<a name='CypherQueryBuilder.Node_T_.WithProperty(T)'></a>
Node<T>.WithProperty(T) Method
Configure the property.
public CypherQueryBuilder.Node<T> WithProperty(T obj);
Parameters
<a name='CypherQueryBuilder.Node_T_.WithProperty(T).obj'></a>
obj
T
The object.
Returns
<a name='CypherQueryBuilder.NodeCreationQuery'></a>
NodeCreationQuery Class
public class NodeCreationQuery : CypherQueryBuilder.QueryBase
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase 🡒 NodeCreationQuery
Methods
<a name='CypherQueryBuilder.NodeCreationQuery.Compile()'></a>
NodeCreationQuery.Compile() Method
Compiles this instance to Cypher Query string.
public override string Compile();
Returns
System.String
Cypher Query string
<a name='CypherQueryBuilder.NodeCreationQuery.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[])'></a>
NodeCreationQuery.Merge(Node, Node[]) Method
Merges the specified node.
public CypherQueryBuilder.NodeCreationQuery Merge(CypherQueryBuilder.Node node, params CypherQueryBuilder.Node[] otherNodes);
Parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).node'></a>
node
Node
The node.
<a name='CypherQueryBuilder.NodeCreationQuery.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).otherNodes'></a>
The other nodes.
Returns
<a name='CypherQueryBuilder.NodeCreationQuery.ReleaseResources()'></a>
NodeCreationQuery.ReleaseResources() Method
Releases the resources.
public override void ReleaseResources();
<a name='CypherQueryBuilder.NodeCreationQuery.Return(string[])'></a>
NodeCreationQuery.Return(string[]) Method
Returns the specified returns.
public virtual CypherQueryBuilder.NodeCreationQuery Return(params string[] returns);
Parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Return(string[]).returns'></a>
returns
System.String[]
The returns.
Returns
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool)'></a>
NodeCreationQuery.Return<T>(Node<T>, Expression<Func<T,object>>, bool) Method
Returns the specified node.
public virtual CypherQueryBuilder.NodeCreationQuery Return<T>(CypherQueryBuilder.Node<T> node, Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).node'></a>
node
CypherQueryBuilder.Node<T>
The node.
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(Expression_Func_T,object__,bool)'></a>
NodeCreationQuery.Return<T>(Expression<Func<T,object>>, bool) Method
Returns the specified f.
public CypherQueryBuilder.NodeCreationQuery Return<T>(Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.NodeCreationQuery.Return_T_(Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
<a name='CypherQueryBuilder.Query'></a>
Query Class
Query
- The main entry point to build cypher query for create, merge or match
public static class Query
Inheritance System.Object 🡒 Query
Methods
<a name='CypherQueryBuilder.Query.Create(bool,CypherQueryBuilder.Node,CypherQueryBuilder.Node[])'></a>
Query.Create(bool, Node, Node[]) Method
Creates the specified to merge.
private static CypherQueryBuilder.NodeCreationQuery Create(bool toMerge, CypherQueryBuilder.Node node, params CypherQueryBuilder.Node[] otherNodes);
Parameters
<a name='CypherQueryBuilder.Query.Create(bool,CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).toMerge'></a>
toMerge
System.Boolean
if set to true
[to merge].
<a name='CypherQueryBuilder.Query.Create(bool,CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).node'></a>
node
Node
The node.
<a name='CypherQueryBuilder.Query.Create(bool,CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).otherNodes'></a>
The other nodes.
Returns
<a name='CypherQueryBuilder.Query.Create(CypherQueryBuilder.Node,CypherQueryBuilder.Node[])'></a>
Query.Create(Node, Node[]) Method
Creates the specified node.
public static CypherQueryBuilder.NodeCreationQuery Create(CypherQueryBuilder.Node node, params CypherQueryBuilder.Node[] otherNodes);
Parameters
<a name='CypherQueryBuilder.Query.Create(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).node'></a>
node
Node
Node to Instance
<a name='CypherQueryBuilder.Query.Create(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).otherNodes'></a>
Other nodes to match in case multiple nodes to be created.
Returns
NodeCreationQuery
NodeCreationQuery
Example
Example to build create query.
var movie = new Movie() { ReleaseYear = 2010, Title = "Gambler" };
var q = Query.Instance(
Node<Movie>.Instance(movie)
.WithRelation(Node<Person>.Instance(new Person {Age = 30, FullName = "Ray" }), "DIRECTED_BY"))
.Return<Movie>(p => new { p.Title, p.ReleaseYear }).Return<Person>(p => new { p.FullName});
var str = q.Compile();
<a name='CypherQueryBuilder.Query.Match(CypherQueryBuilder.Node,CypherQueryBuilder.Node[])'></a>
Query.Match(Node, Node[]) Method
Matches the specified node.
public static CypherQueryBuilder.MatchQuery Match(CypherQueryBuilder.Node node, params CypherQueryBuilder.Node[] otherNodes);
Parameters
<a name='CypherQueryBuilder.Query.Match(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).node'></a>
node
Node
Node to Match
<a name='CypherQueryBuilder.Query.Match(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).otherNodes'></a>
Other nodes to match in case multiple nodes to be matched
Returns
MatchQuery
MatchQuery
Example
var q = Query.Match(n).Return("n", "r", "m");
<a name='CypherQueryBuilder.Query.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[])'></a>
Query.Merge(Node, Node[]) Method
Merges the specified node.
public static CypherQueryBuilder.NodeCreationQuery Merge(CypherQueryBuilder.Node node, params CypherQueryBuilder.Node[] otherNodes);
Parameters
<a name='CypherQueryBuilder.Query.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).node'></a>
node
Node
The node.
<a name='CypherQueryBuilder.Query.Merge(CypherQueryBuilder.Node,CypherQueryBuilder.Node[]).otherNodes'></a>
The other nodes in case multiple nodes to be merged.
Returns
NodeCreationQuery
NodeCreationQuery
Example
Example to build merge query.
var movie = new Movie() { ReleaseYear = 2010, Title = "Gambler" };
var q = Query.Merge(
Node<Movie>.Instance(movie)
.WithRelation(Node<Person>.Instance(new Person {Age = 30, FullName = "Ray" }), "DIRECTED_BY"))
.Return<Movie>(p => new { p.Title, p.ReleaseYear }).Return<Person>(p => new { p.FullName});
var str = q.Compile();
<a name='CypherQueryBuilder.QueryBase'></a>
QueryBase Class
public abstract class QueryBase : Utility.Disposable
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase
Derived
↳ MatchQuery
↳ NodeCreationQuery
Methods
<a name='CypherQueryBuilder.QueryBase.Compile()'></a>
QueryBase.Compile() Method
Compiles this instance to Cypher Query string.
public abstract string Compile();
Returns
System.String
Cypher Query string
<a name='CypherQueryBuilder.QueryBase.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool)'></a>
QueryBase.Return<T>(Node<T>, Expression<Func<T,object>>, bool) Method
Collect data to build return parts whilde compiling.
public virtual CypherQueryBuilder.QueryBase Return<T>(CypherQueryBuilder.Node<T> node, Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.QueryBase.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.QueryBase.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).node'></a>
node
CypherQueryBuilder.Node<T>
The node.
<a name='CypherQueryBuilder.QueryBase.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.QueryBase.Return_T_(CypherQueryBuilder.Node_T_,Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
See Also
- CypherQueryBuilder.QueryBase.Return(System.String[])
- Return<T>(string, Expression<Func<T,object>>, bool)
<a name='CypherQueryBuilder.QueryBase.Return_T_(string,Expression_Func_T,object__,bool)'></a>
QueryBase.Return<T>(string, Expression<Func<T,object>>, bool) Method
Collect data to build return parts whilde compiling.
public virtual CypherQueryBuilder.QueryBase Return<T>(string? alias, Expression<Func<T,object>> f, bool aliasToBeRemoved=true);
Type parameters
<a name='CypherQueryBuilder.QueryBase.Return_T_(string,Expression_Func_T,object__,bool).T'></a>
T
Parameters
<a name='CypherQueryBuilder.QueryBase.Return_T_(string,Expression_Func_T,object__,bool).alias'></a>
alias
System.String
The alias.
<a name='CypherQueryBuilder.QueryBase.Return_T_(string,Expression_Func_T,object__,bool).f'></a>
f
System.Linq.Expressions.Expression
The f.
<a name='CypherQueryBuilder.QueryBase.Return_T_(string,Expression_Func_T,object__,bool).aliasToBeRemoved'></a>
aliasToBeRemoved
System.Boolean
if set to true
[alias to be removed].
Returns
See Also
- CypherQueryBuilder.QueryBase.Return(System.String[])
- Return<T>(Node<T>, Expression<Func<T,object>>, bool)
<a name='CypherQueryBuilder.UpdateQuery'></a>
UpdateQuery Class
public class UpdateQuery : CypherQueryBuilder.MatchQuery
Inheritance System.Object 🡒 Utility.Disposable 🡒 QueryBase 🡒 MatchQuery 🡒 UpdateQuery
Methods
<a name='CypherQueryBuilder.UpdateQuery.Compile()'></a>
UpdateQuery.Compile() Method
Compiles this instance to Cypher Query string.
public override string Compile();
Returns
System.String
Cypher Query string
See Also
<a name='CypherQueryBuilder.UpdateQuery.CompileWithParemeters()'></a>
UpdateQuery.CompileWithParemeters() Method
Compiles the instance to Cypher Query string with paremeters.
public override ValueTuple<string,Dictionary<string,object?>> CompileWithParemeters();
Returns
System.ValueTuple
ValueTuple<string, Dictionary<string, Nullable<Object>>>
Example
Usage:
var metaDataCount = 2;
var metaDataNodes = new Node<MetaData>[metaDataCount];
for (int i = 0; i < metaDataCount; i++)
{
var id = $"mId_{i}";
metaDataNodes[i] = Node<MetaData>.Instance(i).Where(p => p.Uid == id);
}
var domainNode = Node<Domain>.Instance().Where(p => p.Uid == "TestDomain");
var (mq, parameters) = Query.Match(domainNode, metaDataNodes).CompileAsParemeterized();
See Also
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. |
-
net8.0
- Currying (>= 1.0.4)
- ExpressionTreeToStringWithCypher (>= 1.1.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.10.0)
- Microsoft.CodeAnalysis.CSharp.Scripting (>= 4.10.0)
- Microsoft.IdentityModel.Tokens (>= 7.6.3)
- Utility.Disposable (>= 1.1.1)
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 | |
---|---|---|---|
1.7.4 | 82 | 11/11/2024 | |
1.7.3 | 76 | 11/5/2024 | |
1.7.2 | 68 | 10/29/2024 | |
1.7.1 | 106 | 9/25/2024 | |
1.7.0 | 92 | 9/24/2024 | |
1.6.2 | 106 | 9/11/2024 | |
1.6.1 | 81 | 8/2/2024 | |
1.6.0 | 59 | 7/31/2024 | |
1.5.2 | 71 | 7/26/2024 | |
1.5.1 | 100 | 7/24/2024 | |
1.5.0 | 97 | 7/15/2024 | |
1.4.2 | 87 | 7/12/2024 | |
1.4.1 | 91 | 7/12/2024 | |
1.4.0 | 79 | 7/12/2024 | |
1.3.2 | 110 | 7/9/2024 | |
1.3.1 | 96 | 7/5/2024 | |
1.3.0 | 97 | 7/5/2024 | |
1.2.0 | 107 | 7/2/2024 | |
1.1.1 | 105 | 7/1/2024 | |
1.1.0 | 106 | 6/29/2024 | |
1.0.0 | 127 | 6/25/2024 |