本文整理汇总了C#中IExpressionGraph.ContainsLevelKey方法的典型用法代码示例。如果您正苦于以下问题:C# IExpressionGraph.ContainsLevelKey方法的具体用法?C# IExpressionGraph.ContainsLevelKey怎么用?C# IExpressionGraph.ContainsLevelKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExpressionGraph
的用法示例。
在下文中一共展示了IExpressionGraph.ContainsLevelKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: MatchData
/// <param name="data">The DataContainer.</param>
/// <param name="dbContext">The TypeManager of the database.</param>
/// <param name="queryCache">The current query cache.</param>
/// <param name="typeOfBinExpr">The type of the binary expression.</param>
/// <param name="idx">The index for the complex part.</param>
/// <param name="errors">A list of errors.</param>
/// <param name="resultGraph">The IExpressionGraph that serves as result.</param>
/// <returns>True if the method succeeded</returns>
private Exceptional<Boolean> MatchData(DataContainer data, DBContext dbContext, DBObjectCache dbObjectCache, TypesOfBinaryExpression typeOfBinExpr, IEnumerable<Tuple<GraphDBType, AAttributeIndex>> idx, IExpressionGraph resultGraph, SessionSettings mySessionToken)
{
#region data
LevelKey myLevelKey = CreateLevelKey(data.IDChainDefinitions.Item1, dbContext.DBTypeManager);
#endregion
foreach (var aIDX in idx)
{
//this is only for such type(DBVertex) that have no AAttributeIndex
if (aIDX.Item2 == null)
{
continue;
}
#region Execution
if (aIDX.Item2.IsUUIDIndex && (data.IDChainDefinitions.Item1.LastAttribute != dbContext.DBTypeManager.GetUUIDTypeAttribute()))
{
#region UUID idx - check ALL DBOs
var IndexRelatedType = dbContext.DBTypeManager.GetTypeByUUID(aIDX.Item2.IndexRelatedTypeUUID);
var idxKeyValues = (aIDX.Item2).GetAllValues(IndexRelatedType, dbContext);
if (idxKeyValues.CountIs(0))
{
continue;
}
var uuids = idxKeyValues.Aggregate((elem, aggrresult) => aggrresult.Union(elem));
var result = IntegrateUUID(data, dbContext, dbObjectCache, typeOfBinExpr, resultGraph, mySessionToken, myLevelKey, dbObjectCache.LoadListOfDBObjectStreams(aIDX.Item1, uuids));
if (result.Failed())
{
return new Exceptional<bool>(result);
}
if (resultGraph.ContainsLevelKey(myLevelKey))
{
#region clean lower levels
if (Type == TypesOfOperators.AffectsLowerLevels)
{
CleanLowerLevel(myLevelKey, dbContext, dbObjectCache, resultGraph);
}
#endregion
}
else
{
resultGraph.AddEmptyLevel(myLevelKey);
}
#endregion
}
else
{
#region Get operationValue and type
var operationValue = (AOperationDefinition)data.Operands.Item1;
#endregion
#region Attribute index
if (aIDX.Item2.IndexKeyDefinition.IndexKeyAttributeUUIDs.Count > 1)
{
return new Exceptional<bool>(new Error_NotImplemented(new System.Diagnostics.StackTrace(true), "Currently it is not implemented to use compound indices."));
}
var interestingUUIDsByIdx = IndexSingleOperation(aIDX.Item2, operationValue, data.IDChainDefinitions.Item1.LastAttribute.UUID, typeOfBinExpr, dbContext);
#region integrate in graph
var runMT = DBConstants.RunMT;
if (runMT)
{
Parallel.ForEach(dbObjectCache.LoadListOfDBObjectStreams(data.IDChainDefinitions.Item1.LastType, interestingUUIDsByIdx), aDBO =>
{
IntegrateInGraph(aDBO.Value, resultGraph, myLevelKey, dbContext, dbObjectCache);
}
);
}
else
{
foreach (var aDBO in dbObjectCache.LoadListOfDBObjectStreams(data.IDChainDefinitions.Item1.LastType, interestingUUIDsByIdx))
{
//.........这里部分代码省略.........
示例3: RemoveNodeReferncesFromGraph
private void RemoveNodeReferncesFromGraph(IExpressionNode myExpressionNode, LevelKey mylevelKey, IExpressionGraph myGraph, HashSet<LevelKey> integratedByAnOtherGraph)
{
#region remove complex connection
foreach (var aComplexConnection in myExpressionNode.ComplexConnection)
{
var expressionLevelEntry = myGraph.Levels[aComplexConnection.Key.Level].ExpressionLevels[aComplexConnection.Key];
foreach (var aReference in aComplexConnection.Value)
{
if (expressionLevelEntry.Nodes.ContainsKey(aReference))
{
expressionLevelEntry.Nodes[aReference].RemoveComplexConnection(mylevelKey, myExpressionNode.VertexInformation);
RemoveNodeReferncesFromGraph(expressionLevelEntry.Nodes[aReference], aComplexConnection.Key, myGraph, integratedByAnOtherGraph);
}
if (myGraph.Levels.ContainsKey(aComplexConnection.Key.Level - 1))
{
foreach (var aBackwardEdgeSet in expressionLevelEntry.Nodes[aReference].BackwardEdges)
{
//go to every object the backwardEdge points to and remove the forward reference
var backwardLevelKey = GetBackwardLevelKey(aComplexConnection.Key, aBackwardEdgeSet.Key);
if (myGraph.ContainsLevelKey(backwardLevelKey))
{
foreach (var aBackwardEdge in aBackwardEdgeSet.Value)
{
if (myGraph.Levels[backwardLevelKey.Level].ExpressionLevels[backwardLevelKey].Nodes.ContainsKey(aBackwardEdge.Destination))
{
myGraph.Levels[backwardLevelKey.Level].RemoveNode(backwardLevelKey, aBackwardEdge.Destination);
}
}
}
}
}
myGraph.Levels[aComplexConnection.Key.Level].RemoveNode(aComplexConnection.Key, aReference);
}
}
#endregion
#region remove reference from lower level
if (mylevelKey.Level != 0)
{
if (myGraph.Levels.ContainsKey(mylevelKey.Level - 1))
{
foreach (var aBackwardEdgeSet in myExpressionNode.BackwardEdges)
{
//go to every object the backwardEdge points to and remove the forward reference
var backwardLevelKey = GetBackwardLevelKey(mylevelKey, aBackwardEdgeSet.Key);
if (myGraph.ContainsLevelKey(backwardLevelKey))
{
foreach (var aBackwardEdge in aBackwardEdgeSet.Value)
{
if (myGraph.Levels[backwardLevelKey.Level].ExpressionLevels[backwardLevelKey].Nodes.ContainsKey(aBackwardEdge.Destination))
{
myGraph.Levels[backwardLevelKey.Level].ExpressionLevels[backwardLevelKey].Nodes[aBackwardEdge.Destination].RemoveForwardEdge(mylevelKey.LastEdge, myExpressionNode.VertexInformation);
}
}
}
}
}
}
#endregion
RemoveReferenceFromUpperLevel(myExpressionNode, mylevelKey, myGraph);
}
示例4: RemoveReferenceFromUpperLevel
private void RemoveReferenceFromUpperLevel(IExpressionNode myExpressionNode, LevelKey mylevelKey, IExpressionGraph myGraph)
{
#region remove reference from upper level
if (myGraph.Levels.ContainsKey(mylevelKey.Level + 1))
{
foreach (var aForwardEdgeSet in myExpressionNode.ForwardEdges)
{
var forwardLevelKey = GetForwardLevelKey(mylevelKey, aForwardEdgeSet.Key);
if (myGraph.ContainsLevelKey(forwardLevelKey))
{
//go to every object the forwardEdge points to and remove the backward reference
foreach (var aForwardEdge in aForwardEdgeSet.Value)
{
if (myGraph.Levels[forwardLevelKey.Level].ExpressionLevels[forwardLevelKey].Nodes.ContainsKey(aForwardEdge.Destination))
{
myGraph.Levels[forwardLevelKey.Level].ExpressionLevels[forwardLevelKey].Nodes[aForwardEdge.Destination].RemoveBackwardEdge(mylevelKey.LastEdge, myExpressionNode.VertexInformation);
if (!(myGraph.Levels[forwardLevelKey.Level].ExpressionLevels[forwardLevelKey].Nodes[aForwardEdge.Destination].BackwardEdges
.Where(item => item.Value.Count > 0).Count() > 0))
{
//the current object has no backward Edges... delete it
//remove upper references
RemoveReferenceFromUpperLevel(myGraph.Levels[forwardLevelKey.Level].ExpressionLevels[forwardLevelKey].Nodes[aForwardEdge.Destination], forwardLevelKey, myGraph);
//remove the node itself
myGraph.Levels[forwardLevelKey.Level].ExpressionLevels[forwardLevelKey].Nodes.Remove(aForwardEdge.Destination);
}
}
}
}
}
}
#endregion
}
示例5: GetLevelKeyDifference
private Dictionary<int, HashSet<LevelKey>> GetLevelKeyDifference(IExpressionGraph fromGraph, IExpressionGraph toGraph)
{
#region data
Dictionary<int, HashSet<LevelKey>> result = new Dictionary<int, HashSet<LevelKey>>();
#endregion
foreach (var aLevel in toGraph.Levels)
{
foreach (var aLevelPayLoad in aLevel.Value.ExpressionLevels)
{
if (!fromGraph.ContainsLevelKey(aLevelPayLoad.Key))
{
if (result.ContainsKey(aLevel.Key))
{
result[aLevel.Key].Add(aLevelPayLoad.Key);
}
else
{
result.Add(aLevel.Key, new HashSet<LevelKey>() { aLevelPayLoad.Key });
}
}
}
}
return result;
}