]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/metadata/create_V7_mowgli/METADATA/lex.yy_ind.c
New metadata for sort and rel.
[helm.git] / helm / metadata / create_V7_mowgli / METADATA / lex.yy_ind.c
index 643ff9f1fe067fc3340d840fedca268c5842ecfa..c233e427a7e3f15ff3068e4a0f8aeb4f9006987e 100644 (file)
@@ -291,24 +291,25 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
        *yy_cp = '\0'; \
        yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 22
-#define YY_END_OF_BUFFER 23
-static yyconst short int yy_accept[125] =
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
+static yyconst short int yy_accept[138] =
     {   0,
-        0,    0,   23,    9,    9,    9,    9,    0,    0,    0,
+        0,    0,   24,    9,    9,    9,    9,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,   13,
-        0,    0,    0,   11,   15,    0,    6,    0,    0,    0,
-        0,    0,    0,    8,    0,    0,    0,    0,    0,    0,
-        0,    5,    0,    0,    0,    0,    0,    0,   14,   16,
-        0,    0,    0,    0,    0,    0,    0,    0,   19,    0,
-        0,    7,    0,    0,   10,    0,    0,   17,    0,    0,
-        0,    2,    0,    0,   12,    0,    0,    0,    0,    0,
-
-        0,    0,    0,   20,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   21,    0,    3,    0,    0,    0,    0,
-       18,    4,    1,    0
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   12,    0,    0,    0,   14,    0,   16,    0,    6,
+        0,    0,    0,    0,    0,    0,    8,    0,    0,    0,
+        0,    0,    0,    0,    0,    5,    0,    0,    0,    0,
+        0,    0,   13,   17,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   20,    0,    0,    7,    0,    0,   10,
+        0,    0,   18,    0,    0,    0,    0,    2,    0,    0,
+
+       11,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   21,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   22,    0,    3,    0,    0,    0,    0,
+        0,   19,    0,    4,    1,   15,    0
     } ;
 
 static yyconst int yy_ec[256] =
@@ -316,17 +317,17 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    3,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    4,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,    5,    1,    1,    6,
-        7,    8,    1,    1,    9,   10,   11,   12,   13,   14,
-        1,    1,   15,    1,    1,   16,   17,   18,   19,    1,
-        1,   20,   21,   22,   23,   24,    1,   25,    1,    1,
-        1,    1,    1,    1,    1,    1,   26,    1,   27,   28,
-
-       29,   30,    1,    1,   31,    1,    1,   32,    1,   33,
-       34,   35,    1,   36,   37,   38,   39,   40,    1,    1,
-       41,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    3,    1,    4,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    5,    6,    6,    6,
+        6,    6,    6,    6,    6,    6,    6,    1,    1,    7,
+        8,    9,    1,    1,   10,   11,   12,   13,   14,   15,
+        1,    1,   16,    1,    1,   17,   18,   19,   20,    1,
+        1,   21,   22,   23,   24,   25,    1,   26,    1,    1,
+        1,    1,    1,    1,    1,    1,   27,    1,   28,   29,
+
+       30,   31,    1,    1,   32,    1,    1,   33,    1,   34,
+       35,   36,    1,   37,   38,   39,   40,   41,    1,    1,
+       42,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -343,97 +344,103 @@ static yyconst int yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static yyconst int yy_meta[42] =
+static yyconst int yy_meta[43] =
     {   0,
-        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    2,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1
+        1,    1
     } ;
 
-static yyconst short int yy_base[127] =
+static yyconst short int yy_base[141] =
     {   0,
-        0,    1,  139,  140,   37,  104,  101,    0,    1,  121,
-      102,  125,  110,  119,  122,  101,    1,   98,   94,   91,
-       97,    0,   92,   99,   95,  105,   99,  104,   99,    0,
-       84,   76,  109,   82,   83,    2,   98,   91,   74,  140,
-       71,   99,    2,  140,  140,   76,  140,   74,   71,  102,
-       67,   65,   70,  140,   76,   78,   61,   71,   85,    0,
-       78,  140,   58,   65,    0,   55,   51,   83,  140,  140,
-       54,   51,   79,   66,   68,   73,   46,   76,    0,   46,
-       73,  140,   41,   48,  140,   65,   56,  140,   40,   72,
-       35,  140,   46,   32,  140,   49,   63,   64,   41,   26,
-
-       34,   42,   57,   54,   20,   22,   33,   27,   44,   13,
-       10,    4,   33,   38,    6,  140,    3,   15,   28,    2,
-      140,  140,  140,  140,   65,    0
+        0,    1,  151,  152,   37,  115,  112,    0,    1,  132,
+      113,  136,  121,  130,  123,  132,  111,    1,  108,  104,
+      101,  107,    0,  102,  109,  105,  115,  109,  114,  109,
+      108,    0,   93,   85,  118,   91,   92,    2,  107,  100,
+       83,  152,   80,  108,    2,  152,   95,  152,   84,  152,
+       82,   79,  110,   75,   73,   78,  152,   84,   86,   69,
+       79,   93,    0,   86,    0,  152,   66,   73,    0,   63,
+       59,   91,  152,  152,   62,   59,   87,   74,   76,   81,
+        2,   54,   84,    0,   54,   81,  152,   49,   56,  152,
+       73,   64,  152,   58,   47,   79,   42,  152,   53,   39,
+
+      152,   56,   45,   69,   70,   47,   35,   43,   51,   31,
+       66,   63,   26,   29,   40,   37,   30,   51,   21,   14,
+        8,   36,   39,   40,    8,  152,    8,   16,   34,   28,
+        2,  152,    0,  152,  152,    0,  152,   66,    5,    0
     } ;
 
-static yyconst short int yy_def[127] =
+static yyconst short int yy_def[141] =
     {   0,
-      125,  125,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  126,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  126,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,    0,  124,  124
+      138,  138,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  139,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  139,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  140,  137,  137,  140,    0,  137,  137,  137
     } ;
 
-static yyconst short int yy_nxt[182] =
+static yyconst short int yy_nxt[195] =
     {   0,
-       79,  124,  124,  124,  124,    5,    5,  124,   74,  124,
-       19,   31,   60,   37,  124,  124,   61,   38,   75,   22,
-      124,  124,   32,  124,  124,   20,   46,   21,   53,   47,
-      123,   54,    6,    6,   23,  122,  121,  120,    7,    7,
-        8,  119,  114,  118,  117,  116,  115,    9,  114,  113,
-       10,   11,   12,   13,  112,  111,   14,  110,  104,  109,
-       15,  108,  107,  106,   16,    4,    4,  105,  104,  103,
-      102,  101,  100,   99,   98,   97,   96,   95,   94,   93,
-       92,   91,   90,   89,   88,   87,   86,   85,   84,   83,
-       82,   81,   80,   78,   77,   76,   73,   72,   71,   70,
-
-       69,   68,   67,   66,   65,   64,   63,   62,   59,   58,
-       57,   56,   55,   52,   51,   50,   49,   48,   45,   44,
-       43,   42,   41,   40,   39,   36,   35,   34,   33,   30,
-       29,   28,   27,   26,   25,   24,   18,   17,  124,    3,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124
+      136,   81,   81,   81,   81,   84,    5,    5,  137,   78,
+      137,   20,   33,   63,   39,  137,  137,   64,   40,   79,
+       23,  137,  137,   34,  137,  137,   21,   49,   22,   56,
+       50,  135,   57,    6,    6,   24,  134,  133,  132,    7,
+        7,    8,   94,  131,  130,  124,  129,  128,    9,  127,
+      126,   10,   11,   12,   13,  125,  124,   14,   15,  123,
+      122,   16,  121,  120,  119,   17,    4,    4,  112,  118,
+      117,  116,  115,  114,  113,  112,  111,  110,  109,  108,
+      107,  106,  105,  104,  103,  102,  101,  100,   99,   98,
+       97,   96,   95,   93,   92,   91,   90,   89,   88,   87,
+
+       86,   85,   83,   82,   80,   77,   76,   75,   74,   73,
+       72,   71,   70,   69,   68,   67,   66,   65,   62,   61,
+       60,   59,   58,   55,   54,   53,   52,   51,   48,   47,
+       46,   45,   44,   43,   42,   41,   38,   37,   36,   35,
+       32,   31,   30,   29,   28,   27,   26,   25,   19,   18,
+      137,    3,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137
+
     } ;
 
-static yyconst short int yy_chk[182] =
+static yyconst short int yy_chk[195] =
     {   0,
-      126,    0,    0,    0,    0,    1,    2,    0,   60,    0,
-        8,   17,   43,   22,    0,    0,   43,   22,   60,    9,
-        0,    0,   17,    0,    0,    8,   30,    8,   36,   30,
-      120,   36,    1,    2,    9,  119,  118,  117,    1,    2,
-        5,  115,  114,  113,  112,  111,  110,    5,  109,  108,
-        5,    5,    5,    5,  107,  106,    5,  105,  104,  103,
-        5,  102,  101,  100,    5,  125,  125,   99,   98,   97,
-       96,   94,   93,   91,   90,   89,   87,   86,   84,   83,
-       81,   80,   78,   77,   76,   75,   74,   73,   72,   71,
-       68,   67,   66,   64,   63,   61,   59,   58,   57,   56,
-
-       55,   53,   52,   51,   50,   49,   48,   46,   42,   41,
-       39,   38,   37,   35,   34,   33,   32,   31,   29,   28,
-       27,   26,   25,   24,   23,   21,   20,   19,   18,   16,
-       15,   14,   13,   12,   11,   10,    7,    6,    3,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124,  124,  124,  124,  124,  124,  124,  124,  124,  124,
-      124
+      140,   65,   65,   81,   81,  139,    1,    2,    0,   63,
+        0,    8,   18,   45,   23,    0,    0,   45,   23,   63,
+        9,    0,    0,   18,    0,    0,    8,   32,    8,   38,
+       32,  131,   38,    1,    2,    9,  130,  129,  128,    1,
+        2,    5,   81,  127,  125,  124,  123,  122,    5,  121,
+      120,    5,    5,    5,    5,  119,  118,    5,    5,  117,
+      116,    5,  115,  114,  113,    5,  138,  138,  112,  111,
+      110,  109,  108,  107,  106,  105,  104,  103,  102,  100,
+       99,   97,   96,   95,   94,   92,   91,   89,   88,   86,
+       85,   83,   82,   80,   79,   78,   77,   76,   75,   72,
+
+       71,   70,   68,   67,   64,   62,   61,   60,   59,   58,
+       56,   55,   54,   53,   52,   51,   49,   47,   44,   43,
+       41,   40,   39,   37,   36,   35,   34,   33,   31,   30,
+       29,   28,   27,   26,   25,   24,   22,   21,   20,   19,
+       17,   16,   15,   14,   13,   12,   11,   10,    7,    6,
+        3,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137,  137,  137,  137,  137,  137,  137,
+      137,  137,  137,  137
+
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -486,15 +493,17 @@ char *yytext;
 #line 39 "meta_lex_ind.l"
 #include                <string.h>
 #include                <stdlib.h>
+#include                <sys/stat.h>
 #include                "sthandler_ind.h"
 /***************************************************************/
 /* 2. Constants and Variables Definitions                      */
 /***************************************************************/
-#line 49 "meta_lex_ind.l"
+#line 50 "meta_lex_ind.l"
 #define                 NOWHERE   0
 #define                 CONST     1
 #define                 MUTIND    2
 #define                 MUTCONSTRUCT  3
+#define                 SORT      4
 
 #define                 INBODY    0
 #define                 MAINHYP   1
@@ -510,12 +519,14 @@ char *yytext;
 
 int                    where = NOWHERE;
 int                     found = NOTFOUND;
-int                     position = INTYPE;
+int                     position = INBODY;
 int                     first_child = HERE;
 int                    skip = 0;     // boolean to skip the insertion of a URI
 int                     no_open_source =0;
+int                     spine_depth = 0;
+int                     depth = 0;
 int                     tmp_n;
-int                     inductive_type =0;
+int                     inductive_type = 0;
 int                     constructor = 0;
 int                     deep_type = 0;
 char                    sep = '"';
@@ -527,33 +538,13 @@ char                    *file_uri;
 char                    *inductive_uri;
 char                    *filename_prefix;
 char                    *file_uri_prefix;
-
-/*%x deeptype*/
 /***************************************************************/
 /* 3. Regular definitions.                                     */
 /***************************************************************/
 /***************************************************************/
 /* 4. Rules.                                                   */
 /***************************************************************/
-/*
-"<type>"           {
-                     BEGIN(deeptype);
-                     deep_type++;
-                   }
-
-<deeptype>"<type>" {
-                     deep_type++;
-                   }
-
-<deeptype>"</type>" {
-                     deep_type--;
-                     if (deeptype == 0) BEGIN(0);
-                   }
-
-<deeptype>.|\n     {
-                   }
-*/
-#line 557 "lex.yy_ind.c"
+#line 548 "lex.yy_ind.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -715,10 +706,10 @@ YY_DECL
        register char *yy_cp, *yy_bp;
        register int yy_act;
 
-#line 121 "meta_lex_ind.l"
+#line 104 "meta_lex_ind.l"
 
 
-#line 722 "lex.yy_ind.c"
+#line 713 "lex.yy_ind.c"
 
        if ( yy_init )
                {
@@ -769,13 +760,13 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 125 )
+                               if ( yy_current_state >= 138 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
                        ++yy_cp;
                        }
-               while ( yy_base[yy_current_state] != 140 );
+               while ( yy_base[yy_current_state] != 152 );
 
 yy_find_action:
                yy_act = yy_accept[yy_current_state];
@@ -803,11 +794,14 @@ do_action:        /* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 123 "meta_lex_ind.l"
+#line 106 "meta_lex_ind.l"
 { 
-                     fprintf(stderr,"uno");
+                     /* fprintf(stderr,"uno"); */
                      init_symbol_table();
-                     fprintf(stderr,"due");
+                     no_open_source = 0;
+                     depth = 0;
+                     spine_depth = 0;
+                     /* fprintf(stderr,"due"); */
                      inductive_type++;
                      constructor=0;
                      position = INTYPE;
@@ -816,25 +810,28 @@ YY_RULE_SETUP
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 133 "meta_lex_ind.l"
+#line 119 "meta_lex_ind.l"
 { tmp = (char *)malloc(sizeof('a')*128);
                      strcpy(filename,filename_prefix);
-                     fprintf(stderr,"tre");
+                     /* fprintf(stderr,"tre"); */
                      strcpy(file_uri,file_uri_prefix);
                      sprintf(tmp,",%d.xml", inductive_type);
-                     fprintf(stderr,"quattro");
+                     /* fprintf(stderr,"quattro"); */
                      strcat(filename,tmp);
                      sprintf(tmp,"#xpointer(1/%d)", inductive_type);
                      strcat(file_uri,tmp);
-                     fprintf(stderr,"cinque");
+                     /* fprintf(stderr,"cinque"); */
                      free(tmp);
                      print_file();
                    }
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 147 "meta_lex_ind.l"
+#line 133 "meta_lex_ind.l"
 { init_symbol_table();
+                     no_open_source = 0;
+                     depth = 0;
+                     spine_depth = 0;
                      constructor++;
                      strcpy(inductive_uri,file_uri_prefix);
                      position = INTYPE;
@@ -843,7 +840,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 154 "meta_lex_ind.l"
+#line 143 "meta_lex_ind.l"
 { tmp = (char *)malloc(sizeof('a')*128);
                      strcpy(filename,filename_prefix);
                      strcpy(file_uri,file_uri_prefix);
@@ -857,109 +854,156 @@ YY_RULE_SETUP
                    }
        YY_BREAK
 case 5:
-#line 167 "meta_lex_ind.l"
+#line 156 "meta_lex_ind.l"
 case 6:
 YY_RULE_SETUP
-#line 167 "meta_lex_ind.l"
+#line 156 "meta_lex_ind.l"
 {
-                    if ((position == INTYPE) ||
-                        (position == INHYP))
+                    if (position == INTYPE)
+                       position = MAINHYP;
+                    else if (position == MAINHYP)
                         { position = INHYP;
                           no_open_source++;};
                    }
        YY_BREAK
 case 7:
-#line 175 "meta_lex_ind.l"
+#line 165 "meta_lex_ind.l"
 case 8:
 YY_RULE_SETUP
-#line 175 "meta_lex_ind.l"
+#line 165 "meta_lex_ind.l"
 {
                     if (position == INHYP)
                      {
                       no_open_source--;
                       if (no_open_source == 0) 
-                       { position = INTYPE;
-                         first_child = HERE; };
-                     };
+                        {
+                         position = MAINHYP;
+                         depth++;
+                         first_child = HERE;
+                        }
+                     }
+                    else if (position == MAINHYP)
+                      {
+                       position = INTYPE;
+                       spine_depth++;
+                       depth = 0;
+                      }
+                    first_child = HERE;
                    }
        YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 185 "meta_lex_ind.l"
+#line 186 "meta_lex_ind.l"
 {
                    }
        YY_BREAK
 case 10:
-#line 189 "meta_lex_ind.l"
-case 11:
 #line 190 "meta_lex_ind.l"
-case 12:
+case 11:
 #line 191 "meta_lex_ind.l"
-case 13:
+case 12:
 #line 192 "meta_lex_ind.l"
-case 14:
+case 13:
 YY_RULE_SETUP
 #line 192 "meta_lex_ind.l"
 { 
                           first_child = AFTER;
                    }
        YY_BREAK
-case 15:
+case 14:
 YY_RULE_SETUP
 #line 196 "meta_lex_ind.l"
+{
+                    if (((position == INTYPE) | (position == MAINHYP)) &&
+                       (first_child == HERE))
+                     {
+                       if (position == INTYPE) /* REL on the spine */
+                         {
+                           position = INCONCL;
+                           search("Rel",first_child,position,spine_depth);
+                         }
+                       else search("Rel",first_child,position,depth);
+                       first_child = AFTER;
+                     }
+                   }
+       YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 210 "meta_lex_ind.l"
+{         
+                    if ((position == INTYPE) | (position == MAINHYP))
+                     {
+                       tmp=(char *)malloc((sizeof('a')*200)); 
+                       strcpy(tmp,yytext);
+                       strsep(&tmp,&sep); 
+                       if (position == INTYPE) /* SORT on the spine */
+                         { 
+                           position = INCONCL;
+                           search(tmp,first_child,position,spine_depth);
+                         }
+                       else search(tmp,first_child,position,depth);
+                       first_child = AFTER;
+                     }
+                   }
+       YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 226 "meta_lex_ind.l"
 {
                      skip = 1;
                      first_child = AFTER;
                    }
        YY_BREAK
-case 16:
+case 17:
 YY_RULE_SETUP
-#line 201 "meta_lex_ind.l"
+#line 231 "meta_lex_ind.l"
 { 
                      if (position == INTYPE) /* CONST on the spine */
                         position = INCONCL;
                      where = CONST;
                    }
        YY_BREAK
-case 17:
+case 18:
 YY_RULE_SETUP
-#line 207 "meta_lex_ind.l"
+#line 237 "meta_lex_ind.l"
 { 
                      if (position == INTYPE) /* MUTIND on the spine */
                         position = INCONCL;
                      where = MUTIND;
                    }
        YY_BREAK
-case 18:
+case 19:
 YY_RULE_SETUP
-#line 213 "meta_lex_ind.l"
+#line 243 "meta_lex_ind.l"
 { 
                      if (position == INTYPE) /* MUTCONSTRUCT on the spine */
                         position = INCONCL;
                      where = MUTCONSTRUCT;
                    }
        YY_BREAK
-case 19:
+case 20:
 YY_RULE_SETUP
-#line 219 "meta_lex_ind.l"
+#line 249 "meta_lex_ind.l"
 {     
                          if (!skip) {
                             uri=(char *)malloc((sizeof('a')*200)); 
                             strcpy(uri,yytext);
                             strsep(&uri,&sep);
                             if (where == CONST)
-                                {
-                                   search(uri,first_child,position); 
-                                   where = NOWHERE;
-                                   first_child = AFTER;
-                                   free(uri); 
-                                 };
+                              {
+                                if (position == INCONCL)
+                                  search(uri,first_child,position,spine_depth);
+                                else search(uri,first_child,position,depth);
+                                where = NOWHERE;
+                                first_child = AFTER;
+                                free(uri); 
+                              };
                          } else skip = 0;
                    } 
        YY_BREAK
-case 20:
+case 21:
 YY_RULE_SETUP
-#line 234 "meta_lex_ind.l"
+#line 266 "meta_lex_ind.l"
 {
                          if ((where == MUTIND) || (where == MUTCONSTRUCT))
                           { strsep(&yytext,&sep);
@@ -973,16 +1017,18 @@ YY_RULE_SETUP
                          if (where == MUTIND) 
                              { 
                                strcat(uri,")");
-                               search(uri,first_child,position); 
+                               if (position == INCONCL)
+                                  search(uri,first_child,position,spine_depth);
+                               else search(uri,first_child,position,depth);
                                free(uri);
                                free(tmp);
                                where = NOWHERE; 
                                first_child = AFTER;};
                    } 
        YY_BREAK
-case 21:
+case 22:
 YY_RULE_SETUP
-#line 254 "meta_lex_ind.l"
+#line 288 "meta_lex_ind.l"
 {
                          if (where == MUTCONSTRUCT)
                           { strsep(&yytext,&sep);
@@ -991,19 +1037,21 @@ YY_RULE_SETUP
                             strcat(uri,"/");
                             strcat(uri,tmp);
                             strcat(uri,")");
-                            search(uri,first_child,position);
+                            if (position == INCONCL)
+                              search(uri,first_child,position,spine_depth);
+                            else search(uri,first_child,position,depth);
                             free(uri);
                             free(tmp);
                             where = NOWHERE; 
                             first_child = AFTER;};
                    } 
        YY_BREAK
-case 22:
+case 23:
 YY_RULE_SETUP
-#line 270 "meta_lex_ind.l"
+#line 307 "meta_lex_ind.l"
 ECHO;
        YY_BREAK
-#line 1007 "lex.yy_ind.c"
+#line 1055 "lex.yy_ind.c"
 case YY_STATE_EOF(INITIAL):
        yyterminate();
 
@@ -1295,7 +1343,7 @@ static yy_state_type yy_get_previous_state()
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 125 )
+                       if ( yy_current_state >= 138 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1330,11 +1378,11 @@ yy_state_type yy_current_state;
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 125 )
+               if ( yy_current_state >= 138 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 124);
+       yy_is_jam = (yy_current_state == 137);
 
        return yy_is_jam ? 0 : yy_current_state;
        }
@@ -1893,7 +1941,7 @@ int main()
        return 0;
        }
 #endif
-#line 270 "meta_lex_ind.l"
+#line 307 "meta_lex_ind.l"
 
 
  /***************************************************************/
@@ -1901,58 +1949,89 @@ int main()
  /***************************************************************/
 
 main(int argc, char *argv[])
-{                  
+{
                    filename = malloc((sizeof('a')*2000));
                    file_uri = malloc((sizeof('a')*2000));
                    inductive_uri = malloc((sizeof('a')*2000));
                    filename_prefix=argv[1];
                    file_uri_prefix=argv[2];
-                   fprintf(stderr,"qua");
+                   /* fprintf(stderr,"qua"); */
                    yyin = fopen("tmp/inductive_type.xml", "r");
                    yylex();
-                   } 
+}
 
 print_file()
-{
-                   FILE *out;
+{                  
+                   FILE *out, *outrel, *outsort;
+
                    if (!(out = fopen(filename,"w"))) 
                      {
                      fprintf(stderr, "error in openinf file %s\n", filename);
                       exit(-1);
+                     } 
+                   if (!(outrel = fopen("forward_rel.rdf","a"))) 
+                     {
+                     fprintf(stderr, "error in openinf file forward_rel.rdf\n");
+                      exit(-1);
                      }
-                   else
+                   if (!(outsort = fopen("forward_sort.rdf","a"))) 
                      {
-                      fprintf(out,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n");
-                      fprintf(out,"<rdf:RDF xml:lang=\"en\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:h=\"http://www.cs.unibo.it/helm/schemas/mattone.rdf#\">\n");
-                      fprintf(out,"\t<h:Object rdf:about=\"");
-                      fprintf(out,"%s",file_uri);
-                      fprintf(out,"\">\n");
-                      print_all(out);
-                      fprintf(out,"\t</h:Object>\n");
-                      fprintf(out,"</rdf:RDF>\n");
-                      fclose(out);
+                     fprintf(stderr, "error in openinf file forward_rel.rdf\n");
+                      exit(-1);
                      }
+                 
+                   // We process the type
+
+                   fprintf(out,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n");
+fprintf(out,"<!DOCTYPE rdf:RDF [
+        <!ENTITY rdfns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
+        <!ENTITY hthns 'http://www.cs.unibo.it/helm/schemas/schema-helmth#'>
+        <!ENTITY hns 'http://www.cs.unibo.it/helm/schemas/schema-helm#'>
+
+   ]>\n");
+                   fprintf(out,"<rdf:RDF xml:lang=\"en\" xmlns:rdf=\"&rdfns;\" xmlns:h=\"&hns;\" xmlns:hth=\"&hthns;\">\n");
+                   fprintf(out,"\t<h:Object rdf:about=\"");
+                   fprintf(out,"%s",file_uri);
+                   fprintf(out,"\">\n");
+                   print_all(file_uri,out,outrel,outsort);
+                   fprintf(out,"\t</h:Object>\n");
+                   fprintf(out,"</rdf:RDF>\n");
+                   fclose(out);
+                   fclose(outrel);
+                   fclose(outsort);
 }
 
-search(uri,first_child,position)
+search(uri,first_child,position,depth)
 char               *uri;
 int                first_child;
 int                position; 
 {                  
-                   if (first_child == HERE)
-                      {
-                       if (position == INHYP)
-                          found = search_bucket(uri,MAINHYP);
-                       else if (position == INCONCL)
-                          found = search_bucket(uri,MAINCONCL);
-                       /* if (found == NOTFOUND)
-                          printf( "pos = %d, uri = %s\n", MAINCONCL, uri); */
-                       }
-                    else found = search_bucket(uri,position);
-                    /* if (found == NOTFOUND)
-                          printf( "pos = %d, uri = %s\n", position, uri); */
-                    }
+                   if (position == MAINHYP)
+                      { 
+                       if (first_child == HERE) 
+                           found = search_bucket(uri,MAINHYP,depth);
+                       else 
+                           found = search_bucket(uri,INHYP,0);
+                      }
+                   else if (position == INCONCL)
+                      { 
+                       if (first_child == HERE) 
+                           found = search_bucket(uri,MAINCONCL,depth);
+                       else
+                           found = search_bucket(uri,INCONCL,0);
+                      }
+                        
+                   else 
+                      found = search_bucket(uri,position,depth);
+                   /* if (found == NOTFOUND)
+                         printf( "pos = %d, uri = %s\n", position, uri); */
+}
+
 
 int yywrap() {
                return 1;
              }
+
+
+
+