GetPropertyValue() abstract public method

Get property value of a Vertex/Edge
abstract public GetPropertyValue ( Int32 elementId ) : IComparable
elementId System.Int32 Id of a Vertex/Edge
return IComparable
Esempio n. 1
0
 /// <summary>
 /// numerates all elements satisfying the given condition for the given property and value range
 /// </summary>
 /// <param name="property">Property we are looking for</param>
 /// <param name="condition"> filter function, applied with in graph value as 1st parameter, lower as 2nd and higher as 3rd parameter.</param>
 /// <param name="lower">lower value in filtering</param>
 /// <param name="higher">higher value in filtering</param>
 /// <returns></returns>
 public IEnumerable <IElement> Select(PropertyType property, Func <IComparable, IComparable, IComparable, Boolean> condition, IComparable lower, IComparable higher)
 {
     if (property.IsVertexProperty)
     {
         VertexType vt = vertexType[property.TypeId];
         foreach (Vertex vertex in vt.GetVertices())
         {
             IComparable v = property.GetPropertyValue(vertex.VertexId);
             if (condition(v, lower, higher))
             {
                 yield return(vertex);
             }
         }
     }
     else
     {
         EdgeType et = edgeType[property.TypeId];
         foreach (Edge edge in et.GetEdges())
         {
             IComparable v = property.GetPropertyValue(edge.EdgeId);
             if (condition(v, lower, higher))
             {
                 yield return(edge);
             }
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Enumerates all the values for the given vertex/edge property
 /// </summary>
 /// <param name="property">Edge or Vertex property</param>
 /// <returns>Enumeration of property values</returns>
 public IEnumerable <IComparable> GetValues(PropertyType property)
 {
     if (property.IsVertexProperty)
     {
         foreach (VertexType vt in vertexType)
         {
             foreach (Vertex vertex in vt.GetVertices())
             {
                 IComparable v = property.GetPropertyValue(vertex.VertexId);
                 if (v != null)
                 {
                     yield return(v);
                 }
             }
         }
     }
     else
     {
         foreach (EdgeType et in edgeType)
         {
             foreach (Edge edge in et.GetEdges())
             {
                 IComparable v = property.GetPropertyValue(edge.EdgeId);
                 if (v != null)
                 {
                     yield return(v);
                 }
             }
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Removes a property type except if any vertex or edge is using it
 /// </summary>
 /// <param name="pt">property type to remove</param>
 public void RemovePropertyType(PropertyType pt)
 {
     if (pt.IsVertexProperty)
     {
         VertexType vt = vertexType[pt.TypeId];
         foreach (Vertex vertex in vt.GetVertices())
         {
             IComparable v = pt.GetPropertyValue(vertex.VertexId);
             if (v != null)
             {
                 throw new PropertyTypeInUseException();
             }
         }
     }
     else
     {
         EdgeType et = edgeType[pt.TypeId];
         foreach (Edge edge in et.GetEdges())
         {
             IComparable v = pt.GetPropertyValue(edge.EdgeId);
             if (v != null)
             {
                 throw new PropertyTypeInUseException();
             }
         }
     }
     if (pt.IsVertexProperty)
     {
         VertexType vt = vertexType[pt.TypeId];
         vt.stringToPropertyType.Remove(pt.Name);
     }
     else
     {
         EdgeType et = edgeType[pt.TypeId];
         et.stringToPropertyType.Remove(pt.Name);
     }
     Update();
     propertyType[pt.PropertyId] = null;
     pt.Unpersist(Session, true);
 }
Esempio n. 4
0
 /// <summary>
 /// Gets a property value given an edge id and a property type
 /// </summary>
 /// <param name="elementId">an edge id</param>
 /// <param name="property">a property type</param>
 /// <returns>a property value</returns>
 public IComparable GetPropertyValue(ElementId elementId, PropertyType property)
 {
     return(property.GetPropertyValue(elementId));
 }
Esempio n. 5
0
 /// <summary>
 /// Get the property value for a <see cref="Vertex"/>
 /// </summary>
 /// <param name="vertexId">Id of <see cref="Vertex"/></param>
 /// <param name="propertyType">Type of property</param>
 /// <returns></returns>
 public object GetPropertyValue(VertexId vertexId, PropertyType propertyType)
 {
   return propertyType.GetPropertyValue(vertexId);
 }