Exemplo n.º 1
0
        public void Init(ParsingContext context,
                         ParseTreeNode myParseTreeNode)
        {
            //createTypesStmt.Rule =    S_CREATE + S_EDGE + S_TYPE + bulkEdgeType
            //                        | S_CREATE + S_EDGE + S_TYPES + bulkEdgeTypeList;

            if (myParseTreeNode.ChildNodes[2].Token.KeyTerm ==
                ((SonesGQLGrammar)context.Language.Grammar).S_TYPES)
            {
                #region multiple VertexTypes

                foreach (var _ParseTreeNode in myParseTreeNode.ChildNodes[3].ChildNodes)
                {
                    if (_ParseTreeNode.AstNode != null)
                    {
                        BulkEdgeTypeListMemberNode aTempNode = (BulkEdgeTypeListMemberNode)_ParseTreeNode.AstNode;

                        var predef = new EdgeTypePredefinition(aTempNode.TypeName)
                                     .SetSuperTypeName(aTempNode.Extends)
                                     .SetComment(aTempNode.Comment);

                        foreach (var attr in aTempNode.Attributes)
                        {
                            predef.AddProperty(GenerateProperty(attr));
                        }

                        _TypePredefinitions.Add(predef);
                    }
                }

                #endregion
            }
            else
            {
                #region single vertex type

                BulkEdgeTypeNode aTempNode = (BulkEdgeTypeNode)myParseTreeNode.ChildNodes[3].AstNode;

                var predef =
                    new EdgeTypePredefinition(aTempNode.TypeName)
                    .SetSuperTypeName(aTempNode.Extends)
                    .SetComment(aTempNode.Comment);

                foreach (var attr in aTempNode.Attributes)
                {
                    predef.AddProperty(GenerateProperty(attr));
                }

                _TypePredefinitions.Add(predef);

                #endregion
            }
        }
Exemplo n.º 2
0
        public void Init(ParsingContext context,
                            ParseTreeNode myParseTreeNode)
        {
            //createTypesStmt.Rule =    S_CREATE + S_EDGE + S_TYPE + bulkEdgeType
            //                        | S_CREATE + S_EDGE + S_TYPES + bulkEdgeTypeList;

            if (myParseTreeNode.ChildNodes[2].Token.KeyTerm ==
                    ((SonesGQLGrammar)context.Language.Grammar).S_TYPES)
            {
                #region multiple VertexTypes

                foreach (var _ParseTreeNode in myParseTreeNode.ChildNodes[3].ChildNodes)
                {
                    if (_ParseTreeNode.AstNode != null)
                    {
                        BulkEdgeTypeListMemberNode aTempNode = (BulkEdgeTypeListMemberNode)_ParseTreeNode.AstNode;

                        var predef = new EdgeTypePredefinition(aTempNode.TypeName)
                                            .SetSuperTypeName(aTempNode.Extends)
                                            .SetComment(aTempNode.Comment);

                        foreach (var attr in aTempNode.Attributes)
                            predef.AddProperty(GenerateProperty(attr));

                        _TypePredefinitions.Add(predef);
                    }
                }

                #endregion
            }
            else
            {
                #region single vertex type

                BulkEdgeTypeNode aTempNode = (BulkEdgeTypeNode)myParseTreeNode.ChildNodes[3].AstNode;

                var predef =
                    new EdgeTypePredefinition(aTempNode.TypeName)
                        .SetSuperTypeName(aTempNode.Extends)
                        .SetComment(aTempNode.Comment);

                foreach (var attr in aTempNode.Attributes)
                    predef.AddProperty(GenerateProperty(attr));

                _TypePredefinitions.Add(predef);

                #endregion
            }
        }
        public EdgeTypePredefinition ToEdgeTypePredefinition()
        {
            EdgeTypePredefinition EdgeTypePreDef = new EdgeTypePredefinition(this.EdgeTypeName);

            if (this.IsSealed)
            {
                EdgeTypePreDef.MarkAsSealed();
            }

            EdgeTypePreDef.SetComment(this.Comment);
            EdgeTypePreDef.SetSuperTypeName(this.SuperEdgeTypeName);

            if (this.Properties != null)
            {
                foreach (var Property in this.Properties)
                {
                    EdgeTypePreDef.AddProperty(Property.ToPropertyPredefinition());
                }
            }

            return(EdgeTypePreDef);
        }
        public EdgeTypePredefinition ToEdgeTypePredefinition()
        {
            EdgeTypePredefinition EdgeTypePreDef = new EdgeTypePredefinition(this.EdgeTypeName);

            if (this.IsSealed)
                EdgeTypePreDef.MarkAsSealed();

            EdgeTypePreDef.SetComment(this.Comment);
            EdgeTypePreDef.SetSuperTypeName(this.SuperEdgeTypeName);

            if (this.Properties != null)
            {
                foreach (var Property in this.Properties)
                {
                    EdgeTypePreDef.AddProperty(Property.ToPropertyPredefinition());
                }
            }

            return EdgeTypePreDef;
        }