]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql/mathQL.ml
Initial revision
[helm.git] / helm / ocaml / mathql / mathQL.ml
1 (* Copyright (C) 2000, HELM Team.
2  * 
3  * This file is part of HELM, an Hypertextual, Electronic
4  * Library of Mathematics, developed at the Computer Science
5  * Department, University of Bologna, Italy.
6  * 
7  * HELM is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * 
12  * HELM is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with HELM; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20  * MA  02111-1307, USA.
21  * 
22  * For details, see the HELM World-Wide-Web page,
23  * http://www.cs.unibo.it/helm/.
24  *)
25
26 (******************************************************************************)
27 (*                                                                            *)
28 (*                               PROJECT HELM                                 *)
29 (*                                                                            *)
30 (*                     Ferruccio Guidi <fguidi@cs.unibo.it>                   *)
31 (*                     Irene Schena  <schena@cs.unibo.it>                     *)
32 (*                                 10/09/2002                                 *)
33 (*                                                                            *)
34 (*                                                                            *)
35 (******************************************************************************)
36
37
38 (* output data structures ***************************************************)
39
40 type path            = string * (string list) (* the name of an attribute *)
41
42 type value           = string list            (* the value of an attribute *)
43
44 type attribute       = path * value           (* an attribute *)
45
46 type attribute_group = attribute list         (* a group of attributes *)
47
48 type attribute_set   = attribute_group list   (* the attributes of an URI *)
49
50 type resource        = string * attribute_set (* an attributed URI *)
51
52 type resource_set    = resource list          (* the query result *)
53
54 type result = resource_set
55
56
57 (* input data structures ****************************************************)
58
59 type svar = string (* the name of a variable for a resource set *)
60
61 type rvar = string (* the name of a variable for a resource *)
62
63 type vvar = string (* the name of a variable for an attribute value *)
64
65 type inverse = bool 
66
67 type refine = RefineExact
68             | RefineSub
69             | RefineSuper
70
71 type assign = path * path 
72
73 type set_exp = SVar of svar
74              | RVar of rvar
75              | Ref of val_exp
76              | Pattern of val_exp
77              | Relation of inverse * refine * path * set_exp * assign list
78              | Select of rvar * set_exp * boole_exp
79              | Union of set_exp * set_exp
80              | Intersect of set_exp * set_exp
81              | Diff of set_exp * set_exp
82              | LetSVar of svar * set_exp * set_exp
83              | LetVVar of vvar * val_exp * set_exp
84              
85 and boole_exp = False
86               | True
87               | Not of boole_exp
88               | Ex of rvar list * boole_exp   
89               | And of boole_exp * boole_exp
90               | Or of boole_exp * boole_exp
91               | Sub of val_exp * val_exp
92               | Meet of val_exp * val_exp
93               | Eq of val_exp * val_exp
94                
95 and val_exp = Const of string list 
96             | RefOf of set_exp 
97             | Record of rvar * path
98             | VVar of vvar
99             | Property of inverse * refine * path * val_exp
100             | Fun of string * val_exp
101
102 type query = set_exp