let key s = "<font color=\"blue\">" ^ s ^ " </font>"
-let sym s = s ^ " "
+let sub s = "<font color=\"blue\"> " ^ s ^ " </font>"
+
+let sub2 s = "<font color=\"blue\">" ^ s ^ "</font>"
+
+let sym s = s
let sep s = s
-let str s = "<font color=\"red\">'" ^ s ^ "' </font>"
+let str s = "<font color=\"red\">'" ^ s ^ "'</font>"
-let pat s = "<font color=\"red\">\"" ^ s ^ "\" </font>"
+let pat s = "<font color=\"red\">\"" ^ s ^ "\"</font>"
-let res s = "<font color=\"brown\">\"" ^ s ^ "\" </font>"
+let res s = "<font color=\"brown\">\"" ^ s ^ "\"</font>"
let nl () = "<br>"
let out_pat p = out_tref p
+let out_order = function
+ | MQAsc -> sub2 "asc"
+ | MQDesc -> sub2 "desc"
+
let out_func = function
- | MQName -> key "name"
+ | MQName -> key "name"
+ | MQTheory -> key "theory"
+ | MQTitle -> key "title"
+ | MQContributor -> key "contributor"
+ | MQCreator -> key "creator"
+ | MQPublisher -> key "publisher"
+ | MQSubject -> key "subject"
+ | MQDescription -> key "description"
+ | MQDate -> key "date"
+ | MQType -> key "type"
+ | MQFormat -> key "format"
+ | MQIdentifier -> key "identifier"
+ | MQLanguage -> key "language"
+ | MQRelation -> key "relation"
+ | MQSource -> key "source"
+ | MQCoverage -> key "coverage"
+ | MQRights -> key "rights"
+ | MQInstitution -> key "institution"
+ | MQContact -> key "contact"
+ | MQFirstVersion -> key "firstversion"
+ | MQModified -> key "modified"
let out_str = function
| MQCons s -> str s
- | MQRVar s -> out_rvar s
- | MQSVar s -> out_svar s
+ | MQSRVar s -> out_rvar s
+ | MQSSVar s -> out_svar s
| MQFunc (f, r) -> out_func f ^ out_rvar r
| MQMConclusion -> key "mainconclusion"
- | MQConclusion -> key "conclusion"
+ | MQConclusion -> key "inconclusion"
let rec out_bool = function
| MQTrue -> key "true"
| MQFalse -> key "false"
- | MQIs (s, t) -> out_str s ^ key "is" ^ out_str t
+ | MQIs (s, t) -> out_str s ^ sub "is" ^ out_str t
| MQNot b -> key "not" ^ out_bool b
- | MQAnd (b1, b2) -> sep "(" ^ out_bool b1 ^ key "and" ^ out_bool b2 ^ sep ")"
- | MQOr (b1, b2) -> sep "(" ^ out_bool b1 ^ key "or" ^ out_bool b2 ^ sep ")"
-
-let rec out_list = function
+ | MQAnd (b1, b2) -> sep "(" ^ out_bool b1 ^ sub "and" ^ out_bool b2 ^ sep ")"
+ | MQOr (b1, b2) -> sep "(" ^ out_bool b1 ^ sub "or" ^ out_bool b2 ^ sep ")"
+ | MQSubset (l1, l2) -> sep "(" ^ out_list l1 ^ sub "subset" ^ out_list l2 ^ sep ")"
+ | MQSetEqual (l1, l2) -> sep "(" ^ out_list l1 ^ sub "setequal" ^ out_list l2 ^ sep ")"
+
+and out_list = function
| MQSelect (r, l, b) ->
- key "select" ^ out_rvar r ^ key "in" ^ out_list l ^ key "where" ^ out_bool b
- | MQUse (l, v) -> key "use" ^ out_list l ^ key "position" ^ out_svar v
- | MQUsedBy (l, v) -> key "usedby" ^ out_list l ^ key "position" ^ out_svar v
+ key "select" ^ out_rvar r ^ sub "in" ^ out_list l ^ sub "where" ^ out_bool b
+ | MQUse (l, v) -> key "use" ^ out_list l ^ sub "position" ^ out_svar v
+ | MQUsedBy (l, v) -> key "usedby" ^ out_list l ^ sub "position" ^ out_svar v
| MQPattern p -> key "pattern" ^ out_pat p
- | MQUnion (l1, l2) -> sep "(" ^ out_list l1 ^ key "union" ^ out_list l2 ^ sep ")"
- | MQIntersect (l1, l2) -> sep "(" ^ out_list l1 ^ key "intersect" ^ out_list l2 ^ sep ")"
+ | MQUnion (l1, l2) -> sep "(" ^ out_list l1 ^ sub "union" ^ out_list l2 ^ sep ")"
+ | MQIntersect (l1, l2) -> sep "(" ^ out_list l1 ^ sub "intersect" ^ out_list l2 ^ sep ")"
+ | MQDiff (l1, l2) -> sep "(" ^ out_list l1 ^ sub "diff" ^ out_list l2 ^ sep ")"
+ | MQLRVar s -> out_rvar s
+ | MQSortedBy (l, o, f) -> sep "(" ^ out_list l ^ sub "sortedby" ^ out_func f ^ out_order o ^ sep ")"
let out_query = function
| MQList l -> out_list l