]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/mathql/mathQL.ml
new Gen constructor for interfacing a query generator
[helm.git] / helm / ocaml / mathql / mathQL.ml
index d375d92afeac7ecf3971081247b8ad2dd5316e71..884976fe575e514d8c4f4cd93fd83e77e7ba39c4 100644 (file)
  * http://www.cs.unibo.it/helm/.
  *)
 
-(******************************************************************************)
-(*                                                                            *)
-(*                               PROJECT HELM                                 *)
-(*                                                                            *)
-(*                     Ferruccio Guidi <fguidi@cs.unibo.it>                   *)
-(*                     Irene Schena  <schena@cs.unibo.it>                     *)
-(*                                 10/09/2002                                 *)
-(*                                                                            *)
-(*                                                                            *)
-(******************************************************************************)
-
-
-(* input data structures ****************************************************)
-
-type svar = string (* the name of a variable for a resource set *)
-
-type rvar = string (* the name of a variable for a resource *)
-
-type vvar = string (* the name of a variable for an attribute value *)
-
-type refine_op = ExactOp
-               | SubOp
-              | SuperOp
-
-type path = string list
-
-type vvar_list = vvar list
-
-type set_exp = SVar of svar
-            | RVar of rvar
-             | Ref of val_exp
-             | Pattern of val_exp
-            | Relation of refine_op * path * set_exp * vvar_list
-             | Select of rvar * set_exp * boole_exp
-            | Union of set_exp * set_exp
-            | Intersect of set_exp * set_exp
-            | Diff of set_exp * set_exp
-            | LetSVar of svar * set_exp * set_exp
-            | LetVVar of vvar * val_exp * set_exp
-            
-and boole_exp = False
-              | True
-             | Not of boole_exp
-             | Ex of rvar list * boole_exp   
-             | And of boole_exp * boole_exp
-             | Or of boole_exp * boole_exp
-             | Sub of val_exp * val_exp
-             | Meet of val_exp * val_exp
-             | Eq of val_exp * val_exp
-              
-and val_exp = Const of string list 
-            | RefOf of set_exp 
-           | Record of rvar * vvar
-           | VVar of vvar
-           | Fun of string * val_exp
-           | Attribute of refine_op * path * val_exp
-
-type query = set_exp
-
+(*  AUTOR: Ferruccio Guidi <fguidi@cs.unibo.it>
+ *)
 
 (* output data structures ***************************************************)
 
+type path            = string list            (* the name of an attribute *)
+
 type value           = string list            (* the value of an attribute *)
 
-type attribute       = string * value         (* an attribute *)
+type attribute       = path * value           (* an attribute *)
 
 type attribute_group = attribute list         (* a group of attributes *)
 
@@ -98,3 +43,57 @@ type resource        = string * attribute_set (* an attributed URI *)
 type resource_set    = resource list          (* the query result *)
 
 type result = resource_set
+
+
+(* input data structures ****************************************************)
+
+type svar = string (* the name of a variable for a resource set *)
+
+type avar = string (* the name of a variable for a resource *)
+
+type inverse = bool 
+
+type refine = RefineExact
+            | RefineSub
+           | RefineSuper
+
+type main = path
+
+type pattern = bool
+
+type exp = path * (path option) 
+
+type exp_list = exp list
+
+type allbut = bool
+
+type xml = bool
+
+type source = bool
+
+type gen = GenFJoin (* full union - with attr handling *)
+         | GenFMeet (* full intersection - with attr handling *)
+
+type query = Const of result
+          | SVar of svar
+          | AVar of avar
+          | Dot of avar * path
+          | Ex of avar list * query
+          | Select of avar * query * query
+          | Let of svar * query * query
+          | Fun of path * path list * query list
+          | Gen of path * query list
+          | Add of bool * groups * query
+          | For of gen * avar * query * query
+          | Property of inverse * refine * path * 
+                        main * istrue * isfalse list * exp_list *
+                        pattern * query
+
+and groups = Attr of (path * query) list list
+           | From of avar
+
+and con = pattern * path * query
+
+and istrue = con list
+
+and isfalse = con list