X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Focaml%2Fmathql%2FmathQL.ml;h=8ba562ab210648bea3c44a2c8cce9b9fd883093c;hb=a32bcc14672dae13e8bb725e54c819958dfdb677;hp=d18ebbc9243afa5d1fc3b87e8718cc68aaf83116;hpb=dec50888f98015c937283acc14e2ffceccc04a11;p=helm.git diff --git a/helm/ocaml/mathql/mathQL.ml b/helm/ocaml/mathql/mathQL.ml index d18ebbc92..8ba562ab2 100644 --- a/helm/ocaml/mathql/mathQL.ml +++ b/helm/ocaml/mathql/mathQL.ml @@ -23,114 +23,78 @@ * 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 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 +(* 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 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 gen = GenFJoin (* full union - with attr handling *) + | GenFMeet (* full intersection - with attr handling *) + +type query = Const of result + | SVar of svar + | AVar of avar + | Dot of avar * path + | Ex of avar list * query + | Select of avar * query * query + | Let of svar option * query * query + | Fun of path * path list * query list + | Gen of path * query list + | Add of bool * groups * query + | For of gen * avar * query * query + | While of gen * query * query + | Property of inverse * refine * path * + main * istrue * isfalse list * exp_list * + pattern * query + +and groups = Attr of (path * query) list list + | From of avar + +and con = pattern * path * query + +and istrue = con list + +and isfalse = con list