]> matita.cs.unibo.it Git - helm.git/blob - helm/ocaml/mathql/mathQL.ml
ocaml 3.09 transition
[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 (*  AUTOR: Ferruccio Guidi <fguidi@cs.unibo.it>
27  *)
28
29 (* output data structures ***************************************************)
30
31 type path            = string list            (* the name of an attribute *)
32
33 type value           = string list            (* the value of an attribute *)
34
35 type attribute       = path * value           (* an attribute *)
36
37 type attribute_group = attribute list         (* a group of attributes *)
38
39 type attribute_set   = attribute_group list   (* the attributes of an URI *)
40
41 type resource        = string * attribute_set (* an attributed URI *)
42
43 type resource_set    = resource list          (* the query result *)
44
45 type result = resource_set
46
47
48 (* input data structures ****************************************************)
49
50 type svar = string (* the name of a variable for a resource set *)
51
52 type avar = string (* the name of a variable for a resource *)
53
54 type vvar = string (* the name of a variable for an attribute value *)
55
56 type inverse = bool 
57
58 type refine = RefineExact
59             | RefineSub
60             | RefineSuper
61
62 type main = path
63
64 type pattern = bool
65
66 type exp = path * (path option) 
67
68 type exp_list = exp list
69
70 type allbut = bool
71
72 type xml = bool
73
74 type source = bool
75
76 type bin = BinFJoin (* full union - with attr handling *)
77          | BinFMeet (* full intersection - with attr handling *)
78          | BinFDiff (* full difference - with attr handling *)
79
80 type gen = GenFJoin (* full union - with attr handling *)
81          | GenFMeet (* full intersection - with attr handling *)
82
83 type test = Xor
84           | Or
85           | And
86           | Sub
87           | Meet
88           | Eq
89           | Le
90           | Lt
91
92 type query = Empty
93            | SVar of svar
94            | AVar of avar
95            | Subj of msval
96            | Property of inverse * refine * path * 
97                          main * istrue * isfalse list * exp_list *
98                          pattern * msval
99            | Select of avar * query * msval
100            | Bin of bin * query * query
101            | LetSVar of svar * query * query
102            | LetVVar of vvar * msval * query
103            | For of gen * avar * query * query 
104            | Add of bool * groups * query
105            | If of msval * query * query
106            | Log of xml * source * query
107            | StatQuery of query
108            | Keep of allbut * path list * query
109            
110 and msval = False
111           | True
112           | Not of msval
113           | Ex of avar list * msval
114           | Test of test * msval * msval
115           | Const of string
116           | Set of msval list
117           | Proj of path option * query 
118           | Dot of avar * path
119           | VVar of vvar
120           | StatVal of msval
121           | Count of msval
122           | Align of string * msval
123
124 and groups = Attr of (path * msval) list list
125            | From of avar
126
127 and con = pattern * path * msval
128
129 and istrue = con list
130
131 and isfalse = con list