-(* Copyright (C) 2000, HELM Team.
- *
- * This file is part of HELM, an Hypertextual, Electronic
- * Library of Mathematics, developed at the Computer Science
- * Department, University of Bologna, Italy.
- *
- * HELM is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * HELM is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HELM; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
- *
- * For details, see the HELM World-Wide-Web page,
- * http://cs.unibo.it/helm/.
- *)
-
-(******************************************************************************)
-(* *)
-(* PROJECT HELM *)
-(* *)
-(* Ferruccio Guidi <fguidi@cs.unibo.it> *)
-(* 30/04/2002 *)
-(* *)
-(* *)
-(******************************************************************************)
-
open Mathql
open Cic
| (Some t, None) -> "#1/" ^ string_of_int t
| (Some t, Some c) -> "#1/" ^ string_of_int t ^ "/" ^ string_of_int c
-let str_tref (p, u, x, i) =
- p ^ ":/" ^ str_up u ^ "." ^ x ^ str_fi i
+let str_tref (p, u, i) =
+ p ^ ":/" ^ str_up u ^ str_fi i
let str_uref (u, i) =
UriManager.string_of_uri u ^ str_fi i
let out_func = function
| MQName -> key "name"
+ | _ -> assert false
let out_str = function
| MQCons s -> con s
| 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 ")"
+ | _ -> assert false
let out_query = function
| MQList l -> out_list l
let rec out_list = function
| [] -> ""
- | u :: l -> res u ^ nl () ^ out_list l
+ | u :: l -> res (str_tref u) ^ nl () ^ out_list l
let out_result qr =
par () ^ "Result:" ^ nl () ^
let i = Str.search_forward (Str.regexp_string ":/") s 0 in
let p = Str.string_before s i in
let q = Str.string_after s (i + 2) in
- try
- let j = String.rindex q '.' in
- (p, Str.string_before q j, Str.string_after q (j + 1))
- with
- Not_found -> (p, q, "")
+ (p, q)
with
- Not_found -> (s, "", "")
+ Not_found -> (s, "")
let encode = function
| Str.Text s -> MQString s
let tref_uref (u, i) =
let s = UriManager.string_of_uri u in
match split s with
- | (p, q, r) ->
+ | (p, q) ->
let rx = Str.regexp "\?\|\*\*\|\*\|/" in
let l = Str.full_split rx q in
- (p, List.map encode l, r, i)
+ (p, List.map encode l, i)
(* CIC term inspecting functions *)
let fi =
match (t, c) with
| (None, _) -> (None, None)
- | (Some t0, c0) -> (Some (t0 + 1), c0)
+ | (Some t0, c0) -> (Some (t0 + 1), c0)
in
ie_insert ((uri, fi), main, v) l
let rec inspect_term main l v = function
| Rel i -> l
- | Meta (i, _) -> l
+ | Meta (i, _) -> l
| Sort s -> l
| Implicit -> l
| Abst u -> l
let mqs = if b then MQMConclusion else MQConclusion in
MQSelect (rvar,
MQUse (MQPattern r, svar),
- MQIs (MQSVar svar, mqs)
- )
+ MQIs (MQSVar svar, mqs)
+ )
let rec build_inter n = function
- | [] -> MQPattern ("cic", [MQAstAst], "con", (None, None))
+ | [] -> MQPattern ("cic", [MQAstAst; MQString ".con"], (None, None))
| [ie] -> build_select ie n
| ie :: il -> MQIntersect (build_select ie n, build_inter (n + 1) il)
let locate s =
let query =
MQList (MQSelect ("ref",
- MQPattern ("cic", [MQAstAst], "con", (None, None)),
+ MQPattern ("cic", [MQAstAst; MQString ".con"], (None, None)),
MQIs (MQFunc (MQName, "ref"),
MQCons s
)
let til = List.map tie_uie uil in
let query = MQList (build_inter 0 til) in
par () ^ out_il uil ^ build_result query
+