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