Permalink
Browse files

Merge remote-tracking branch 'remotes/origin/master' into defundef_at…

…tr_ps
  • Loading branch information...
2 parents e274bc0 + 57fc2ce commit cc4c0556eac3993725435113c9ca68fbd2cdaa80 @sunlounger sunlounger committed Oct 7, 2011
Showing with 1,101 additions and 291 deletions.
  1. +12 −1 GraphDB/IGraphDB/Expression/Tree/BinaryExpression.cs
  2. +1 −1 GraphDB/IGraphDB/IGraphDB.csproj
  3. +35 −3 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/AComparativeIndexOperator.cs
  4. +18 −5 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/Equals/QueryPlanEqualsWithIndex.cs
  5. +17 −2 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/Greater/QueryPlanGreaterWithIndex.cs
  6. +17 −4 ...mentations/SonesGraphDB/Expression/QueryPlan/GreaterOrEquals/QueryPlanGreaterOrEqualsWithIndex.cs
  7. +28 −3 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/InRange/QueryPlanInRangeWithIndex.cs
  8. +18 −4 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/Less/QueryPlanLessThanWithIndex.cs
  9. +18 −4 ...lementations/SonesGraphDB/Expression/QueryPlan/LessOrEquals/QueryPlanLessOrEqualsThanWithIndex.cs
  10. +19 −5 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/Like/QueryPlanLikeWithIndex.cs
  11. +18 −5 GraphDB/Implementations/SonesGraphDB/Expression/QueryPlan/NotEquals/QueryPlanNotEqualsWithIndex.cs
  12. +7 −0 GraphDB/Implementations/SonesGraphDB/Manager/Index/IIndexManager.cs
  13. +5 −0 GraphDB/Implementations/SonesGraphDB/Manager/Index/IndexManager.cs
  14. +346 −87 GraphDB/Implementations/SonesGraphDB/Manager/QueryPlan/QueryPlanManager.cs
  15. +0 −15 GraphDB/Implementations/SonesGraphDB/Manager/TypeManagement/ExecuteVertexTypeManager.cs
  16. +0 −51 GraphDB/Implementations/SonesGraphDB/Manager/Vertex/ExecuteVertexHandler.cs
  17. +1 −1 GraphDB/Implementations/SonesGraphDB/SonesGraphDB.csproj
  18. +1 −1 GraphDS/PluginManager/GraphDSPluginManager/GraphDSPluginManager.csproj
  19. +1 −1 GraphDS/Server/Implementations/GraphDSServer/GraphDSServer.csproj
  20. +42 −0 ...QL/Implementations/SonesGraphQueryLanguage/ErrorHandling/InvalidBinaryExpressionIndexException.cs
  21. +4 −1 GraphQL/Implementations/SonesGraphQueryLanguage/ErrorHandling/IronyInitializeGrammarException.cs
  22. +31 −3 GraphQL/Implementations/SonesGraphQueryLanguage/Grammar/SonesGQLGrammar.cs
  23. +3 −1 GraphQL/Implementations/SonesGraphQueryLanguage/SonesGraphQueryLanguage.csproj
  24. +6 −1 GraphQL/Implementations/SonesGraphQueryLanguage/StatementNodes/AStatement.cs
  25. +5 −1 GraphQL/Implementations/SonesGraphQueryLanguage/StatementNodes/DML/SelectNode.cs
  26. +84 −22 ...Implementations/SonesGraphQueryLanguage/Structure/Helper/Definition/BinaryExpressionDefinition.cs
  27. +121 −25 GraphQL/Implementations/SonesGraphQueryLanguage/Structure/Helper/Operator/ABinaryCompareOperator.cs
  28. +10 −4 GraphQL/Implementations/SonesGraphQueryLanguage/Structure/Nodes/Expressions/BinaryExpressionNode.cs
  29. +0 −2 GraphQL/Implementations/SonesGraphQueryLanguage/Structure/Nodes/Expressions/WhereExpressionNode.cs
  30. +53 −0 GraphQL/Implementations/SonesGraphQueryLanguage/Structure/Nodes/Misc/UseIndexNode.cs
  31. +1 −1 Library/Internal/Commons/Commons.csproj
  32. +1 −1 Plugins/GraphDS/Services/Implementations/RESTService/RESTService.csproj
  33. +166 −25 Plugins/GraphQL/SonesGQL/Functions/GraphAlgorithms/Dijkstra/Dijkstra.cs
  34. +11 −10 Plugins/GraphQL/SonesGQL/Functions/GraphAlgorithms/Dijkstra/dataDijkstra.cs
  35. +1 −1 ...s/GraphQL/SonesGQL/Functions/GraphAlgorithms/ShortestPathAlgorithms/ShortestPathAlgorithms.csproj
@@ -42,6 +42,11 @@ public sealed class BinaryExpression : IExpression
/// </summary>
public readonly IExpression Right;
+ /// <summary>
+ /// The index which should be used to resolve the expression.
+ /// </summary>
+ public readonly string ExpressionIndex = null;
+
#endregion
#region Constructor
@@ -52,11 +57,17 @@ public sealed class BinaryExpression : IExpression
/// <param name="myLeftExpression">The left side of the BinaryExpression</param>
/// <param name="myBinaryOperator">The binary operator</param>
/// <param name="myRightExpression">The right side of the BinaryExpression</param>
- public BinaryExpression (IExpression myLeftExpression, BinaryOperator myBinaryOperator, IExpression myRightExpression)
+ /// <param name="myExpressionIndex">The index which should be used for the expression</param>
+ public BinaryExpression (IExpression myLeftExpression,
+ BinaryOperator myBinaryOperator,
+ IExpression myRightExpression,
+ string myExpressionIndex = null)
{
Left = myLeftExpression;
Right = myRightExpression;
Operator = myBinaryOperator;
+
+ ExpressionIndex = myExpressionIndex;
}
#endregion
@@ -238,7 +238,7 @@
</ProjectReference>
<ProjectReference Include="..\..\Library\Internal\VersionedPluginManager\PluginManager.csproj">
<Project>{1F652BC0-ECEE-409B-8EFB-51276C41EAD1}</Project>
- <Name>PluginManager %28Library\Internal\PluginManager%29</Name>
+ <Name>PluginManager %28Dependencies\Library\Internal\PluginManager%29</Name>
</ProjectReference>
<ProjectReference Include="..\..\Plugins\Index\ISonesIndex\ISonesIndex.csproj">
<Project>{823E8AF4-CF92-4E74-8ABD-38693279EB1E}</Project>
@@ -27,6 +27,7 @@
using sones.Library.Commons.VertexStore;
using sones.Library.PropertyHyperGraph;
using sones.Plugins.Index;
+using sones.GraphDB.ErrorHandling;
namespace sones.GraphDB.Expression.QueryPlan
{
@@ -69,6 +70,11 @@ public abstract class AComparativeIndexOperator
/// </summary>
protected readonly Boolean _isLongrunning;
+ /// <summary>
+ /// The name of the index which is used for resolving the expression
+ /// </summary>
+ protected readonly String _expressionIndex;
+
#endregion
#region constructor
@@ -83,7 +89,14 @@ public abstract class AComparativeIndexOperator
/// <param name="myTransactionToken">The current transaction token</param>
/// <param name="myIndexManager">The index manager is needed to get the property related indices</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
- protected AComparativeIndexOperator(QueryPlanProperty myProperty, ILiteralExpression myConstant, Boolean myIsLongrunning, SecurityToken mySecurityToken, Int64 myTransactionToken, IIndexManager myIndexManager, IVertexStore myVertexStore)
+ protected AComparativeIndexOperator(QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ Boolean myIsLongrunning,
+ SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ IIndexManager myIndexManager,
+ IVertexStore myVertexStore,
+ String myExpressionIndex = null)
{
_property = myProperty;
_constant = myConstant;
@@ -92,6 +105,7 @@ protected AComparativeIndexOperator(QueryPlanProperty myProperty, ILiteralExpres
_indexManager = myIndexManager;
_securityToken = mySecurityToken;
_transactionToken = myTransactionToken;
+ _expressionIndex = myExpressionIndex;
}
#endregion
@@ -151,15 +165,33 @@ protected IEnumerable<IVertex> Execute_protected(IVertexType myVertexType)
if (!myVertexType.IsAbstract)
{
- var idx = GetBestMatchingIdx(_indexManager.GetIndices(myVertexType, _property.Property, _securityToken, _transactionToken));
+ ISonesIndex idx = null;
+
+ if (_expressionIndex != null)
+ idx = _indexManager.GetIndex(_expressionIndex, _securityToken, _transactionToken);
+ else
+ idx = GetBestMatchingIdx(_indexManager.GetIndices(myVertexType,
+ _property.Property,
+ _securityToken,
+ _transactionToken));
+
+ if (idx == null)
+ throw new IndexDoesNotExistException(
+ _expressionIndex == null ? "no index name specified" : _expressionIndex,
+ "default");
var values = GetValues(idx, _constant.Value);
if (values != null)
{
foreach (var aVertexID in values)
{
- vertices.Add(_vertexStore.GetVertex(_securityToken, _transactionToken, aVertexID, myVertexType.ID, VertexEditionFilter, VertexRevisionFilter));
+ vertices.Add(_vertexStore.GetVertex(_securityToken,
+ _transactionToken,
+ aVertexID,
+ myVertexType.ID,
+ VertexEditionFilter,
+ VertexRevisionFilter));
}
}
}
@@ -46,11 +46,24 @@ public sealed class QueryPlanEqualsWithIndex : AComparativeIndexOperator, IQuery
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanEqualsWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, ILiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
- :base(myProperty, myConstant, myIsLongrunning, mySecurityToken, myTransactionToken, myIndexManager, myVertexStore)
- {
-
- }
+ /// <param name="myExpressionIndex">The index name which is used for resolving the expression</param>
+ public QueryPlanEqualsWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
+ :base(myProperty,
+ myConstant,
+ myIsLongrunning,
+ mySecurityToken,
+ myTransactionToken,
+ myIndexManager,
+ myVertexStore,
+ myExpressionIndex)
+ { }
#endregion
@@ -47,8 +47,23 @@ public sealed class QueryPlanGreaterThanWithIndex : AComparativeIndexOperator, I
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanGreaterThanWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, ILiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
- : base(myProperty, myConstant, myIsLongrunning, mySecurityToken, myTransactionToken, myIndexManager, myVertexStore)
+ /// <param name="myExpressionIndex">The index name which is used for resolving the expression</param>
+ public QueryPlanGreaterThanWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
+ : base(myProperty,
+ myConstant,
+ myIsLongrunning,
+ mySecurityToken,
+ myTransactionToken,
+ myIndexManager,
+ myVertexStore,
+ myExpressionIndex)
{
}
@@ -47,10 +47,23 @@ public sealed class QueryPlanGreaterOrEqualsWithIndex : AComparativeIndexOperato
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanGreaterOrEqualsWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, ILiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
- : base(myProperty, myConstant, myIsLongrunning, mySecurityToken, myTransactionToken, myIndexManager, myVertexStore)
- {
- }
+ public QueryPlanGreaterOrEqualsWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
+ : base(myProperty,
+ myConstant,
+ myIsLongrunning,
+ mySecurityToken,
+ myTransactionToken,
+ myIndexManager,
+ myVertexStore,
+ myExpressionIndex)
+ { }
#endregion
@@ -72,6 +72,11 @@ public sealed class QueryPlanInRangeWithIndex : IQueryPlan
/// Determines whether it is anticipated that the request could take longer
/// </summary>
private readonly Boolean _isLongrunning;
+
+ /// <summary>
+ /// The name of the index which is used for resolving the expression
+ /// </summary>
+ protected readonly String _expressionIndex;
#endregion
@@ -86,14 +91,23 @@ public sealed class QueryPlanInRangeWithIndex : IQueryPlan
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanInRangeWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, RangeLiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
+ /// <param name="myExpressionIndex">The index name which is used for resolving the expression</param>
+ public QueryPlanInRangeWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ RangeLiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
{
_securityToken = mySecurityToken;
_transactionToken = myTransactionToken;
_property = myProperty;
_constant = myConstant;
_vertexStore = myVertexStore;
_isLongrunning = myIsLongrunning;
+ _expressionIndex = myExpressionIndex;
}
#endregion
@@ -138,10 +152,21 @@ private IEnumerable<IVertex> Execute_private(IVertexType myVertexType)
{
#region current type
- var idx = GetBestMatchingIdx(_indexManager.GetIndices(_property.Property, _securityToken, _transactionToken));
+ ISonesIndex idx = null;
+
+ if (_expressionIndex != null)
+ idx = _indexManager.GetIndex(_expressionIndex, _securityToken, _transactionToken);
+ else
+ idx = GetBestMatchingIdx(_indexManager.GetIndices(_property.Property, _securityToken, _transactionToken));
foreach (var aVertex in GetValues(idx, _constant)
- .Select(aId => _vertexStore.GetVertex(_securityToken, _transactionToken, aId, myVertexType.ID, VertexEditionFilter, VertexRevisionFilter)))
+ .Select(aId => _vertexStore.GetVertex(
+ _securityToken,
+ _transactionToken,
+ aId,
+ myVertexType.ID,
+ VertexEditionFilter,
+ VertexRevisionFilter)))
{
yield return aVertex;
}
@@ -47,10 +47,24 @@ public sealed class QueryPlanLessThanWithIndex : AComparativeIndexOperator, IQue
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanLessThanWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, ILiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
- : base(myProperty, myConstant, myIsLongrunning, mySecurityToken, myTransactionToken, myIndexManager, myVertexStore)
- {
- }
+ /// <param name="myExpressionIndex">The name of the index which is used to resolve the expression</param>
+ public QueryPlanLessThanWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
+ : base(myProperty,
+ myConstant,
+ myIsLongrunning,
+ mySecurityToken,
+ myTransactionToken,
+ myIndexManager,
+ myVertexStore,
+ myExpressionIndex)
+ { }
#endregion
@@ -47,10 +47,24 @@ public sealed class QueryPlanLessOrEqualsThanWithIndex : AComparativeIndexOperat
/// <param name="myConstant">The constant value</param>
/// <param name="myVertexStore">The vertex store that is needed to load the vertices</param>
/// <param name="myIsLongrunning">Determines whether it is anticipated that the request could take longer</param>
- public QueryPlanLessOrEqualsThanWithIndex(SecurityToken mySecurityToken, Int64 myTransactionToken, QueryPlanProperty myProperty, ILiteralExpression myConstant, IVertexStore myVertexStore, Boolean myIsLongrunning, IIndexManager myIndexManager)
- : base(myProperty, myConstant, myIsLongrunning, mySecurityToken, myTransactionToken, myIndexManager, myVertexStore)
- {
- }
+ /// <param name="myExpressionIndex">The name of the index which is used to resolve the expression</param>
+ public QueryPlanLessOrEqualsThanWithIndex(SecurityToken mySecurityToken,
+ Int64 myTransactionToken,
+ QueryPlanProperty myProperty,
+ ILiteralExpression myConstant,
+ IVertexStore myVertexStore,
+ Boolean myIsLongrunning,
+ IIndexManager myIndexManager,
+ String myExpressionIndex = null)
+ : base(myProperty,
+ myConstant,
+ myIsLongrunning,
+ mySecurityToken,
+ myTransactionToken,
+ myIndexManager,
+ myVertexStore,
+ myExpressionIndex)
+ { }
#endregion
Oops, something went wrong.

0 comments on commit cc4c055

Please sign in to comment.