X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql%2FmathQL.ml;h=7e82fe5474a1919e49bfa08e25fa00c45dda5b69;hb=4167cea65ca58897d1a3dbb81ff95de5074700cc;hp=85e085e2c04c103c2dd982b6d9ad284645012dc2;hpb=46efa18587accd9b5479e021f05ae6d1f2918037;p=helm.git diff --git a/helm/ocaml/mathql/mathQL.ml b/helm/ocaml/mathql/mathQL.ml index 85e085e2c..7e82fe547 100644 --- a/helm/ocaml/mathql/mathQL.ml +++ b/helm/ocaml/mathql/mathQL.ml @@ -23,119 +23,109 @@ * http://www.cs.unibo.it/helm/. *) -(******************************************************************************) -(* *) -(* PROJECT HELM *) -(* *) -(* Ferruccio Guidi *) -(* Domenico Lordi *) -(* 30/04/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 *) - | MQTheory - | MQTitle - | 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 *) - | MQSRVar of mqrvar (* rvar *) - | MQSSVar of mqsvar (* svar *) - | MQMConclusion (* main conclusion *) - | MQConclusion (* inner conclusion *) - -type mqorder = - | MQAsc - | MQDesc - -type mqbool = - | MQTrue - | MQFalse - | MQAnd of mqbool * mqbool - | MQOr of mqbool * mqbool - | MQNot of mqbool - | MQIs of mqstring * mqstring (* operands *) - | MQSetEqual of mqlist * mqlist (* the two lists denote the *) - (* same set *) - | MQSubset of mqlist * mqlist (* the two lists denote two *) - (* sets, the first one *) - (* subsect of the second one. *) - -and 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 *) - | MQSortedBy of mqlist * mqorder * mqfunc (* *) - | MQLRVar of mqrvar - | MQDiff of mqlist * mqlist (* *) - | MQLetIn of mqrvar * mqlist - | MQLetRef of mqrvar - -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 +(* AUTOR: Ferruccio Guidi + *) + +(* output data structures ***************************************************) + +type path = 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 avar = 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 main = path + +type pattern = bool + +type exp = path * (path option) + +type exp_list = exp list + +type allbut = bool + +type xml = bool + +type source = bool + +type bin = BinFJoin (* full union - with attr handling *) + | BinFMeet (* full intersection - with attr handling *) + | BinFDiff (* full difference - with attr handling *) + +type gen = GenFJoin (* full union - with attr handling *) + | GenFMeet (* full intersection - with attr handling *) + +type test = Xor + | Or + | And + | Sub + | Meet + | Eq + | Le + | Lt + +type query = Empty + | SVar of svar + | AVar of avar + | Subj of msval + | Property of inverse * refine * path * + main * istrue * isfalse list * exp_list * + pattern * msval + | Select of avar * query * msval + | Bin of bin * query * query + | LetSVar of svar * query * query + | LetVVar of vvar * msval * query + | For of gen * avar * query * query + | Add of bool * groups * query + | If of msval * query * query + | Log of xml * source * query + | StatQuery of query + | Keep of allbut * path list * query + +and msval = False + | True + | Not of msval + | Ex of avar list * msval + | Test of test * msval * msval + | Const of string + | Set of msval list + | Proj of path option * query + | Dot of avar * path + | VVar of vvar + | StatVal of msval + | Count of msval + | Align of string * msval + +and groups = Attr of (path * msval) list list + | From of avar + +and con = pattern * path * msval + +and istrue = con list + +and isfalse = con list