public override IEnumerable<IVertex> GetVertices(RequestGetVertices _request, Int64 Int64, SecurityToken SecurityToken) { #region case 1 - Expression if (_request.Expression != null) { if (!_queryPlanManager.IsValidExpression(_request.Expression)) { throw new InvalidExpressionException(_request.Expression); } } #endregion #region case 2 - No Expression else if (_request.VertexTypeName != null) { //2.1 typeName as string _vertexTypeManager.CheckManager.GetType(_request.VertexTypeName, Int64, SecurityToken); } else { //2.2 type as id _vertexTypeManager.CheckManager.GetType(_request.VertexTypeID, Int64, SecurityToken); } #endregion return null; }
/// <summary> /// Creates a new delete request that is able to delete attributes from certain vertices or /// the vertices themself /// </summary> /// <param name="myToBeDeletedVertices">The vertices that should be deleted/changed</param> public RequestDelete(RequestGetVertices myToBeDeletedVertices) { ToBeDeletedAttributes = new HashSet <string>(); ToBeDeletedVertices = myToBeDeletedVertices; DeletedAttributes = new List <IComparable>(); DeletedVertices = new List <IComparable>(); }
/// <summary> /// Creates a new delete request that is able to delete attributes from certain vertices or /// the vertices themself /// </summary> /// <param name="myToBeDeletedVertices">The vertices that should be deleted/changed</param> public RequestDelete(RequestGetVertices myToBeDeletedVertices) { ToBeDeletedAttributes = new HashSet<string>(); ToBeDeletedVertices = myToBeDeletedVertices; DeletedAttributes = new List<IComparable>(); DeletedVertices = new List<IComparable>(); }
/// <summary> /// Creates a new pipelineable get vertices request /// </summary> /// <param name="myGetVerticesRequest">The get vertices type request</param> /// <param name="mySecurity">The security token of the request initiator</param> /// <param name="myTransactionToken">The myOutgoingEdgeVertex transaction token</param> public PipelineableGetVerticesRequest( RequestGetVertices myGetVerticesRequest, SecurityToken mySecurity, Int64 myTransactionToken) : base(mySecurity, myTransactionToken) { _request = myGetVerticesRequest; }
/// <summary> /// Creates a new update request to get the vertices which should be updated /// </summary> /// <param name="myGetVerticesRequest">A request to get specific vertices.</param> public RequestUpdate(RequestGetVertices myGetVerticesRequest) { GetVerticesRequest = myGetVerticesRequest; }
public override IEnumerable<IVertex> GetVertices(RequestGetVertices _request, Int64 Int64, SecurityToken SecurityToken) { IEnumerable<IVertex> result; #region case 1 - Expression if (_request.Expression != null) { result = GetVertices(_request.Expression, _request.IsLongrunning, Int64, SecurityToken); } #endregion #region case 2 - No Expression else if (_request.VertexTypeName != null) { //2.1 typeName as string if (_request.VertexIDs != null) { //2.1.1 vertex ids List<IVertex> fetchedVertices = new List<IVertex>(); foreach (var item in _request.VertexIDs) { fetchedVertices.Add(GetVertex(_request.VertexTypeName, item, null, null, Int64, SecurityToken)); } result = fetchedVertices; } else { //2.1.2 no vertex ids ... take all result = GetVertices(_request.VertexTypeName, Int64, SecurityToken, true); } } else { //2.2 type as id if (_request.VertexIDs != null) { //2.2.1 vertex ids List<IVertex> fetchedVertices = new List<IVertex>(); foreach (var item in _request.VertexIDs) { fetchedVertices.Add(GetVertex(_request.VertexTypeID, item, null, null, Int64, SecurityToken)); } result = fetchedVertices; } else { //2.2.2 no vertex ids ... take all result = GetVertices(_request.VertexTypeID, Int64, SecurityToken, true); } } #endregion return result; }
private IEnumerable<IVertex> GetAllVertices(IVertexType myVertexType, SecurityToken mySecurityToken, Int64 myTransactionToken) { var request = new RequestGetVertices(myVertexType.ID); return _iGraphDB.GetVertices<IEnumerable<IVertex>>(mySecurityToken, myTransactionToken, request, (stats, vertices) => vertices); }
/// <summary> /// Sets the GetVertices request. /// </summary> /// <param name="myRequest">The get vertices request.</param> /// <returns>The reference of the current object. (fluent interface).</returns> public RequestUpdate SetGetVerticesRequest(RequestGetVertices myRequest) { GetVerticesRequest = myRequest; return(this); }
/// <summary> /// Gets all vertices depending to a request /// </summary> /// <param name="myRequest">The request</param> /// <param name="Int64">The current transaction token</param> /// <param name="SecurityToken">The current security token</param> /// <returns>An enumerable of all vertices</returns> public abstract IEnumerable<IVertex> GetVertices(RequestGetVertices myRequest, Int64 Int64, SecurityToken SecurityToken);
public static RequestDelete MakeRequestDelete(ServiceVertexType myVertexType, IEnumerable<Int64> myVertexIDs = null, ServiceDeletePayload myDeletePayload = null) { RequestGetVertices PreRequest = null; if (myVertexIDs != null) { PreRequest = new RequestGetVertices(myVertexType.Name, myVertexIDs); } else { PreRequest = new RequestGetVertices(myVertexType.Name); } RequestDelete Request = new RequestDelete(PreRequest); if (myDeletePayload != null) { foreach (var toDel in myDeletePayload.ToBeDeletedAttributes) { Request.AddAttribute(toDel); } } return Request; }
public TResult GetVertices <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, long myTransactionID, sones.GraphDB.Request.RequestGetVertices myRequestGetVertices, sones.GraphDB.Request.Converter.GetVerticesResultConverter <TResult> myOutputconverter) { Stopwatch RunningTime = Stopwatch.StartNew(); List <ServiceVertexInstance> svcVertices; if (myRequestGetVertices.VertexTypeName != null) { svcVertices = _GraphDSService.GetVerticesByType(mySecurityToken, myTransactionID, new ServiceVertexType(myRequestGetVertices.VertexTypeName)); } else if (myRequestGetVertices.VertexTypeID != null) { svcVertices = _GraphDSService.GetVerticesByType(mySecurityToken, myTransactionID, new ServiceVertexType(myRequestGetVertices.VertexTypeID)); } else { svcVertices = _GraphDSService.GetVerticesByExpression(mySecurityToken, myTransactionID, ConvertHelper.ToServiceExpression(myRequestGetVertices.Expression)); } var vertices = svcVertices.Select(x => new RemoteVertex(x, this)); RunningTime.Stop(); return(myOutputconverter(new RequestStatistics(new TimeSpan(RunningTime.ElapsedTicks)), vertices)); }
public static RequestUpdate MakeRequestUpdate(ServiceVertexType myVertexType, IEnumerable<Int64> myVertexIDs, ServiceUpdateChangeset myUpdateChangeset) { #region PreRequest RequestGetVertices PreRequest = null; if (myVertexIDs != null) { PreRequest = new RequestGetVertices(myVertexType.Name, myVertexIDs); } else { PreRequest = new RequestGetVertices(myVertexType.Name); } RequestUpdate Request = new RequestUpdate(PreRequest); if (!String.IsNullOrEmpty(myUpdateChangeset.Comment)) Request.UpdateComment(myUpdateChangeset.Comment); if (!String.IsNullOrEmpty(myUpdateChangeset.Edition)) Request.UpdateEdition(myUpdateChangeset.Edition); #endregion #region element collection foreach (var element in myUpdateChangeset.AddedElementsToCollectionProperties) { Request.AddElementsToCollection(element.Key, element.Value); } foreach (var element in myUpdateChangeset.RemovedElementsFromCollectionProperties) { Request.RemoveElementsFromCollection(element.Key, element.Value); } foreach (var element in myUpdateChangeset.AddedElementsToCollectionEdges) { Request.AddElementsToCollection(element.Key, element.Value.ToEdgePredefinition()); } foreach (var element in myUpdateChangeset.RemovedElementsFromCollectionEdges) { Request.RemoveElementsFromCollection(element.Key, element.Value.ToEdgePredefinition()); } #endregion #region Properties foreach (var item in myUpdateChangeset.UpdatedStructuredProperties) { Request.UpdateStructuredProperty(item.Key, item.Value); } foreach (var item in myUpdateChangeset.UpdatedUnstructuredProperties) { Request.UpdateUnstructuredProperty(item.Key, item.Value); } foreach (var item in myUpdateChangeset.UpdatedUnknownProperties) { Request.UpdateUnknownProperty(item.Key, item.Value); } #endregion #region Update Edges foreach (var Edge in myUpdateChangeset.UpdatedOutgoingEdges) { Request.UpdateEdge(Edge.ToEdgePredefinition()); } foreach (var Edge in myUpdateChangeset.UpdateOutgoingEdgesProperties) { Request.UpdateEdge(Edge.ToSingleEdgeUpdateDefinition()); } #endregion foreach (var item in myUpdateChangeset.RemovedAttributes) { Request.RemoveAttribute(item); } return Request; }
/// <summary> /// Sets the GetVertices request. /// </summary> /// <param name="myRequest">The get vertices request.</param> /// <returns>The reference of the current object. (fluent interface).</returns> public RequestUpdate SetGetVerticesRequest(RequestGetVertices myRequest) { GetVerticesRequest = myRequest; return this; }