/// <summary> /// Creates a Vertex with given label and properties /// </summary> /// <param name="label">Label of created vertex</param> /// <param name="properties">Properties of created vertex</param> /// <returns>Created IVertex</returns> public IVertex AddVertex(string label, IVertexProperties properties) { ++localId; try { IVertex vertex = GremlinClient.CreateVertexAndLabel(label, (Dictionary <string, List <IVertexValue> >)properties); logger.Debug("Vertex " + vertex.Label + " has been created."); return(vertex); } catch (WebSocketException we) { logger.Error("Can not connect to Server. " + we); throw; } catch (JsonReaderException jre) { logger.Error("Can not read JSON. " + jre.Data + jre.StackTrace); throw; } catch (Exception e) { logger.Error(e); throw; } }
/// <summary> /// Creates a Vertex with given label and properties /// </summary> /// <param name="label">Label of created vertex</param> /// <param name="properties">Properties of created vertex</param> /// <returns>Created IVertex</returns> public IVertex AddVertex(string label, IVertexProperties properties = null) { IVertex tmpVertex = new OrientVertex(); IVertexProperties orientProperties = properties; tmpVertex.Label = label; tmpVertex.ID = localId.ToString(); localId++; tmpVertex.Properties = orientProperties; try { IVertex createdVert = Gremlin.CreateVertexAndLabel(label, (Dictionary <string, List <IVertexValue> >)properties); logger.Info("Vertex " + createdVert.ID + "has been created."); tmpVertex = createdVert; } catch (WebSocketException we) { logger.Error("Can not connect to Server. " + we); throw; } catch (JsonReaderException jre) { logger.Error("Can not read JSON. " + jre.Data + jre.StackTrace); throw; } catch (Exception e) { logger.Error(e); throw; } return(tmpVertex); }
/// <summary> /// Gets a value from propertie with a key /// </summary> /// <param name="key">key of the value</param> /// <param name="properties">properties, that contains value</param> /// <returns>wanted value</returns> public object GetValueFromProperty(string key, IVertexProperties properties) { return(properties.GetProperty(key)); }
public Vertex(string label, int localId, IVertexProperties properties) { Label = label; ID = localId; Properties = properties; }