本文整理汇总了C#中IExpressionGraph类的典型用法代码示例。如果您正苦于以下问题:C# IExpressionGraph类的具体用法?C# IExpressionGraph怎么用?C# IExpressionGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IExpressionGraph类属于命名空间,在下文中一共展示了IExpressionGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例3: UnionWith
public abstract void UnionWith(IExpressionGraph anotherGraph);
示例4: BuildDifferenceWith
public abstract void BuildDifferenceWith(IExpressionGraph anotherGraph);
示例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);
}
//.........这里部分代码省略.........
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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,
//.........这里部分代码省略.........
示例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;
}
}
}
}
}
示例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);
}
}
}
}
}
示例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
}
}
}
}
示例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;
}
}
}
}
示例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
}
}
}