本文整理汇总了C#中IExpressionGraph类的典型用法代码示例。如果您正苦于以下问题:C# IExpressionGraph类的具体用法?C# IExpressionGraph怎么用?C# IExpressionGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IExpressionGraph类属于命名空间,在下文中一共展示了IExpressionGraph类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TypeOperation
public static IExpressionGraph TypeOperation(IExpressionGraph myLeftValueObject, IExpressionGraph myRightValueObject, BinaryOperator myOperator)
{
switch (myOperator)
{
case BinaryOperator.AND:
myLeftValueObject.IntersectWith(myRightValueObject);
break;
case BinaryOperator.OR:
myLeftValueObject.UnionWith(myRightValueObject);
break;
case BinaryOperator.Equals:
case BinaryOperator.GreaterOrEqualsThan:
case BinaryOperator.GreaterThan:
case BinaryOperator.InRange:
case BinaryOperator.LessOrEqualsThan:
case BinaryOperator.LessThan:
case BinaryOperator.NotEquals:
default:
throw new ArgumentOutOfRangeException("myOperator");
}
return myLeftValueObject;
}
开发者ID:anukat2015,项目名称:sones,代码行数:26,代码来源:ABinaryLogicalOperator.cs
示例2: CleanGraphUp
private void CleanGraphUp(IExpressionGraph toBeCleanedGraph, IExpressionGraph referenceGraph, int lowerBound, int upperBound)
{
foreach (var aLevel in toBeCleanedGraph.Levels.Where(item => item.Key > lowerBound && item.Key <= upperBound).OrderBy(item => item.Key))
{
CleanLevel(toBeCleanedGraph, referenceGraph, aLevel, null);
}
}
开发者ID:loubo,项目名称:sones,代码行数:7,代码来源:CommonUsageGraph.cs
示例3: UnionWith
public abstract void UnionWith(IExpressionGraph anotherGraph);
开发者ID:anukat2015,项目名称:sones,代码行数:1,代码来源:AExpressionGraph.cs
示例4: BuildDifferenceWith
public abstract void BuildDifferenceWith(IExpressionGraph anotherGraph);
开发者ID:anukat2015,项目名称:sones,代码行数:1,代码来源:AExpressionGraph.cs
示例5: TypeOperation
/// <summary>
/// Finds matching result corresponding to a binary expression.
/// </summary>
/// <param name="myLeftValueObject">The left value of a binary expression.</param>
/// <param name="myRightValueObject">The right value of a binary expression.</param>
/// <returns></returns>
public static IExpressionGraph TypeOperation(
AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject,
GQLPluginManager myPluginManager,
IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken,
TypesOfBinaryExpression typeOfBinExpr, IExpressionGraph resultGr, TypesOfOperators mytypesOfOpertators, BinaryOperator myOperator, Boolean aggregateAllowed = true)
{
#region Data
//DataContainer for all data that is used by a binary expression/comparer
DataContainer data;
#endregion
#region extract data
//data extraction with an eye on the type of the binary expression
switch (typeOfBinExpr)
{
case TypesOfBinaryExpression.Atom:
//sth like 3 = 4
#region Get Atom data
//no further data has to be generated
//data = new DataContainer(null, new Tuple<Object, Object>(myLeftValueObject, myRightValueObject), null);
data = new DataContainer();
#endregion
break;
case TypesOfBinaryExpression.LeftComplex:
//sth like U.Age = 21
#region Get LeftComplex data
data = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, aggregateAllowed);
#endregion
break;
case TypesOfBinaryExpression.RightComplex:
//sth like 21 = U.Age
#region Get RightComplex data
data = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, aggregateAllowed);
#endregion
break;
case TypesOfBinaryExpression.Complex:
//sth like U.Age = F.Alter
#region Get Complex data
var leftData = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, aggregateAllowed);
var rightData = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, aggregateAllowed);
if (typeOfBinExpr == TypesOfBinaryExpression.Unknown)
{
typeOfBinExpr = SetTypeOfBinaryExpression(leftData, rightData);
switch (typeOfBinExpr)
{
case TypesOfBinaryExpression.Atom:
data = new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(null, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(leftData.Operands.Item1, leftData.Operands.Item1), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null));
break;
case TypesOfBinaryExpression.LeftComplex:
data = new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(leftData.IDChainDefinitions.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(rightData.Operands.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null));
break;
case TypesOfBinaryExpression.RightComplex:
data = new DataContainer(new Tuple<IDChainDefinition, IDChainDefinition>(rightData.IDChainDefinitions.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(leftData.Operands.Item1, null), new Tuple<AExpressionDefinition, AExpressionDefinition>(null, null));
break;
case TypesOfBinaryExpression.Complex:
case TypesOfBinaryExpression.Unknown:
default:
throw new NotImplementedQLException("");
}
}
else
{
data = JoinData(leftData, rightData);
}
//.........这里部分代码省略.........
开发者ID:ramz,项目名称:sones,代码行数:101,代码来源:ABinaryCompareOperator.cs
示例6: MatchData
private static void MatchData(DataContainer data, IExpressionGraph resultGraph, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken, TypesOfOperators myTypeOfOperator, BinaryOperator myOperator)
{
#region data
LevelKey myLevelKey = CreateLevelKey(data.IDChainDefinitions.Item1, myGraphDB, mySecurityToken, myTransactionToken);
#endregion
var vertices = myGraphDB.GetVertices<List<IVertex>>(
mySecurityToken,
myTransactionToken,
new GraphDB.Request.RequestGetVertices(
new BinaryExpression(
new PropertyExpression(data.IDChainDefinitions.Item1.LastType.Name, data.IDChainDefinitions.Item1.LastAttribute.Name),
myOperator,
GenerateLiteral(data.Operands.Item1, ((IPropertyDefinition)data.IDChainDefinitions.Item1.LastAttribute).BaseType))),
(stats, vertexEnumerable) => vertexEnumerable.ToList());
foreach (var aVertex in vertices)
{
IntegrateInGraph(aVertex, resultGraph, myLevelKey, myTypeOfOperator);
}
if (resultGraph.ContainsLevelKey(myLevelKey))
{
#region clean lower levels
if (myTypeOfOperator == TypesOfOperators.AffectsLowerLevels)
{
CleanLowerLevel(myLevelKey, resultGraph, myGraphDB, mySecurityToken, myTransactionToken);
}
#endregion
}
else
{
resultGraph.AddEmptyLevel(myLevelKey);
}
}
开发者ID:ramz,项目名称:sones,代码行数:40,代码来源:ABinaryCompareOperator.cs
示例7: CleanLowerLevel
private static void CleanLowerLevel(LevelKey myLevelKey, IExpressionGraph myGraph, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken)
{
if (myLevelKey.Level > 0)
{
var previousLevelKey = myLevelKey.GetPredecessorLevel(myGraphDB, mySecurityToken, myTransactionToken);
HashSet<VertexInformation> toBeDeletedNodes = new HashSet<VertexInformation>();
foreach (var aLowerDBO in myGraph.Select(previousLevelKey, null, false))
{
if (aLowerDBO.HasOutgoingEdge(myLevelKey.LastEdge.AttributeID))
{
foreach (var aVertex in aLowerDBO.GetOutgoingEdge(myLevelKey.LastEdge.AttributeID).GetTargetVertices())
{
//took the vertextype id of the levelkey, because it is possible that the vertextypeid of the vertex is something inheritated
VertexInformation node = new VertexInformation(aVertex.VertexTypeID, aVertex.VertexID);
if (!myGraph.GetLevel(myLevelKey.Level).ExpressionLevels[myLevelKey].Nodes.ContainsKey(node))
{
//a reference occurred that is not in the higher level --> found a Zoidberg
toBeDeletedNodes.Add(node);
break;
}
}
}
}
foreach (var aToBeDeletedNode in toBeDeletedNodes)
{
myGraph.GetLevel(previousLevelKey.Level).RemoveNode(previousLevelKey, aToBeDeletedNode);
}
}
}
开发者ID:ramz,项目名称:sones,代码行数:33,代码来源:ABinaryCompareOperator.cs
示例8: GetComplexAtom
private Exceptional<IExpressionGraph> GetComplexAtom(DBContext dbContext, Dictionary<DBObjectStream, AOperationDefinition> operandsPrim, Dictionary<DBObjectStream, AOperationDefinition> operandsComparism, IDChainDefinition myIDChainDefinition, DBObjectCache dbObjectCache, ref IExpressionGraph result)
{
#region data
LevelKey myLevelKey = CreateLevelKey(myIDChainDefinition, dbContext.DBTypeManager);
#endregion
foreach (var left in operandsPrim)
{
foreach (var right in operandsComparism)
{
var tempResult = this.SimpleOperation(left.Value, right.Value, TypesOfBinaryExpression.Atom);
if (tempResult.Failed())
return new Exceptional<IExpressionGraph>(tempResult);
if ((Boolean)((ValueDefinition)tempResult.Value).Value.Value)
{
IntegrateInGraph(left.Key, result, myLevelKey, dbContext,dbObjectCache);
break;
}
}
}
return new Exceptional<IExpressionGraph>(result);
}
开发者ID:Vadi,项目名称:sones,代码行数:26,代码来源:ABinaryCompareOperator.cs
示例9: TypeOperation
public override Exceptional<IExpressionGraph> TypeOperation(IExpressionGraph myLeftValueObject, IExpressionGraph myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph result, bool aggregateAllowed = true)
{
myLeftValueObject.UnionWith(myRightValueObject);
return new Exceptional<IExpressionGraph>(myLeftValueObject);
}
开发者ID:TheByte,项目名称:sones,代码行数:6,代码来源:OrOperator.cs
示例10: Calculon
/// <summary>
/// This method evaluates binary expressions.
/// </summary>
public IExpressionGraph Calculon(GQLPluginManager myPluginManager,
IGraphDB myGraphDB,
SecurityToken mySecurityToken,
Int64 myTransactionToken,
IExpressionGraph resultGraph,
bool aggregateAllowed = true)
{
//a leaf expression is a expression without any recursive BinaryExpression
if (IsLeafExpression())
{
#region process leaf expression
return ABinaryCompareOperator.TypeOperation(
this.Left,
this.Right,
myPluginManager,
myGraphDB,
mySecurityToken,
myTransactionToken,
this.TypeOfBinaryExpression,
resultGraph,
TypesOfOperators.AffectsLocalLevelOnly,
Operator,
this.ExpressionIndex,
aggregateAllowed);
#endregion
}
else
{
#region process sub expr
switch (this.TypeOfBinaryExpression)
{
case TypesOfBinaryExpression.LeftComplex:
#region left complex
if (this.Left is BinaryExpressionDefinition)
{
return ((BinaryExpressionDefinition)this.Left)
.Calculon(myPluginManager,
myGraphDB,
mySecurityToken,
myTransactionToken,
resultGraph
.GetNewInstance(myGraphDB, mySecurityToken, myTransactionToken),
aggregateAllowed);
}
else
{
throw new InvalidBinaryExpressionException(this);
}
#endregion
case TypesOfBinaryExpression.RightComplex:
#region right complex
if (this.Right is BinaryExpressionDefinition)
{
return ((BinaryExpressionDefinition)this.Right)
.Calculon(myPluginManager,
myGraphDB,
mySecurityToken,
myTransactionToken,
resultGraph
.GetNewInstance(myGraphDB, mySecurityToken, myTransactionToken),
aggregateAllowed);
}
else
{
throw new InvalidBinaryExpressionException(this);
}
#endregion
case TypesOfBinaryExpression.Complex:
#region complex
if (!((this.Left is BinaryExpressionDefinition) && (this.Right is BinaryExpressionDefinition)))
{
throw new InvalidBinaryExpressionException(this);
}
if (!(this.Operator == BinaryOperator.OR || this.Operator == BinaryOperator.AND))
{
throw new InvalidBinaryExpressionException(this);
}
var left = ((BinaryExpressionDefinition)this.Left)
.Calculon(myPluginManager,
myGraphDB,
mySecurityToken,
myTransactionToken,
//.........这里部分代码省略.........
开发者ID:anukat2015,项目名称:sones,代码行数:101,代码来源:BinaryExpressionDefinition.cs
示例11: ExtendGraphUp
private void ExtendGraphUp(LevelKey startLevelKey, LevelKey endLevelKey, IExpressionGraph aGraph)
{
if (startLevelKey != endLevelKey)
{
var nextHigherLevelKeys = (from aHigherExpressionLevel in aGraph.Levels[startLevelKey.Level + 1].ExpressionLevels
where IsValidLevelKeyNeighbourship(startLevelKey, aHigherExpressionLevel.Key)
select aHigherExpressionLevel.Key);
var nextHigherLevelKey = (from aLowerExpressionLevel in nextHigherLevelKeys where IsValidLevelKeyNeighbourship(aLowerExpressionLevel, endLevelKey) select aLowerExpressionLevel).FirstOrDefault();
IVertex currentDBObject = null;
EdgeKey myCurrentForwardEdgekey = nextHigherLevelKey.Edges[startLevelKey.Level];
IVertexType currentType = _iGraphDB.GetVertexType<IVertexType>(
_securityToken,
_transactionToken,
new RequestGetVertexType(myCurrentForwardEdgekey.VertexTypeID),
(stats, vertexType) => vertexType);
IAttributeDefinition interestingAttribute = currentType.GetAttributeDefinition(myCurrentForwardEdgekey.AttributeID);
//find out whats the real type of the referenced objects
var typeOfReferencedObjects = GetTypeOfAttribute(currentType, interestingAttribute);
//Extend graph
foreach (var aNode in aGraph.Levels[startLevelKey.Level].ExpressionLevels[startLevelKey].Nodes)
{
currentDBObject = aNode.Value.GetIVertex();
if (currentDBObject != null)
{
//there is no need to extend the graph if there is no IVertex available
switch (interestingAttribute.Kind)
{
case AttributeType.IncomingEdge:
var incomingAttribute = (IIncomingEdgeDefinition)interestingAttribute;
if (currentDBObject.HasIncomingVertices(incomingAttribute.RelatedEdgeDefinition.SourceVertexType.ID, incomingAttribute.RelatedEdgeDefinition.ID))
{
foreach (var aIncomingVertex in currentDBObject.GetIncomingVertices(incomingAttribute.RelatedEdgeDefinition.SourceVertexType.ID, incomingAttribute.RelatedEdgeDefinition.ID))
{
//add backwardEdge to node (and itself)
aGraph.Levels[nextHigherLevelKey.Level].AddNodeAndBackwardEdge(nextHigherLevelKey, aIncomingVertex, startLevelKey.LastEdge, aNode.Key, null, null);
//recursion
ExtendGraphUp(nextHigherLevelKey, endLevelKey, aGraph);
aNode.Value.AddForwardEdge(myCurrentForwardEdgekey, GenerateVertexInfoFromLevelKeyAndVertexID(aIncomingVertex.VertexTypeID, aIncomingVertex.VertexID), null);
}
}
break;
case AttributeType.OutgoingEdge:
var outgoingEdgeAttribute = (IOutgoingEdgeDefinition)interestingAttribute;
if (currentDBObject.HasOutgoingEdge(outgoingEdgeAttribute.ID))
{
foreach (var aOutgoingVertex in currentDBObject.GetOutgoingEdge(outgoingEdgeAttribute.ID).GetTargetVertices())
{
//add backwardEdge to node (and itself)
aGraph.Levels[nextHigherLevelKey.Level].AddNodeAndBackwardEdge(nextHigherLevelKey, aOutgoingVertex, startLevelKey.LastEdge, aNode.Key, null, null);
//recursion
ExtendGraphUp(nextHigherLevelKey, endLevelKey, aGraph);
aNode.Value.AddForwardEdge(myCurrentForwardEdgekey, GenerateVertexInfoFromLevelKeyAndVertexID(aOutgoingVertex.VertexTypeID, aOutgoingVertex.VertexID), null);
}
}
break;
case AttributeType.Property:
default:
break;
}
}
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:77,代码来源:CommonUsageGraph.cs
示例12: DownFillStructureOfGraph
private void DownFillStructureOfGraph(IExpressionGraph anotherGraph, LevelKey levelKey)
{
lock (anotherGraph)
{
if (levelKey.Level > 0)
{
var nextLowerLevel = levelKey.Level - 1;
var nextLowerLevelKey = levelKey.GetPredecessorLevel(_iGraphDB, _securityToken, _transactionToken);
if (anotherGraph.Levels.ContainsKey(nextLowerLevel))
{
if (!anotherGraph.Levels[nextLowerLevel].ExpressionLevels.ContainsKey(nextLowerLevelKey))
{
anotherGraph.Levels[nextLowerLevel].AddEmptyLevelKey(nextLowerLevelKey);
if (nextLowerLevel > 0)
{
DownFillStructureOfGraph(anotherGraph, nextLowerLevelKey.GetPredecessorLevel(_iGraphDB, _securityToken, _transactionToken));
}
}
}
else
{
anotherGraph.Levels.Add(nextLowerLevel, new ExpressionLevel());
anotherGraph.Levels[nextLowerLevel].AddEmptyLevelKey(nextLowerLevelKey);
if (nextLowerLevel > 0)
{
DownFillStructureOfGraph(anotherGraph, nextLowerLevelKey);
}
}
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:34,代码来源:CommonUsageGraph.cs
示例13: DownfillLevelKey
private void DownfillLevelKey(IExpressionGraph aGraph, LevelKey aLevel)
{
lock (aGraph)
{
DownFillStructureOfGraph(aGraph, aLevel);
#region get levelKeys that match
var lowerLevelKeys = ExtractLowerLevelKeys(aLevel.Level - 1, aLevel, aGraph);
#endregion
if (lowerLevelKeys != null)
{
foreach (var aNode in aGraph.Levels[aLevel.Level].ExpressionLevels[aLevel].Nodes)
{
#region update levels that are lower (e.g. 1(current)-->0)
if (lowerLevelKeys != null)
{
UpdateLowerLevels(aNode.Value, aLevel, lowerLevelKeys, aGraph);
}
#endregion
}
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:29,代码来源:CommonUsageGraph.cs
示例14: DownFillGraph
private void DownFillGraph(IExpressionGraph aGraph, HashSet<LevelKey> myLevelKeys, int myMinLevel)
{
lock (aGraph)
{
foreach (var aLevel in myLevelKeys)
{
DownfillLevelKey(aGraph, aLevel);
}
//find levelkeys in upper levels that are not compatible to myLevelKeys --> DownFill them too
var upperLevels = (from aLevel in aGraph.Levels where aLevel.Key > myMinLevel select aLevel.Key).OrderBy(item => item);
foreach (var aUpperLevel in upperLevels)
{
List<LevelKey> upperLevelKeys = new List<LevelKey>();
foreach (var aExpressionLevel in aGraph.Levels[aUpperLevel].ExpressionLevels)
{
foreach (var aLevelKey in myLevelKeys)
{
if (!IsValidLevelKeyNeighbourship(aLevelKey, aExpressionLevel.Key))
{
upperLevelKeys.Add(aExpressionLevel.Key);
}
}
}
if (upperLevelKeys.Count > 0)
{
DownFillGraph(aGraph, new HashSet<LevelKey>(upperLevelKeys), aUpperLevel);
break;
}
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:35,代码来源:CommonUsageGraph.cs
示例15: CleanLevel
private void CleanLevel(IExpressionGraph toBeCleanedGraph, IExpressionGraph referenceGraph, KeyValuePair<int, IExpressionLevel> aLevel, HashSet<LevelKey> integratedByAnOtherGraph)
{
foreach (var aLevelKeyPayload in aLevel.Value.ExpressionLevels)
{
List<VertexInformation> toBeDeletedNodes = new List<VertexInformation>();
//check if the level exists in the other graph
if (referenceGraph.Levels.ContainsKey(aLevel.Key) && referenceGraph.Levels[aLevel.Key].ExpressionLevels.ContainsKey(aLevelKeyPayload.Key))
{
foreach (var aNode in aLevelKeyPayload.Value.Nodes)
{
if (!referenceGraph.Levels[aLevel.Key].ExpressionLevels[aLevelKeyPayload.Key].Nodes.ContainsKey(aNode.Key))
{
//the other graph does not contain the current node from this
RemoveNodeReferncesFromGraph(aNode.Value, aLevelKeyPayload.Key, toBeCleanedGraph, integratedByAnOtherGraph);
toBeDeletedNodes.Add(aNode.Key);
}
}
}
foreach (var aNode in toBeDeletedNodes)
{
#region remove from current level
toBeCleanedGraph.Levels[aLevelKeyPayload.Key.Level].RemoveNode(aLevelKeyPayload.Key, aNode);
#endregion
}
}
}
开发者ID:loubo,项目名称:sones,代码行数:30,代码来源:CommonUsageGraph.cs
示例16: ExcludeFromGraph
/// <summary>
/// We need to add an empty level in case, the DBO should not be integerated. Otherwise the select does not know, either the level was never touched or
/// not added due to an expression
/// </summary>
/// <param name="myDBObjectStream"></param>
/// <param name="myExpressionGraph"></param>
/// <param name="myLevelKey"></param>
/// <param name="myTypeManager"></param>
/// <param name="myQueryCache"></param>
private void ExcludeFromGraph(DBObjectStream myDBObjectStream, IExpressionGraph myExpressionGraph, LevelKey myLevelKey, DBContext myTypeManager, DBObjectCache myQueryCache)
{
myExpressionGraph.AddEmptyLevel(myLevelKey);
}
开发者ID:Vadi,项目名称:sones,代码行数:13,代码来源:ABinaryCompareOperator.cs
示例17: GetAtomResult
/// <summary>
/// This method gets result of a simple atomic operation.
/// </summary>
/// <param name="myDBType">The DBTypeStream.</param>
/// <param name="myTypeManager">The TypeManager of the database.</param>
/// <param name="queryCache">The current query cache.</param>
/// <param name="data">The DataContainer.</param>
private void GetAtomResult(GraphDBType myDBType, DBContext myTypeManager, DBObjectCache dbObjectCache, DataContainer data, ref IExpressionGraph result)
{
//do nothing here
}
开发者ID:Vadi,项目名称:sones,代码行数:11,代码来源:ABinaryCompareOperator.cs
示例18: TypeOperation
/// <summary>
/// Finds matching result corresponding to a binary expression.
/// </summary>
/// <param name="myLeftValueObject">The left value of a binary expression.</param>
/// <param name="myRightValueObject">The right value of a binary expression.</param>
/// <param name="currentTypeDefinitione"></param>
/// <param name="dbContext">The TypeManager of the database.</param>
/// <param name="typeOfBinExpr">The type of the binary expression.</param>
/// <param name="associativity">The associativity of the binary expression.</param>
/// <param name="referenceList"></param>
/// <param name="queryCache">The per query DBObject/BackwardEdge cache.</param>
/// <returns></returns>
public override Exceptional<IExpressionGraph> TypeOperation(AExpressionDefinition myLeftValueObject, AExpressionDefinition myRightValueObject, DBContext dbContext, TypesOfBinaryExpression typeOfBinExpr, TypesOfAssociativity associativity, IExpressionGraph resultGr, Boolean aggregateAllowed = true)
{
#region Data
//list of errors
List<GraphDBError> errors = new List<GraphDBError>();
//DataContainer for all data that is used by a binary expression/comparer
Exceptional<DataContainer> data;
//the index of the left attribute
IEnumerable<Tuple<GraphDBType, AAttributeIndex>> leftIndex = null;
//the index of the right attribute
IEnumerable<Tuple<GraphDBType, AAttributeIndex>> rightIndex = null;
#endregion
#region extract data
//data extraction with an eye on the type of the binary expression
switch (typeOfBinExpr)
{
case TypesOfBinaryExpression.Atom:
//sth like 3 = 4
#region Get Atom data
//no further data has to be generated
//data = new DataContainer(null, new Tuple<Object, Object>(myLeftValueObject, myRightValueObject), null);
data = new Exceptional<DataContainer>();
#endregion
break;
case TypesOfBinaryExpression.LeftComplex:
//sth like U.Age = 21
#region Get LeftComplex data
data = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
if (!data.Success())
{
return new Exceptional<IExpressionGraph>(data);
}
#endregion
break;
case TypesOfBinaryExpression.RightComplex:
//sth like 21 = U.Age
#region Get RightComplex data
data = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
if (!data.Success())
{
return new Exceptional<IExpressionGraph>(data);
}
#endregion
break;
case TypesOfBinaryExpression.Complex:
//sth like U.Age = F.Alter
#region Get Complex data
var leftData = ExtractData(myLeftValueObject, myRightValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
if (!leftData.Success())
{
return new Exceptional<IExpressionGraph>(leftData);
}
var rightData = ExtractData(myRightValueObject, myLeftValueObject, ref typeOfBinExpr, dbContext.DBObjectCache, dbContext.SessionSettings, dbContext, aggregateAllowed);
if (!rightData.Success())
{
return new Exceptional<IExpressionGraph>(rightData);
}
if (typeOfBinExpr == TypesOfBinaryExpression.Unknown)
{
typeOfBinExpr = SetTypeOfBinaryExpression(leftData, rightData);
switch (typeOfBinExpr)
{
//.........这里部分代码省略.........
开发者ID:Vadi,项目名称:sones,代码行数:101,代码来源:ABinaryCompareOperator.cs
示例19: GetComplexMatch
private Exceptional<Boolean> GetComplexMatch(IEnumerable<Tuple<GraphDBType, AAttributeIndex>> myIDX, Dictionary<DBObjectStream, AOperationDefinition> operands, DBObjectCache dbObjectCache, IDChainDefinition primIDNode, IDChainDefinition operandIDNode, DBContext dbContext, TypesOfAssociativity associativity, ref IExpressionGraph resultGraph, SessionSettings mySessionToken)
{
LevelKey primLevelKey = CreateLevelKey(primIDNode, dbContext.DBTypeManager);
LevelKey operandLevelKey = CreateLevelKey(operandIDNode, dbContext.DBTypeManager);
foreach (var aIDX in myIDX)
{
if (aIDX.Item2.IsUUIDIndex)
{
#region UUID idx
var currentIndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(aIDX.Item2.IndexRelatedTypeUUID);
foreach (var aOperand in operands)
{
foreach (var _ObjectUUIDs in ((UUIDIndex)aIDX.Item2).GetAllUUIDs(currentIndexRelatedType, dbContext))
{
var DBObjectStream = dbObjectCache.LoadDBObjectStream(aIDX.Item1, _ObjectUUIDs);
if (DBObjectStream.Failed())
{
return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
}
if (IsValidDBObjectStreamForBinExpr(DBObjectStream.Value, primIDNode.LastAttribute, dbContext.DBTypeManager))
{
var aCtype = GraphDBTypeMapper.ConvertGraph2CSharp(primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager).Name);
IObject dbos = GetDbos(primIDNode, DBObjectStream.Value, dbContext, mySessionToken, dbObjectCache);
Exceptional<AOperationDefinition> tempResult;
if (aCtype == BasicType.SetOfDBObjects)
{
tempResult = this.SimpleOperation(new TupleDefinition(aCtype, dbos, primIDNode.LastAttribute.GetDBType(dbContext.DBTypeManager)), aOperand.Value, TypesOfBinaryExpression.Complex);
}
else
{
tempResult = this.SimpleOperation(new ValueDefinition(aCtype, dbos), aOperand.Value, TypesOfBinaryExpression.Complex);
}
if (tempResult.Failed())
return new Exceptional<bool>(tempResult);
var tempOperatorResult = ((ValueDefinition)tempResult.Value);
if ((Boolean)tempOperatorResult.Value.Value)
{
switch (associativity)
{
case TypesOfAssociativity.Neutral:
case TypesOfAssociativity.Left:
IntegrateInGraph(aOperand.Key, resultGraph, operandLevelKey, dbContext, dbObjectCache);
break;
case TypesOfAssociativity.Right:
IntegrateInGraph(DBObjectStream.Value, resultGraph, primLevelKey, dbContext, dbObjectCache);
break;
default:
return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
}
}
}
}
}
#endregion
}
else
{
return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true)));
}
}
return new Exceptional<bool>(true);
}
开发者ID:Vadi,项目名称:sones,代码行数:79,代码来源:ABinaryCompareOperator.cs
|
请发表评论