From 8ef7b475c3329c533aeec60aa2842e63de8abc10 Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Tue, 10 Sep 2002 14:15:48 +0000 Subject: [PATCH] new mathql semantics --- helm/ocaml/mathql/.depend | 10 --- helm/ocaml/mathql/Makefile | 12 +-- helm/ocaml/mathql/mathQL.ml | 160 +++++++++++++----------------------- 3 files changed, 62 insertions(+), 120 deletions(-) diff --git a/helm/ocaml/mathql/.depend b/helm/ocaml/mathql/.depend index c898ba8b0..e69de29bb 100644 --- a/helm/ocaml/mathql/.depend +++ b/helm/ocaml/mathql/.depend @@ -1,10 +0,0 @@ -mQueryTParser.cmi: mathQL.cmo -mQueryUtil.cmi: mathQL.cmo -mQueryTParser.cmo: mathQL.cmo mQueryTParser.cmi -mQueryTParser.cmx: mathQL.cmx mQueryTParser.cmi -mQueryTLexer.cmo: mQueryTParser.cmi -mQueryTLexer.cmx: mQueryTParser.cmx -mQueryUtil.cmo: mQueryHTML.cmo mQueryTLexer.cmo mQueryTParser.cmi mathQL.cmo \ - mQueryUtil.cmi -mQueryUtil.cmx: mQueryHTML.cmx mQueryTLexer.cmx mQueryTParser.cmx mathQL.cmx \ - mQueryUtil.cmi diff --git a/helm/ocaml/mathql/Makefile b/helm/ocaml/mathql/Makefile index 8cd40ee82..d1c97a1a1 100644 --- a/helm/ocaml/mathql/Makefile +++ b/helm/ocaml/mathql/Makefile @@ -2,16 +2,12 @@ PACKAGE = mathql REQUIRES = helm-urimanager PREDICATES = -INTERFACE_FILES = mQueryTParser.mli mQueryUtil.mli +INTERFACE_FILES = -IMPLEMENTATION_FILES = mathQL.ml mQueryTParser.ml mQueryTLexer.ml \ - mQueryHTML.ml mQueryUtil.ml +IMPLEMENTATION_FILES = mathQL.ml -EXTRA_OBJECTS_TO_INSTALL = mathQL.ml mathQL.cmi mQueryTLexer.cmi \ - mQueryTLexer.mll mQueryTParser.mly \ - mQueryHTML.ml mQueryHTML.cmi +EXTRA_OBJECTS_TO_INSTALL = mathQL.ml mathQL.cmi -EXTRA_OBJECTS_TO_CLEAN = mQueryTParser.ml mQueryTParser.mli \ - mQueryTLexer.ml +EXTRA_OBJECTS_TO_CLEAN = include ../Makefile.common diff --git a/helm/ocaml/mathql/mathQL.ml b/helm/ocaml/mathql/mathQL.ml index d18ebbc92..ee10c6acf 100644 --- a/helm/ocaml/mathql/mathQL.ml +++ b/helm/ocaml/mathql/mathQL.ml @@ -28,109 +28,65 @@ (* PROJECT HELM *) (* *) (* Ferruccio Guidi *) -(* Domenico Lordi *) -(* 30/04/2002 *) +(* Irene Schena *) +(* 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 mqlvar = 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 mquref = UriManager.uri * (int list) (* uri, fragment identifier *) - -type mqtref = mqpt * (mqbt list) * (mqft list) (* tokenized pattern reference *) - -type mqfunc = - | MQName (* Name *) - | MQTheory (* theory *) - | MQTitle (* DC properties *) - | MQContributor - | MQCreator - | MQPublisher - | MQSubject - | MQDescription - | MQDate - | MQType - | MQFormat - | MQIdentifier - | MQLanguage - | MQRelation - | MQSource - | MQCoverage - | MQRights - | MQInstitution - | MQContact - | MQFirstVersion - | MQModified - -type mqstring = - | MQCons of string (* constant *) - | MQFunc of mqfunc * mqrvar (* function, rvar *) - | MQStringRVar of mqrvar (* rvar *) - | MQStringSVar of mqsvar (* svar *) - | MQMConclusion (* main conclusion *) - | MQConclusion (* inner conclusion *) - -type mqorder = - | MQAsc (* ascending order *) - | MQDesc (* descending order *) - -type mqbool = - | MQTrue (* true *) - | MQFalse (* false *) - | MQAnd of mqbool * mqbool (* conjunction *) - | MQOr of mqbool * mqbool (* disjunction *) - | MQNot of mqbool (* negation *) - | MQIs of mqstring * mqstring (* case-sensitive comparison *) - | MQSetEqual of mqlist * mqlist (* the two lists denote the same set *) - | MQSubset of mqlist * mqlist (* the two lists denote two sets, the 1st subset of the 2nd *) - -and mqlist = - | MQReference of string list (* reference list *) - | MQPattern of mqtref (* pattern *) - | MQListLVar of mqlvar (* lvar *) - | MQListRVar of mqrvar (* rvar *) - | MQSelect of mqrvar * mqlist * mqbool (* rvar, list, boolean *) - | MQUse of mqlist * mqsvar (* list, Position attribute *) - | MQUsedBy of mqlist * mqsvar (* list, Position attribute *) - | MQUnion of mqlist * mqlist (* operands *) - | MQIntersect of mqlist * mqlist (* operands *) - | MQSortedBy of mqlist * mqorder * mqfunc (* ordering *) - | MQDiff of mqlist * mqlist (* set difference *) - | MQLetIn of mqlvar * mqlist * mqlist (* explicit lvar assignment *) - -type mquery = - | MQList of mqlist - -(* Output types *************************************************************) -(* main type is mqresult *) - -type mqresult = - | MQRefs of string list + +(* 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 refine_op = Exact + | Sub + | Super + +type attr_list = string list + +type set_exp = SVar of svar + | RVar of rvar + | Ref of val_exp + | Pattern of val_exp + | Relation of refine_op * string * set_exp * attr_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 + | Let of svar * set_exp * set_exp + +and boole_exp = False + | True + | Not of boole_exp + | Ex of 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 * vvar + | Fun of string * val_exp + | Attribute of refine_op * string * val_exp + + +(* output data structures ***************************************************) + +type value = string list (* the value of an attribute *) + +type attribute = string * 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 *) -- 2.39.2