-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added graph depth, direction, startvertex expression nodes
- Loading branch information
Showing
9 changed files
with
220 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/ArangoDB.Client/Query/Clause/GraphDepthExpressionNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Remotion.Linq; | ||
using Remotion.Linq.Parsing.Structure.IntermediateModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ArangoDB.Client.Query.Clause | ||
{ | ||
public class GraphDepthExpressionNode : MethodCallExpressionNodeBase | ||
{ | ||
public static readonly MethodInfo[] SupportedMethods = new[] | ||
{ | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.Depth<object,object>(null, 0, 0)) | ||
}; | ||
|
||
public ConstantExpression Min { get; private set; } | ||
|
||
public ConstantExpression Max { get; private set; } | ||
|
||
public GraphDepthExpressionNode(MethodCallExpressionParseInfo parseInfo, | ||
ConstantExpression min, | ||
ConstantExpression max) | ||
: base(parseInfo) | ||
{ | ||
Min = min; | ||
Max = max; | ||
} | ||
|
||
public Expression Count { get; private set; } | ||
|
||
|
||
public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("inputParameter", inputParameter); | ||
LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); | ||
|
||
return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); | ||
} | ||
|
||
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("queryModel", queryModel); | ||
|
||
var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; | ||
|
||
traversalClause.Min = Min; | ||
traversalClause.Max = Max; | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/ArangoDB.Client/Query/Clause/GraphDirectionExpressionNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using Remotion.Linq; | ||
using Remotion.Linq.Parsing.Structure.IntermediateModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ArangoDB.Client.Query.Clause | ||
{ | ||
public class GraphDirectionExpressionNode : MethodCallExpressionNodeBase | ||
{ | ||
public static readonly MethodInfo[] SupportedMethods = new[] | ||
{ | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.InBound<object,object>(null, null)), | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.OutBound<object,object>(null, null)), | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.AnyDirection<object,object>(null, null)) | ||
}; | ||
|
||
public ConstantExpression Direction { get; private set; } | ||
|
||
public GraphDirectionExpressionNode(MethodCallExpressionParseInfo parseInfo, | ||
ConstantExpression direction) | ||
: base(parseInfo) | ||
{ | ||
Direction = direction; | ||
} | ||
|
||
public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("inputParameter", inputParameter); | ||
LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); | ||
|
||
return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); | ||
} | ||
|
||
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("queryModel", queryModel); | ||
|
||
var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; | ||
|
||
traversalClause.Direction = Direction; | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/ArangoDB.Client/Query/Clause/GraphStartVertexExpressionNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Remotion.Linq; | ||
using Remotion.Linq.Parsing.Structure.IntermediateModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ArangoDB.Client.Query.Clause | ||
{ | ||
public class GraphStartVertexExpressionNode : MethodCallExpressionNodeBase | ||
{ | ||
public static readonly MethodInfo[] SupportedMethods = new[] | ||
{ | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.StartVertex<object,object>(null, "")), | ||
LinqUtility.GetSupportedMethod(()=>QueryableExtensions.StartVertex<object,object>(null, ()=>"")) | ||
}; | ||
|
||
public Expression StartVertex { get; private set; } | ||
|
||
public GraphStartVertexExpressionNode(MethodCallExpressionParseInfo parseInfo, | ||
Expression startVertex) | ||
: base(parseInfo) | ||
{ | ||
StartVertex = startVertex; | ||
} | ||
|
||
public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("inputParameter", inputParameter); | ||
LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); | ||
|
||
return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); | ||
} | ||
|
||
protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, ClauseGenerationContext clauseGenerationContext) | ||
{ | ||
LinqUtility.CheckNotNull("queryModel", queryModel); | ||
|
||
var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; | ||
|
||
traversalClause.StartVertex = StartVertex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters