本文整理汇总了C#中IVertexType类的典型用法代码示例。如果您正苦于以下问题:C# IVertexType类的具体用法?C# IVertexType怎么用?C# IVertexType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IVertexType类属于命名空间,在下文中一共展示了IVertexType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMatchingVertices
public override IEnumerable<IVertex> GetMatchingVertices(IVertexType myInterestingVertexType)
{
Regex regexpression;
try
{
regexpression = new Regex((String)_constant.Value);
}
catch (Exception e)
{
throw new InvalidLikeOperationException(String.Format("Invalid regular expression given:{0}{1}", Environment.NewLine, e.Message), e);
}
foreach (var aVertex in _vertexStore.GetVerticesByTypeID(_securityToken, _transactionToken, myInterestingVertexType.ID, _property.Edition, VertexRevisionFilter))
{
var value = _property.Property.GetValue(aVertex);
if (value != null && (regexpression.IsMatch((String)value)))
{
yield return aVertex;
}
}
yield break;
}
示例2: QueryPlanProperty
/// <summary>
/// Create a new query plan property
/// </summary>
/// <param name="myVertexType">The interesting vertex type</param>
/// <param name="myProperty">The interesting property</param>
public QueryPlanProperty(IVertexType myVertexType, IPropertyDefinition myProperty, String myInterestingEdition, TimeSpanDefinition myInterestingTimeSpan)
{
VertexType = myVertexType;
Property = myProperty;
Edition = myInterestingEdition;
Timespan = myInterestingTimeSpan;
}
示例3: CheckAddStructuredProperties
protected static void CheckAddStructuredProperties(IDictionary<String, IComparable> myProperties, IVertexType vertexType)
{
foreach (var prop in myProperties)
{
var propertyDef = vertexType.GetPropertyDefinition(prop.Key);
if (propertyDef == null)
throw new AttributeDoesNotExistException(prop.Key, vertexType.Name);
if (propertyDef.Multiplicity == PropertyMultiplicity.Single)
{
CheckPropertyType(vertexType.Name, prop.Value, propertyDef);
}
else
{
IEnumerable<IComparable> items = prop.Value as IEnumerable<IComparable>;
if (items == null)
{
throw new PropertyHasWrongTypeException(vertexType.Name, prop.Key, propertyDef.Multiplicity, propertyDef.BaseType.Name);
}
foreach (var item in items)
{
CheckPropertyType(vertexType.Name, item, propertyDef);
}
}
}
}
示例4: GetMatchingVertices
public override IEnumerable<IVertex> GetMatchingVertices(IVertexType myInterestingVertexType)
{
if (_constantRange.IncludeBorders)
{
foreach (var aVertex in _vertexStore.GetVerticesByTypeID(_securityToken, _transactionToken, myInterestingVertexType.ID, _property.Edition, VertexRevisionFilter))
{
var value = _property.Property.GetValue(aVertex);
if (value != null &&
(value.CompareTo(_constantRange.Lower) >= 0) &&
(value.CompareTo(_constantRange.Upper) <= 0))
{
yield return aVertex;
}
}
}
else
{
foreach (var aVertex in _vertexStore.GetVerticesByTypeID(_securityToken, _transactionToken, myInterestingVertexType.ID, _property.Edition, VertexRevisionFilter))
{
var value = _property.Property.GetValue(aVertex);
if (value != null &&
(value.CompareTo(_constantRange.Lower) > 0) &&
(value.CompareTo(_constantRange.Upper) < 0))
{
yield return aVertex;
}
}
}
yield break;
}
示例5: Add
public void Add(IVertexType current_node, double current_distance, UInt64 current_depth)
{
var id = current_node.ID;
_buf.Add(Tuple.Create(current_distance, id), Tuple.Create(current_node, current_distance, current_depth));
_count++;
}
示例6: GetVertices
public override IEnumerable<IVertex> GetVertices(IVertexType myVertexType, Int64 myTransaction, SecurityToken mySecurity, Boolean myIncludeSubtypes)
{
if (myVertexType == null)
{
throw new ArgumentNullException("myVertexType");
}
return null;
}
示例7: IDNode
public IDNode(IVertexType myType, String myReference)
{
IDChainDefinition = new IDChainDefinition();
IDChainDefinition.AddPart(new ChainPartTypeOrAttributeDefinition(myType.Name));
var listOfRefs = new Dictionary<String, IVertexType>();
listOfRefs.Add(myReference, myType);
}
示例8: CheckIndexTypeReference
/// <summary>
/// Checks whether the index can be changed
/// </summary>
/// <param name="idxDef">List of index attribute definitions</param>
/// <param name="type">The db type that is to be altered</param>
/// <returns>An exceptional</returns>
private void CheckIndexTypeReference(List<IndexAttributeDefinition> idxDef, IVertexType type)
{
foreach (var idx in idxDef)
{
if (idx.IndexType != null && idx.IndexType != type.Name)
{
throw new CouldNotAlterIndexOnTypeException(idx.IndexType);
}
}
}
示例9: CreateBinaryPropertyDefinition
/// <summary>
/// Transforms an IVertex in a binary property definition.
/// </summary>
/// <param name="myVertex">A vertex that represents a property definition.</param>
/// <returns>A property definition.</returns>
public static IBinaryPropertyDefinition CreateBinaryPropertyDefinition(IVertex myVertex, IVertexType myDefiningType = null)
{
var attributeID = GetUUID(myVertex);
var name = GetAttributeDotName(myVertex);
var definingType = myDefiningType ?? GetDefiningType(myVertex) as IVertexType;
var isUserDefined = GetAttributeDotIsUserDefined(myVertex);
return new BinaryPropertyDefinition
{
IsUserDefined = isUserDefined,
Name = name,
RelatedType = definingType,
ID = myVertex.VertexID,
};
}
示例10: GetMatchingVertices
public override IEnumerable<IVertex> GetMatchingVertices(IVertexType myInterestingVertexType)
{
foreach (var aVertex in _vertexStore.GetVerticesByTypeID(_securityToken, _transactionToken, myInterestingVertexType.ID, _property.Edition, VertexRevisionFilter))
{
var result = _property.Property.GetValue(aVertex);
if (result != null)
{
if (_constant.Value.CompareTo(result) == 0)
{
yield return aVertex;
}
}
}
yield break;
}
示例11: DFS
void DFS(IVertexType start, IVertexType end, List<Tuple<long,long>> Parents)
{
var outEdges = start.GetOutgoingEdgeDefinitions(true);
var incEdges = start.GetIncomingEdgeDefinitions(true);
foreach (IOutgoingEdgeDefinition vertexType in outEdges)
{
if (Parents.Where(x=>x.Item1 == vertexType.TargetVertexType.ID).Count()==0)//(Tuple.Create(vertexType.TargetVertexType.ID,vertexType.ID)))
{
var current_parents = Parents.ToList();
Parents.Add(Tuple.Create(vertexType.TargetVertexType.ID,vertexType.ID));
if (Parents.Last().Item1 == end.ID && !_path.Contains(Parents))
_path.Add(Parents);
else
{
DFS(vertexType.TargetVertexType, end, Parents);
}
Parents = current_parents;
}
}
foreach (IIncomingEdgeDefinition vertexType in incEdges)
{
if (Parents.Where(x => x.Item1 == vertexType.RelatedEdgeDefinition.SourceVertexType.ID).Count() == 0) //if (!Parents.Contains(Tuple.Create(vertexType.RelatedEdgeDefinition.SourceVertexType.ID, vertexType.ID)))
{
var current_parents = Parents.ToList();
Parents.Add(Tuple.Create(vertexType.RelatedEdgeDefinition.SourceVertexType.ID,vertexType.ID));
if (Parents.Last().Item1 == end.ID && !_path.Contains(Parents))
{
_path.Add(Parents);
}
else
{
DFS(vertexType.RelatedEdgeDefinition.SourceVertexType, end, Parents);
}
Parents = current_parents;
}
}
}
示例12: GetResultingVertexIDs
private IEnumerable<VertexInformation> GetResultingVertexIDs(Int64 myTransaction, SecurityToken mySecurity, EdgePredefinition myEdgeDef, IVertexType myTargetType = null)
{
if (myEdgeDef.VertexIDsByVertexTypeID != null || myEdgeDef.VertexIDsByVertexTypeName != null)
{
HashSet<VertexInformation> result = new HashSet<VertexInformation>();
if (myEdgeDef.VertexIDsByVertexTypeID != null)
{
foreach (var kvP in myEdgeDef.VertexIDsByVertexTypeID)
{
foreach (var vertex in kvP.Value)
{
result.Add(new VertexInformation(kvP.Key, vertex));
}
}
}
if (myEdgeDef.VertexIDsByVertexTypeName != null)
{
foreach (var kvP in myEdgeDef.VertexIDsByVertexTypeName)
{
var vertexType = _vertexTypeManager.ExecuteManager.GetType(kvP.Key, myTransaction, mySecurity);
foreach (var vertex in kvP.Value)
{
result.Add(new VertexInformation(vertexType.ID, vertex));
}
}
}
return result;
}
return null;
}
示例13: CheckTargetVertices
private static void CheckTargetVertices(IVertexType myTargetVertexType, IEnumerable<VertexInformation> vertexIDs)
{
var distinctTypeIDS = new HashSet<Int64>(vertexIDs.Select(x => x.VertexTypeID));
var allowedTypeIDs = new HashSet<Int64>(myTargetVertexType.GetDescendantVertexTypesAndSelf().Select(x => x.ID));
distinctTypeIDS.ExceptWith(allowedTypeIDs);
if (distinctTypeIDS.Count > 0)
throw new Exception("A target vertex has a type, that is not assignable to the target vertex type of the edge.");
}
示例14: 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);
}
示例15: RequestInsertVertexToVertexAddDefinition
private Tuple<long?, VertexAddDefinition> RequestInsertVertexToVertexAddDefinition(RequestInsertVertex myInsertDefinition,
IVertexType myVertexType,
Int64 myTransaction,
SecurityToken mySecurity)
{
long vertexID = (myInsertDefinition.VertexUUID.HasValue)
? myInsertDefinition.VertexUUID.Value
: _idManager.GetVertexTypeUniqeID(myVertexType.ID).GetNextID();
var source = new VertexInformation(myVertexType.ID, vertexID);
long creationdate = DateTime.UtcNow.ToBinary();
long modificationDate = creationdate;
String comment = myInsertDefinition.Comment;
String edition = myInsertDefinition.Edition;
long? revision = null;
IEnumerable<SingleEdgeAddDefinition> singleEdges;
IEnumerable<HyperEdgeAddDefinition> hyperEdges;
CreateEdgeAddDefinitions(myInsertDefinition.OutgoingEdges,
myVertexType,
myTransaction,
mySecurity,
source,
creationdate,
out singleEdges,
out hyperEdges);
var binaries = (myInsertDefinition.BinaryProperties == null)
? null
: myInsertDefinition.BinaryProperties.Select(x => new StreamAddDefinition(myVertexType.GetAttributeDefinition(x.Key).ID, x.Value));
var structured = ConvertStructuredProperties(myInsertDefinition, myVertexType);
ExtractVertexProperties(ref edition,
ref revision,
ref comment,
ref vertexID,
ref creationdate,
ref modificationDate,
structured);
//set id to maximum to allow user set UUIDs
_idManager.GetVertexTypeUniqeID(myVertexType.ID).SetToMaxID(vertexID);
return Tuple.Create(revision, new VertexAddDefinition(vertexID,
myVertexType.ID,
edition,
hyperEdges,
singleEdges,
null,
binaries,
comment,
creationdate,
modificationDate,
structured,
myInsertDefinition.UnstructuredProperties));
}