Beispiel #1
0
        /// <summary>
        /// Executes the given request
        /// </summary>
        public override void Execute(IMetaManager myMetaManager)
        {
            RequestUpdate update;

            _alteredEdgeType =
                myMetaManager
                .EdgeTypeManager
                .ExecuteManager
                .AlterType(_request,
                           Int64,
                           SecurityToken,
                           out update);

            #region update vertices

            //if (update.GetVerticesRequest == null)
            //{
            //    var getVerticesRequest = CreateGetVerticesRequest(myMetaManager, update);

            //    if (getVerticesRequest != null)
            //    {
            //        update.SetGetVerticesRequest(getVerticesRequest);

            //        myMetaManager
            //            .VertexManager
            //            .ExecuteManager
            //            .UpdateVertices(update,
            //                            Int64,
            //                            SecurityToken);
            //    }
            //}

            #endregion
        }
 public BackwardEdgeDefinition(string myAttributeName, string myTypeName, string myTypeAttributeName, IEdgeType myEdgeType)
 {
     AttributeName = myAttributeName;
     TypeName = myTypeName;
     TypeAttributeName = myTypeAttributeName;
     EdgeType = myEdgeType;
 }
Beispiel #3
0
        private void AddEdgeTypeAndAttributesRecursivly(IGraphDB myGraphDB,
                                                        SecurityToken mySecurityToken,
                                                        Int64 myTransactionToken,
                                                        IEdgeType type,
                                                        ref HashSet <IEdgeType> types)
        {
            if (!type.IsUserDefined)
            {
                return;
            }

            if (type.HasParentType)
            {
                if (!types.Contains(type.ParentEdgeType))
                {
                    types.Add(type.ParentEdgeType);

                    foreach (var attr in (type.GetAttributeDefinitions(false)).Where(attrDef => attrDef.Kind == AttributeType.Property))
                    {
                        var attrType = myGraphDB.GetEdgeType <IEdgeType>(mySecurityToken,
                                                                         myTransactionToken,
                                                                         new RequestGetEdgeType(attr.ID),
                                                                         (stats, edge) => edge);

                        AddEdgeTypeAndAttributesRecursivly(myGraphDB,
                                                           mySecurityToken,
                                                           myTransactionToken,
                                                           attrType,
                                                           ref types);
                    }
                }
            }
        }
        protected override void OnCompleteType(
            ITypeInitializationContext context)
        {
            EdgeType = context.GetType <EdgeType <T> >(
                new TypeReference(typeof(EdgeType <T>)));

            base.OnCompleteType(context);
        }
Beispiel #5
0
 private IQueryResult CreateOutput(IRequestStatistics myStats,
                                   IEdgeType myALteredType)
 {
     return(QueryResult.Success(_query,
                                SonesGQLConstants.GQL,
                                CreateVertexViews(myALteredType),
                                Convert.ToUInt64(myStats.ExecutionTime.Milliseconds)));
 }
Beispiel #6
0
 /// <summary>
 /// Generates a single vertex view corresponding to a created vertex type
 /// </summary>
 /// <param name="aCreatedVertes">The vertex type that has been created</param>
 /// <returns>The resulting vertex view</returns>
 private IVertexView GenerateAVertexView(IEdgeType aCreatedEdge)
 {
     return(new VertexView(new Dictionary <string, object>
     {
         { "EdgeType", aCreatedEdge.Name },
         { "EdgeTypeID", aCreatedEdge.ID }
     }, null));
 }
        protected override void OnCompleteType(
            ITypeCompletionContext context,
            ObjectTypeDefinition definition)
        {
            base.OnCompleteType(context, definition);

            EdgeType = context.GetType <EdgeType <T> >(
                context.TypeInspector.GetTypeRef(typeof(EdgeType <T>)));
        }
        protected override void OnCompleteType(
            ICompletionContext context,
            ObjectTypeDefinition definition)
        {
            base.OnCompleteType(context, definition);

            EdgeType = context.GetType <EdgeType <T> >(
                ClrTypeReference.FromSchemaType <EdgeType <T> >());
        }
Beispiel #9
0
        protected override void OnCompleteType(
            ITypeCompletionContext context,
            ObjectTypeDefinition definition)
        {
            base.OnCompleteType(context, definition);

            EdgeType = context.GetType <EdgeType <T> >(
                TypeReference.Create <EdgeType <T> >());
        }
Beispiel #10
0
        protected override void OnCompleteType(
            ICompletionContext context,
            ObjectTypeDefinition definition)
        {
            base.OnCompleteType(context, definition);

            EdgeType = context.GetType <EdgeType <T> >(
                new ClrTypeReference(typeof(EdgeType <T>),
                                     TypeContext.Output));
        }
Beispiel #11
0
        private IEnumerable <IVertexView> CreateVertexViews(IEdgeType myALteredType)
        {
            yield return(new VertexView(new Dictionary <string, object>
            {
                { SonesGQLConstants.EdgeType, myALteredType.Name },
                { "EdgeTypeID", myALteredType.ID }
            }, null));

            yield break;
        }
 public override void Execute(IMetaManager myMetaManager)
 {
     _createdEdgeType =
         myMetaManager
         .EdgeTypeManager
         .ExecuteManager
         .AddTypes(new List <ATypePredefinition> {
         _request.EdgeTypePredefinition
     },
                   Int64,
                   SecurityToken).FirstOrDefault();
 }
Beispiel #13
0
        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            #region Extract type and attribute

            //if (parseNode.ChildNodes.Count != 4)
            //    throw new Exception("This is not a [Type].[Attribute] definition: " + parseNode.ChildNodes[0].ToString());

            _TypeName = parseNode.ChildNodes[0].Token.ValueString;
            _TypeAttributeName = parseNode.ChildNodes[2].Token.ValueString;

            #endregion

            _EdgeType = new EdgeTypeSetOfReferences();
            _AttributeName = parseNode.ChildNodes[3].Token.ValueString;

            BackwardEdgeDefinition = new BackwardEdgeDefinition(_AttributeName, _TypeName, _TypeAttributeName, _EdgeType);
        }
Beispiel #14
0
        /// <summary>
        /// generates an output for an edgetype
        /// </summary>
        /// <param name="myEdge">the edge</param>
        /// <param name="myEdgeName">edge name</param>
        /// <returns>list of readouts with the information</returns>
        private Vertex GenerateOutput(IEdgeType myEdge, String myEdgeName)
        {
            string Temp = "";
            int Pos = 0;

            Temp = myEdge.ToString();
            Pos = Temp.IndexOf(",");

            var Edge = new Dictionary<String, Object>();

            if (myEdgeName != "")
                Edge.Add("Name", myEdgeName);
            else
                Edge.Add("Name", Temp.Substring(Pos + 1, Temp.Length - (Pos + 1)));

            Edge.Add("EdgeType", Convert.ToUInt32(Temp.Substring(0, Pos)));

            return new Vertex(Edge);
        }
Beispiel #15
0
        /// <summary>
        /// generates an output for an edgetype
        /// </summary>
        /// <param name="myEdge">the edge</param>
        /// <param name="myEdgeName">edge name</param>
        /// <returns>list of readouts with the information</returns>
        private IVertexView GenerateOutput(IEdgeType myEdge, String myEdgeName)
        {
            var Edge = new Dictionary <String, Object>();

            Edge.Add("ID", myEdge.ID);
            Edge.Add("Type", myEdge.GetType().Name);
            Edge.Add("Name", myEdge.Name);
            Edge.Add("IsUserDefined", myEdge.IsUserDefined);
            Edge.Add("IsSealed", myEdge.IsSealed);
            Edge.Add("ParentEdgeType", myEdge.ParentEdgeType.Name);

            var list = new ListCollectionWrapper();

            foreach (var child in myEdge.ChildrenEdgeTypes)
            {
                list.Add(child.Name);
            }

            Edge.Add("ChildrenEdgeTypes", list);
            Edge.Add("Comment", myEdge.Comment);

            return(new VertexView(Edge, new Dictionary <String, IEdgeView>()));
        }
        public override void Execute(IMetaManager myMetaManager)
        {
            IEdgeType graphDBType = myMetaManager
                                    .EdgeTypeManager
                                    .ExecuteManager
                                    .GetType(_request.TypeName,
                                             Int64,
                                             SecurityToken);

            if (graphDBType == null)
            {
                throw new TypeDoesNotExistException <IEdgeType>(_request.TypeName);
            }

            _deletedTypeIDs = myMetaManager
                              .EdgeTypeManager
                              .ExecuteManager
                              .RemoveTypes(new List <IEdgeType> {
                graphDBType
            },
                                           Int64,
                                           SecurityToken);
        }
Beispiel #17
0
 public override void Execute(IMetaManager myMetaManager)
 {
     if (_request.EdgeTypeName == null)
     {
         _fetchedEdgeType =
             myMetaManager
             .EdgeTypeManager
             .ExecuteManager
             .GetType(_request.EdgeTypeID,
                      Int64,
                      SecurityToken);
     }
     else
     {
         _fetchedEdgeType =
             myMetaManager
             .EdgeTypeManager
             .ExecuteManager
             .GetType(_request.EdgeTypeName,
                      Int64,
                      SecurityToken);
     }
 }
Beispiel #18
0
 public ServiceEdgeType(IEdgeType myEdgeType)
     : base(myEdgeType)
 {
 }
 public static IEdgeType ConvertOnlyEdgeType(IRequestStatistics myRequestStatistics, IEdgeType myCreatedEdgeType)
 {
     return(myCreatedEdgeType);
 }
 public bool IsAncestor(IEdgeType myotherType, bool myIncludeSelf)
 {
     throw new NotImplementedException();
 }
        private SingleEdgeAddDefinition? CreateSingleEdgeAddDefinition(
            Int64 myTransaction,
            SecurityToken mySecurity,
            long date,
            long myAttributeID,
            EdgePredefinition edgeDef,
            IEdgeType myEdgeType,
            VertexInformation source,
            IOutgoingEdgeDefinition attrDef)
        {
            AddDefaultPropertiesToEdgePredefinition(ref edgeDef, attrDef, date);

            var vertexIDs = GetResultingVertexIDs(myTransaction,
                                                    mySecurity,
                                                    edgeDef,
                                                    attrDef.TargetVertexType);

            if (vertexIDs == null)
                return null;

            CheckTargetVertices(attrDef.TargetVertexType, vertexIDs);

            //adds the basic attributes like CreationDate, ModificationDate ... to the structured properties
            AddDefaultValues(ref edgeDef, myEdgeType);

            return new SingleEdgeAddDefinition(myAttributeID,
                                                myEdgeType.ID,
                                                source,
                                                vertexIDs.First(),
                                                edgeDef.Comment,
                                                date,
                                                date,
                                                ConvertStructuredProperties(edgeDef, myEdgeType),
                                                edgeDef.UnstructuredProperties);
        }
Beispiel #22
0
 public ServiceEdgeType(IEdgeType myEdgeType)
     : base(myEdgeType)
 {
 }
Beispiel #23
0
        /// <summary>
        /// Creates the ddl of a type.
        /// </summary>
        /// <param name="myVertexType">The vertex type.</param>
        private String CreateGraphDDL_EdgeType(IEdgeType myEdgeType)
        {
            var stringBuilder = new StringBuilder();
            var delimiter = ", ";
            stringBuilder.AppendFormat("{0} ", myEdgeType.Name);

            #region parent type

            //EXTENDS ...
            if (myEdgeType.HasParentType)
            {
                stringBuilder.AppendFormat("{0} {1} ", S_EXTENDS.ToUpperString(), myEdgeType.ParentEdgeType.Name);
            }

            #endregion

            #region attributes
            //are there attributes
            if (myEdgeType.HasAttributes(false))
            {
                //so, there are attributes that are no incoming edges
                stringBuilder.Append(String.Concat(S_ATTRIBUTES.ToUpperString(), " ", S_BRACKET_LEFT));

                #region properties

                if (myEdgeType.GetAttributeDefinitions(false).Any(aAttribute => aAttribute.Kind == AttributeType.Property))
                    stringBuilder.Append(String.Concat(CreateGraphDDLOfProperties(myEdgeType.GetPropertyDefinitions(false))));

                #endregion

                if (stringBuilder.ToString().EndsWith(delimiter))
                    stringBuilder.RemoveEnding(delimiter.Length);

                stringBuilder.Append(String.Concat(S_BRACKET_RIGHT));
            }

            #endregion

            return stringBuilder.ToString();
        }
Beispiel #24
0
 private IQueryResult CreateOutput(IRequestStatistics myStats, 
                                     IEdgeType myALteredType)
 {
     return QueryResult.Success(_query, 
                             SonesGQLConstants.GQL,
                             CreateVertexViews(myALteredType),
                             Convert.ToUInt64(myStats.ExecutionTime.Milliseconds));
 }
Beispiel #25
0
        private IEnumerable<SingleEdgeView> GenerateSingleEdgeViews(SecurityToken mySecurityToken, 
                                                                    Int64 myTransactionToken, 
                                                                    IEnumerable<ISingleEdge> mySingleEdges, 
                                                                    IVertexType myVertexType, 
                                                                    long myDepth, 
                                                                    EdgeList myEdgeList, 
                                                                    string reference, 
                                                                    bool myUsingGraph, 
                                                                    IEdgeType myInnerEdgeType)
        {
            foreach (var aSingleEdge in mySingleEdges)
            {
                yield return GenerateASingleEdgeView(mySecurityToken, 
                                                        myTransactionToken, 
                                                        aSingleEdge, 
                                                        myVertexType, 
                                                        myDepth, 
                                                        myEdgeList, 
                                                        reference, 
                                                        myUsingGraph, 
                                                        myInnerEdgeType);
            }

            yield break;
        }
Beispiel #26
0
        private void AddEdgeTypeAndAttributesRecursivly(IGraphDB myGraphDB,
            SecurityToken mySecurityToken,
            Int64 myTransactionToken,
            IEdgeType type,
            ref HashSet<IEdgeType> types)
        {
            if (!type.IsUserDefined) return;

            if (type.HasParentType)
            {
                if (!types.Contains(type.ParentEdgeType))
                {
                    types.Add(type.ParentEdgeType);

                    foreach (var attr in (type.GetAttributeDefinitions(false)).Where(attrDef => attrDef.Kind == AttributeType.Property))
                    {
                        var attrType = myGraphDB.GetEdgeType<IEdgeType>(mySecurityToken,
                                                                            myTransactionToken,
                                                                            new RequestGetEdgeType(attr.ID),
                                                                            (stats, edge) => edge);

                        AddEdgeTypeAndAttributesRecursivly(myGraphDB,
                                                                mySecurityToken,
                                                                myTransactionToken,
                                                                attrType,
                                                                ref types);
                    }
                }
            }
        }
Beispiel #27
0
 /// <summary>
 /// Generates a single vertex view corresponding to a created vertex type
 /// </summary>
 /// <param name="aCreatedVertes">The vertex type that has been created</param>
 /// <returns>The resulting vertex view</returns>
 private IVertexView GenerateAVertexView(IEdgeType aCreatedEdge)
 {
     return new VertexView(new Dictionary<string, object>
                                 {
                                     {"EdgeType", aCreatedEdge.Name},
                                     {"EdgeTypeID", aCreatedEdge.ID}
                                 }, null);
 }
 public bool IsDescendant(IEdgeType myotherType, bool myIncludeSelf)
 {
     throw new NotImplementedException();
 }
 public bool IsDescendant(IEdgeType myotherType)
 {
     throw new NotImplementedException();
 }
Beispiel #30
0
        /// <summary>
        /// generates an output for an edgetype
        /// </summary>
        /// <param name="myEdge">the edge</param>
        /// <param name="myEdgeName">edge name</param>
        /// <returns>list of readouts with the information</returns>
        private IVertexView GenerateOutput(IEdgeType myEdge, String myEdgeName)
        {
            var Edge = new Dictionary<String, Object>();

            Edge.Add("ID", myEdge.ID);
            Edge.Add("Type", myEdge.GetType().Name);
            Edge.Add("Name", myEdge.Name);
            Edge.Add("IsAbstract", myEdge.IsAbstract);
            Edge.Add("IsUserDefined", myEdge.IsUserDefined);
            Edge.Add("IsSealed", myEdge.IsSealed);
            Edge.Add("ParentEdgeType", myEdge.ParentEdgeType.Name);

            var list = new ListCollectionWrapper();
            foreach (var child in myEdge.ChildrenEdgeTypes)
                list.Add(child.Name);

            Edge.Add("ChildrenEdgeTypes", list);
            Edge.Add("Comment", myEdge.Comment);

            return new VertexView(Edge, new Dictionary<String,IEdgeView>());
        }
Beispiel #31
0
 private SingleEdgeView GenerateASingleEdgeView(SecurityToken mySecurityToken, 
                                                 Int64 myTransactionToken, 
                                                 ISingleEdge aSingleEdge, 
                                                 IVertexType myVertexType, 
                                                 long myDepth, 
                                                 EdgeList myEdgeList, 
                                                 string reference, 
                                                 bool myUsingGraph, 
                                                 IEdgeType myInnerEdgeType)
 {
     return new SingleEdgeView(GetEdgeProperties(aSingleEdge, myInnerEdgeType), 
                                 LoadAndResolveVertex(mySecurityToken, 
                                                         myTransactionToken, 
                                                         aSingleEdge.GetTargetVertex(), 
                                                         myVertexType, 
                                                         myDepth, 
                                                         myEdgeList, 
                                                         reference, 
                                                         myUsingGraph));
 }
 public static IEdgeType ConvertOnlyEdgeType(IRequestStatistics myRequestStatistics, IEdgeType myCreatedEdgeType)
 {
     return myCreatedEdgeType;
 }
Beispiel #33
0
        private IDictionary<string, object> GetEdgeProperties(ISingleEdge aSingleEdge, IEdgeType myInnerEdgeType)
        {
            Dictionary<String, Object> result = new Dictionary<string, object>();

            #region properties

            if (myInnerEdgeType != null)
            {
                foreach (var aProperty in myInnerEdgeType.GetPropertyDefinitions(true))
                {
                    if (aSingleEdge.HasProperty(aProperty.ID))
                    {
                        result.Add(aProperty.Name, aProperty.GetValue(aSingleEdge));
                    }
                    else
                    {
                        var tempResult = aProperty.GetValue(aSingleEdge);

                        if (tempResult != null)
                        {
                            result.Add(aProperty.Name, tempResult);
                        }
                    }
                }
            }

            #endregion

            #region unstructured data

            foreach (var aUnstructuredProperty in aSingleEdge.GetAllUnstructuredProperties())
            {
                result.Add(aUnstructuredProperty.PropertyName, aUnstructuredProperty.Property);
            }

            #endregion

            return result;
        }
Beispiel #34
0
        private IEnumerable<IVertexView> CreateVertexViews(IEdgeType myALteredType)
        {
            yield return new VertexView(new Dictionary<string, object>
                                                         {
                                                             {SonesGQLConstants.EdgeType, myALteredType.Name},
                                                             {"EdgeTypeID", myALteredType.ID}
                                                         }, null);

            yield break;
        }
 public Error_TooManyElementsForEdge(IEdgeType edgeType, UInt64 currentElements)
 {
     CurrentElements = currentElements;
     EdgeType = edgeType;
 }
Beispiel #36
0
        private string GetGraphDDLOfInnerEdge(IEdgeType myInnerEdge, IVertexType myIVertexType)
        {
            var stringBuilder = new StringBuilder();

            #region build string for inner edge

            if (myInnerEdge != null)
            {
                stringBuilder.Append(String.Concat(S_BRACKET_LEFT, myInnerEdge.Name, S_BRACKET_RIGHT));
            }

            #endregion

            return stringBuilder.ToString();
        }
Beispiel #37
0
        internal ServiceEdgeType(IEdgeType myEdgeType) : base(myEdgeType.Name)
        {

        }
Beispiel #38
0
        private SingleEdgeAddDefinition? CreateSingleEdgeAddDefinition(
            TransactionToken myTransaction,
            SecurityToken mySecurity,
            long date,
            long myAttributeID,
            EdgePredefinition edgeDef,
            IEdgeType myEdgeType,
            VertexInformation source,
            IVertexType myTargetType = null)
        {
            var vertexIDs = GetResultingVertexIDs(myTransaction, mySecurity, edgeDef, myTargetType);
            if (vertexIDs == null)
                return null;

            CheckMandatoryConstraint(edgeDef, myEdgeType);
            CheckTargetVertices(myTargetType, vertexIDs);
            AddDefaultValues(edgeDef, myEdgeType);
            return new SingleEdgeAddDefinition(myAttributeID, myEdgeType.ID, source, vertexIDs.First(), edgeDef.Comment, date, date, ConvertStructuredProperties(edgeDef, myEdgeType), edgeDef.UnstructuredProperties);
        }
Beispiel #39
0
 internal ServiceEdgeType(IEdgeType myEdgeType) : base(myEdgeType.Name)
 {
 }
        private void AddDefaultValues(ref EdgePredefinition edgeDef, IEdgeType myEdgeType)
        {
            var mandatoryProps = myEdgeType.GetPropertyDefinitions(true).Where(_ => _.IsMandatory);

            foreach (var propertyDefinition in mandatoryProps)
            {
                if (edgeDef.StructuredProperties == null || 
                    !edgeDef.StructuredProperties.ContainsKey(propertyDefinition.Name))
                    edgeDef.AddStructuredProperty(propertyDefinition.Name, propertyDefinition.DefaultValue);
            }
        }
 public bool IsAncestor(IEdgeType myotherType)
 {
     throw new NotImplementedException();
 }