Beispiel #1
0
 public ServiceVertexType AlterVertexType(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType, ServiceAlterVertexChangeset myChangeset)
 {
     var Request = ServiceRequestFactory.MakeRequestAlterVertexType(myVertexType, myChangeset);
     var Response = this.GraphDS.AlterVertexType<IVertexType>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertexType);
     return new ServiceVertexType(Response);
 }
 public ServiceOutgoingEdgeDefinition(IOutgoingEdgeDefinition myOutgoingEdgeDefinition)
     : base(myOutgoingEdgeDefinition)
 {
     this.EdgeType = new ServiceEdgeType(myOutgoingEdgeDefinition.EdgeType);
     this.InnerEdgeType = new ServiceEdgeType(myOutgoingEdgeDefinition.InnerEdgeType);
     this.SourceVertexType = new ServiceVertexType(myOutgoingEdgeDefinition.SourceVertexType);
     this.TargetVertexType = new ServiceVertexType(myOutgoingEdgeDefinition.TargetVertexType);
     this.Multiplicity = ConvertHelper.ToServiceEdgeMultiplicity(myOutgoingEdgeDefinition.Multiplicity);
 }
 public ServiceIndexDefinition(IIndexDefinition myIndexDefinition)
 {
     this.Name = myIndexDefinition.Name;
     this.ID = myIndexDefinition.ID;
     this.IndexTypeName = myIndexDefinition.IndexTypeName;
     this.Edition = myIndexDefinition.Edition;
     this.IsUserdefined = myIndexDefinition.IsUserdefined;
     this.IndexedProperties = myIndexDefinition.IndexedProperties.Select(x => x.Name).ToList();
     this.VertexType = new ServiceVertexType(myIndexDefinition.VertexType);
     this.SourceIndex = (myIndexDefinition.SourceIndex == null) ? null : new ServiceIndexDefinition(myIndexDefinition.SourceIndex);
     this.IsRange = myIndexDefinition.IsRange;
     this.IsVersioned = myIndexDefinition.IsVersioned;
 }
Beispiel #4
0
 public static ServiceBaseType ToServiceBaseType(IBaseType myBaseType)
 {
     ServiceBaseType svcBaseType = null;
     if (myBaseType is IVertexType)
     {
         svcBaseType = new ServiceVertexType((IVertexType)myBaseType);
     }
     else if (myBaseType is IEdgeType)
     {
         svcBaseType = new ServiceEdgeType((IEdgeType)myBaseType);
     }
     return svcBaseType;
 }
Beispiel #5
0
 public List<ServiceOutgoingEdgeDefinition> GetOutgoingEdgeDefinitions(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, bool myIncludeAncestorDefinitions)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     var value = Response.GetOutgoingEdgeDefinitions(myIncludeAncestorDefinitions);
     if (value != null)
         return Response.GetOutgoingEdgeDefinitions(myIncludeAncestorDefinitions).Select(x => new ServiceOutgoingEdgeDefinition(x)).ToList();
     return null;
 }
Beispiel #6
0
        public static RequestAlterVertexType MakeRequestAlterVertexType(ServiceVertexType myVertexType, ServiceAlterVertexChangeset myChangeset)
        {
            var Request = new RequestAlterVertexType(myVertexType.Name);

            #region Add Attributes

            if (myChangeset.ToBeAddedProperties != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedProperties)
                {
                    Request.AddProperty(toAdd.ToPropertyPredefinition());
                }
            }

            if (myChangeset.ToBeAddedIncomingEdges != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedIncomingEdges)
                {
                    Request.AddIncomingEdge(toAdd.ToIncomingEdgePredefinition());
                }
            }

            if (myChangeset.ToBeAddedOutgoingEdges != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedOutgoingEdges)
                {
                    Request.AddOutgoingEdge(toAdd.ToOutgoingEdgePredefinition());
                }
            }

            if (myChangeset.ToBeAddedUniques != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedUniques)
                {
                    Request.AddUnique(toAdd.ToUniquePredefinition());
                }
            }

            if (myChangeset.ToBeAddedMandatories != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedMandatories)
                {
                    Request.AddMandatory(toAdd.ToMandatoryPredefinition());
                }
            }

            if (myChangeset.ToBeAddedIndices != null)
            {
                foreach (var toAdd in myChangeset.ToBeAddedIndices)
                {
                    Request.AddIndex(toAdd.ToIndexPredefinition());
                }
            }

            #endregion

            #region Remove Attributes

            if (myChangeset.ToBeRemovedProperties != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedProperties)
                {
                    Request.RemoveProperty(toDel);
                }
            }

            if (myChangeset.ToBeRemovedIncomingEdges != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedIncomingEdges)
                {
                    Request.RemoveIncomingEdge(toDel);
                }
            }

            if (myChangeset.ToBeRemovedOutgoingEdges != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedOutgoingEdges)
                {
                    Request.RemoveOutgoingEdge(toDel);
                }
            }

            if (myChangeset.ToBeRemovedUniques != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedUniques)
                {
                    Request.RemoveUnique(toDel);
                }
            }

            if (myChangeset.ToBeRemovedMandatories != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedMandatories)
                {
                    Request.RemoveMandatory(toDel);
                }
            }

            if (myChangeset.ToBeRemovedIndices != null)
            {
                foreach (var toDel in myChangeset.ToBeRemovedIndices)
                {
                    Request.RemoveIndex(toDel.Key, toDel.Value);
                }
            }

            #endregion

            #region define / undefine

            if (myChangeset.ToBeDefinedAttributes != null)
            {
                foreach (var toDefine in myChangeset.ToBeDefinedAttributes)
                {
                    Request.DefineAttribute(toDefine.ToUnknownAttributePredefinition());
                }
            }

            if (myChangeset.ToBeUndefinedAttributes != null)
            {
                foreach (var toUndefine in myChangeset.ToBeUndefinedAttributes)
                {
                    Request.UndefineAttribute(toUndefine);
                }
            }

            #endregion

            #region Rename Task

            if (myChangeset.ToBeRenamedProperties != null)
            {
                foreach (var toRename in myChangeset.ToBeRenamedProperties)
                {
                    Request.RenameAttribute(toRename.Key, toRename.Value);
                }
            }

            #endregion

            if (myChangeset.Comment != null)
                Request.SetComment(myChangeset.Comment);

            if (myChangeset.NewTypeName != null)
                Request.RenameType(myChangeset.NewTypeName);

            //todo add unknown attribute

            return Request;
        }
Beispiel #7
0
 public ServiceOutgoingEdgeDefinition GetOutgoingEdgeDefinition(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, string myEdgeName)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     var value = Response.GetOutgoingEdgeDefinition(myEdgeName);
     if (value != null)
         return new ServiceOutgoingEdgeDefinition(value);
     return null;
 }
 public static RequestGetVertices MakeRequestGetVertices(ServiceVertexType myVertexType)
 {
     return new RequestGetVertices(myVertexType.Name);
 }
Beispiel #9
0
 public static RequestGetVertexCount MakeRequestGetVertexCount(ServiceVertexType myVertexTypeName)
 {
     return new RequestGetVertexCount(myVertexTypeName.Name);
 }
Beispiel #10
0
 public ServiceBinaryPropertyDefinition GetBinaryPropertyDefinition(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, string myPropertyName)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return new ServiceBinaryPropertyDefinition(Response.GetBinaryPropertyDefinition(myPropertyName));
 }
        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;
        }
Beispiel #12
0
 public bool IsDescendantOrSelf(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, ServiceVertexType myOtherType)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myOtherType.Name);
     var BaseType = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return Response.IsDescendantOrSelf(BaseType);
 }
Beispiel #13
0
 public List<ServiceVertexType> GetAncestorVertexTypesAndSelf(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return Response.GetAncestorVertexTypesAndSelf().Select(x => new ServiceVertexType(x)).ToList();
 }
Beispiel #14
0
 public List<ServiceVertexInstance> GetVertices(SecurityToken mySecurityToken, Int64 myTransactionToken, ServiceVertexType myVertexType)
 {
     RequestGetVertices Request;
     if (myVertexType.Name == null)
     {
         Request = ServiceRequestFactory.MakeRequestGetVertices(myVertexType.ID);
     }
     else
     {
         Request = ServiceRequestFactory.MakeRequestGetVertices(myVertexType.Name);
     }
     var Response = this.GraphDS.GetVertices<IEnumerable<IVertex>>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertices);
     return Response.Select(x => new ServiceVertexInstance(x)).ToList();
 }
Beispiel #15
0
 public bool HasProperty(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, string myPropertyName)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return Response.HasProperty(myPropertyName);
 }
Beispiel #16
0
 public UInt64 GetVertexCount(SecurityToken mySecurityToken, Int64 myTransactionToken, ServiceVertexType myVertexType)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexCount(myVertexType);
     var Response = this.GraphDS.GetVertexCount<UInt64>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyCount);
     return Response;
 }
Beispiel #17
0
 public ServiceVertexInstance GetVertex(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType, Int64 myVertexID)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertex(myVertexType, myVertexID);
     var Response = this.GraphDS.GetVertex<IVertex>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConvertOnlyVertexInstance);
     return new ServiceVertexInstance(Response);
 }
Beispiel #18
0
 public Dictionary<Int64, String> DropVertexType(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType)
 {
     var Request = ServiceRequestFactory.MakeRequestDropVertexType(myVertexType);
     var Response = this.GraphDS.DropVertexType<Dictionary<Int64, String>>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConverteOnlyDeletedTypeIDs);
     return Response;
 }
Beispiel #19
0
 public void DropIndex(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType, String myIndexName, String myEdition)
 {
     var Request = ServiceRequestFactory.MakeRequestDropIndex(myVertexType, myIndexName, myEdition);
     var Response = this.GraphDS.DropIndex(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConverteToVoid);
 }
Beispiel #20
0
 public KeyValuePair<IEnumerable<IComparable>, IEnumerable<IComparable>> Delete(SecurityToken mySecurityToken, Int64 myTransactionToken,
     ServiceVertexType myVertexType, IEnumerable<Int64> myVertexIDs = null, ServiceDeletePayload myDeletePayload = null)
 {
     var Request = ServiceRequestFactory.MakeRequestDelete(myVertexType, myVertexIDs, myDeletePayload);
     var Result = this.GraphDS.Delete<KeyValuePair<IEnumerable<IComparable>, IEnumerable<IComparable>>>(mySecurityToken, myTransactionToken, Request,
         ServiceReturnConverter.ConverteAllLists);
     return Result;
 }
Beispiel #21
0
 public bool HasUniqueDefinitions(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, bool myIncludeAncestorDefinitions)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return Response.HasUniqueDefinitions(myIncludeAncestorDefinitions);
 }
Beispiel #22
0
        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;
        }
Beispiel #23
0
 public ServiceVertexType ParentVertexType(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return new ServiceVertexType(Response.ParentVertexType);
 }
Beispiel #24
0
 public static RequestDropIndex MakeRequestDropIndex(ServiceVertexType myVertexType, String myIndexName,String myEdition)
 {
     RequestDropIndex Request = new RequestDropIndex(myVertexType.Name, myIndexName, myEdition);
     return Request;
 }
Beispiel #25
0
 public ServiceAttributeDefinition GetAttributeDefinitionByID(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, long myAttributeID)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return ConvertHelper.ToServiceAttributeDefinition(Response.GetAttributeDefinition(myAttributeID));
 }
Beispiel #26
0
 public static RequestDropVertexType MakeRequestDropVertexType(ServiceVertexType myVertexType)
 {
     RequestDropVertexType Request = new RequestDropVertexType(myVertexType.Name);
     return Request;
 }
Beispiel #27
0
 public List<ServiceBinaryPropertyDefinition> GetBinaryPropertyDefinitions(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myServiceVertexType, bool myIncludeAncestorDefinitions)
 {
     var Request = ServiceRequestFactory.MakeRequestGetVertexType(myServiceVertexType.Name);
     var Response = this.GraphDS.GetVertexType<IVertexType>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertexType);
     return Response.GetBinaryProperties(myIncludeAncestorDefinitions).Select(x => new ServiceBinaryPropertyDefinition(x)).ToList();
 }
Beispiel #28
0
 public static RequestGetVertex MakeRequestGetVertex(ServiceVertexType myVertexType, Int64 myVertexID, String myEdition = null)
 {
     return new RequestGetVertex(myVertexType.Name, myVertexID, myEdition);
 }
 public ServiceUniqueDefinition(IUniqueDefinition myUniqueDefinition)
 {
     this.DefiningVertexType = new ServiceVertexType(myUniqueDefinition.DefiningVertexType);
     this.UniquePropertyDefinition = myUniqueDefinition.UniquePropertyDefinitions.Select(x => new ServicePropertyDefinition(x)).ToList();
     this.CorrespondingIndex = new ServiceIndexDefinition(myUniqueDefinition.CorrespondingIndex);
 }
Beispiel #30
0
 public List<ServiceVertexInstance> Update(SecurityToken mySecurityToken, Int64 myTransToken, ServiceVertexType myVertexType, IEnumerable<long> myVertexIDs, ServiceUpdateChangeset myUpdateChangeset)
 {
     var Request = ServiceRequestFactory.MakeRequestUpdate(myVertexType, myVertexIDs, myUpdateChangeset);
     var Response = this.GraphDS.Update<IEnumerable<IVertex>>(mySecurityToken, myTransToken, Request, ServiceReturnConverter.ConvertOnlyVertices);
     return Response.Select(x => new ServiceVertexInstance(x)).ToList();
 }