本文整理汇总了C#中IVertexType.GetOutgoingEdgeDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# IVertexType.GetOutgoingEdgeDefinition方法的具体用法?C# IVertexType.GetOutgoingEdgeDefinition怎么用?C# IVertexType.GetOutgoingEdgeDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVertexType
的用法示例。
在下文中一共展示了IVertexType.GetOutgoingEdgeDefinition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateVertexUpdateDefinition
//.........这里部分代码省略.........
}
}
}
}
#endregion
#region extract vertex properties
#region will be ignored
long vertexID = 0L;
long creationDate = 0L;
long modificationDate = 0L;
#endregion
ExtractVertexProperties(ref edition, ref revision, ref comment, ref vertexID, ref creationDate, ref modificationDate, toBeUpdatedStructured);
#endregion
#region edge magic
if (myUpdate.AddedElementsToCollectionEdges != null ||
myUpdate.RemovedElementsFromCollectionEdges != null ||
myUpdate.UpdateOutgoingEdges != null ||
myUpdate.UpdateOutgoingEdgesProperties != null)
{
VertexInformation source = new VertexInformation(myVertex.VertexTypeID, myVertex.VertexID);
#region update outgoing edges
if (myUpdate.UpdateOutgoingEdges != null)
{
foreach (var edge in myUpdate.UpdateOutgoingEdges)
{
var edgeDef = myVertexType.GetOutgoingEdgeDefinition(edge.EdgeName);
switch (edgeDef.Multiplicity)
{
case EdgeMultiplicity.SingleEdge:
{
#region SingleEdge
var targets = GetResultingVertexIDs(myTransaction, mySecurity, edge, edgeDef.TargetVertexType);
if (targets == null || !targets.CountIsGreater(0))
{
toBeDeletedSingle = toBeDeletedSingle ?? new List<long>();
toBeDeletedSingle.Add(edgeDef.ID);
}
else if (targets.CountIsGreater(1))
{
throw new Exception("Single edge can not have more than one target.");
}
else
{
ConvertUnknownProperties(edge, edgeDef.EdgeType);
var structured = CreateStructuredUpdate(edge.StructuredProperties, edgeDef.EdgeType);
var unstructured = CreateUnstructuredUpdate(edge.UnstructuredProperties);
toBeUpdatedSingle = toBeUpdatedSingle ?? new Dictionary<long, SingleEdgeUpdateDefinition>();
toBeUpdatedSingle.Add(edgeDef.ID,
new SingleEdgeUpdateDefinition(source,
targets.First(),
edgeDef.EdgeType.ID,
edge.Comment,
structured,
unstructured));
}
示例2: CreateEdgeAddDefinitions
private void CreateEdgeAddDefinitions(
IEnumerable<EdgePredefinition> myOutgoingEdges,
IVertexType myVertexType,
Int64 myTransaction,
SecurityToken mySecurity,
VertexInformation source,
long date,
out IEnumerable<SingleEdgeAddDefinition> outSingleEdges,
out IEnumerable<HyperEdgeAddDefinition> outHyperEdges)
{
outSingleEdges = null;
outHyperEdges = null;
if (myOutgoingEdges == null)
return;
var singleEdges = new Dictionary<String, SingleEdgeAddDefinition>();
var hyperEdges = new Dictionary<String, HyperEdgeAddDefinition>();
foreach (var edgeDef in myOutgoingEdges)
{
var attrDef = myVertexType.GetOutgoingEdgeDefinition(edgeDef.EdgeName);
switch (attrDef.Multiplicity)
{
case EdgeMultiplicity.SingleEdge:
{
var edge = CreateSingleEdgeAddDefinition(myTransaction,
mySecurity,
date,
attrDef.ID,
edgeDef,
attrDef.EdgeType,
source,
attrDef);
if (edge.HasValue)
singleEdges.Add(edgeDef.EdgeName, edge.Value);
}
break;
case EdgeMultiplicity.HyperEdge:
{
break;
}
case EdgeMultiplicity.MultiEdge:
{
var edge = CreateMultiEdgeAddDefinition(myTransaction,
mySecurity,
source,
date,
edgeDef,
attrDef);
if (edge.HasValue)
hyperEdges.Add(attrDef.Name, edge.Value);
}
break;
default:
throw new UnknownDBException("The EdgeMultiplicy enumeration was updated, but not this switch statement.");
}
}
outSingleEdges = singleEdges.Select(x => x.Value);
outHyperEdges = hyperEdges.Select(x => x.Value);
}
示例3: StringParser
private Dictionary<IOutgoingEdgeDefinition, Tuple<bool, long>> StringParser(String current_string,
IVertexType vertexType)
{
Dictionary<IOutgoingEdgeDefinition, Tuple<bool, long>> idList = new Dictionary<IOutgoingEdgeDefinition, Tuple<bool, long>>();
bool endFlag = false;
int EndPos = 0;
try
{
do
{
EndPos = current_string.IndexOf(',');
if (EndPos == -1)
{
EndPos = current_string.Length;
endFlag = true;
}
var idString = current_string.Substring(0, EndPos);
var edgeType = vertexType.GetOutgoingEdgeDefinition(idString);
var hasProperty = edgeType.InnerEdgeType.HasProperty("Weight");
long myPropertyID = 0;
if (hasProperty == true)
{
myPropertyID = edgeType.InnerEdgeType.GetPropertyDefinition("Weight").ID;
}
if (!idList.ContainsKey(edgeType))
idList.Add(edgeType,Tuple.Create(hasProperty,myPropertyID));
if (!endFlag)
current_string = current_string.Substring(EndPos + 1);
}
while (endFlag != true);
}
catch
{
throw new InvalidFunctionParameterException("edgeType", "Object reference not set to an instance of an object.", "null");
}
return idList;
}
示例4: CheckOutgoingEdges
private void CheckOutgoingEdges(IEnumerable<EdgePredefinition> myEdges, IVertexType myVertexType)
{
foreach (var edge in myEdges)
{
var edgeDef = myVertexType.GetOutgoingEdgeDefinition(edge.EdgeName);
switch (edgeDef.Multiplicity)
{
case EdgeMultiplicity.SingleEdge:
{
CheckSingleEdge(edge, edgeDef.EdgeType);
break;
}
case EdgeMultiplicity.MultiEdge:
{
if (edge.ContainedEdges != null)
{
foreach (var innerEdge in edge.ContainedEdges)
{
CheckSingleEdge(innerEdge, edgeDef.InnerEdgeType);
}
}
break;
}
case EdgeMultiplicity.HyperEdge:
{
break;
}
}
}
}
示例5: CheckRemoveOutgoingEdges
private void CheckRemoveOutgoingEdges(RequestAlterVertexType myAlterVertexTypeRequest, IVertexType myVertexType, SecurityToken mySecurityToken, TransactionToken myTransactionToken)
{
if (myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges == null)
return;
#region get the list of incoming edges that will be deleted too
var toBeRemovedIncomingEdgeIDs = new List<long>();
if (myAlterVertexTypeRequest.ToBeRemovedIncomingEdges != null)
toBeRemovedIncomingEdgeIDs.AddRange(
myAlterVertexTypeRequest.ToBeRemovedIncomingEdges.Select(
_ => myVertexType.GetIncomingEdgeDefinition(_).ID));
#endregion
foreach (var aOutgoingEdge in myAlterVertexTypeRequest.ToBeRemovedOutgoingEdges)
{
var attrDef = myVertexType.GetOutgoingEdgeDefinition(aOutgoingEdge);
var vertex = _vertexManager.ExecuteManager.GetVertex((long) BaseTypes.OutgoingEdge, attrDef.ID, null,
null, myTransactionToken, mySecurityToken);
var incomingEdges = vertex.GetIncomingVertices((long) BaseTypes.IncomingEdge,
(long)
AttributeDefinitions.IncomingEdgeDotRelatedEgde);
foreach (var incomingEdge in incomingEdges)
{
if (!toBeRemovedIncomingEdgeIDs.Contains(incomingEdge.VertexID))
{
//TODO a better exception here
throw new Exception(
"The outgoing edge can not be removed, because there are related incoming edges.");
}
}
}
}
示例6: ProcessOutgoingEdgeRemoval
private void ProcessOutgoingEdgeRemoval(IEnumerable<string> myToBeRemovedOutgoingEdges, IVertexType vertexType, TransactionToken myTransactionToken, SecurityToken mySecurityToken)
{
foreach (var aOutgoingEdge in myToBeRemovedOutgoingEdges)
{
var outgoingEdgeDefinition = vertexType.GetOutgoingEdgeDefinition(aOutgoingEdge);
_vertexManager.ExecuteManager.VertexStore.RemoveVertex(mySecurityToken, myTransactionToken, outgoingEdgeDefinition.ID, (long)BaseTypes.OutgoingEdge);
}
}
示例7: PrintAllVerticesInBase
private void PrintAllVerticesInBase(IVertexType vertex_type)
{
var vertices1 = GraphDSServer.GetVertices<IEnumerable<IVertex>>(SecToken,
TransactionID,
new RequestGetVertices("User"),
(statistics, Vertices) => Vertices);
var attrName = vertex_type.GetAttributeDefinition("Name");
var attrFriendsDate = vertex_type.GetOutgoingEdgeDefinition("friends").InnerEdgeType.GetAttributeDefinition("Time");
foreach (var user in vertices1)
foreach (var hyper in user.GetAllOutgoingHyperEdges())
foreach (var edge in hyper.Item2.GetAllEdges())
Console.WriteLine("{0} - {1} Time: {2}",
user.GetPropertyAsString(attrName.ID),
edge.GetTargetVertex().GetPropertyAsString(attrName.ID),
edge.GetPropertyAsString(attrFriendsDate.ID));
}