]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql/mathQL.ml
structurated attribute names added
[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 set_exp = SVar of svar
72              | RVar of rvar
73              | Ref of val_exp
74              | Pattern of val_exp
75              | Relation of inverse * refine * path * set_exp * string list
76              | Select of rvar * set_exp * boole_exp
77              | Union of set_exp * set_exp
78              | Intersect of set_exp * set_exp
79              | Diff of set_exp * set_exp
80              | LetSVar of svar * set_exp * set_exp
81              | LetVVar of vvar * val_exp * set_exp
82              
83 and boole_exp = False
84               | True
85               | Not of boole_exp
86               | Ex of rvar list * boole_exp   
87               | And of boole_exp * boole_exp
88               | Or of boole_exp * boole_exp
89               | Sub of val_exp * val_exp
90               | Meet of val_exp * val_exp
91               | Eq of val_exp * val_exp
92                
93 and val_exp = Const of string list 
94             | RefOf of set_exp 
95             | Record of rvar * path
96             | VVar of vvar
97             | Attribute of inverse * refine * path * val_exp
98             | Fun of string * val_exp
99
100 type query = set_exp