* MA 02111-1307, USA.
*
* For details, see the HELM World-Wide-Web page,
- * http://cs.unibo.it/helm/.
+ * http://www.cs.unibo.it/helm/.
*)
(******************************************************************************)
(* PROJECT HELM *)
(* *)
(* Ferruccio Guidi <fguidi@cs.unibo.it> *)
-(* Domenico Lordi <lordi@cs.unibo.it> *)
-(* 30/04/2002 *)
+(* Irene Schena <schena@cs.unibo.it> *)
+(* 10/09/2002 *)
(* *)
(* *)
(******************************************************************************)
-exception MQInvalidURI of string
-exception MQConnectionFailed of string
-exception MQInvalidConnection of string
-
-(* Input types **************************************************************)
-(* main type is mquery *)
-
-type mqrvar = string (* name *)
-
-type mqsvar = string (* name *)
-
-type mqpt = string option (* PROTOCOL TOKENS *)
- (* Some = constant string *)
- (* None = single star: '*' *)
-
-type mqbt = (* BODY TOKENS *)
- | MQBC of string (* a constant string *)
- | MQBD (* a slash: '/' *)
- | MQBQ (* a question mark: '?' *)
- | MQBS (* a single star: '*' *)
- | MQBSS (* a double star: '**' *)
-
-type mqft = (* FRAGMENT TOKENS *)
- | MQFC of int (* a constant integer *)
- | MQFS (* a single star: '*' *)
- | MQFSS (* a double star: '**' *)
-
-type mqtref = mqpt * (mqbt list) * (mqft list) (* tokenized reference *)
-
-type mqpattern = mqtref (* constant pattern *)
-
-type mqfunc =
- | MQName (* NAME *)
-
-type mqstring =
- | MQCons of string (* constant *)
- | MQFunc of mqfunc * mqrvar (* function, rvar *)
- | MQRVar of mqrvar (* rvar *)
- | MQSVar of mqsvar (* svar *)
- | MQMConclusion (* main conclusion *)
- | MQConclusion (* inner conclusion *)
-
-type mqbool =
- | MQTrue
- | MQFalse
- | MQAnd of mqbool * mqbool
- | MQOr of mqbool * mqbool
- | MQNot of mqbool
- | MQIs of mqstring * mqstring (* operands *)
-
-type mqlist =
- | MQSelect of mqrvar * mqlist * mqbool (* rvar, list, boolean *)
- | MQUse of mqlist * mqsvar (* list, Position attribute *)
- | MQUsedBy of mqlist * mqsvar (* list, Position attribute *)
- | MQPattern of mqpattern (* pattern *)
- | MQUnion of mqlist * mqlist (* operands *)
- | MQIntersect of mqlist * mqlist (* operands *)
-
-type mquery =
- | MQList of mqlist
-
-(* Output types *************************************************************)
-(* main type is mqresult *)
-
-(* TODO: usare le uri in questo formato *)
-type mquref = UriManager.uri * (int list) (* uri, fragment identifier *)
-
-type mqrefs = string list (* list of references (helper) *)
-
-type mqresult =
- | MQRefs of mqrefs
+
+(* output data structures ***************************************************)
+
+type path = string * (string list) (* the name of an attribute *)
+
+type value = string list (* the value of an attribute *)
+
+type attribute = path * value (* an attribute *)
+
+type attribute_group = attribute list (* a group of attributes *)
+
+type attribute_set = attribute_group list (* the attributes of an URI *)
+
+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 rvar = string (* the name of a variable for a resource *)
+
+type vvar = string (* the name of a variable for an attribute value *)
+
+type inverse = bool
+
+type refine = RefineExact
+ | RefineSub
+ | RefineSuper
+
+type assign = path * path
+
+type set_exp = SVar of svar
+ | RVar of rvar
+ | Ref of val_exp
+ | Pattern of val_exp
+ | Relation of inverse * refine * path * set_exp * assign 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 * path
+ | VVar of vvar
+ | Property of inverse * refine * path * val_exp
+ | Fun of string * val_exp
+
+type query = set_exp