of the current owner).
module Make (C: Callbacks) =
struct
- let choices_of_id dbd id =
- let uris = MetadataQuery.locate ~dbd id in
+ let choices_of_id ?owner dbd id =
+ let uris = MetadataQuery.locate ?owner ~dbd id in
let uris =
match uris with
| [] ->
uris
let disambiguate_term ~(dbd:Mysql.dbd) context metasenv term
- ?(initial_ugraph = CicUniv.empty_ugraph) ~aliases:current_env
+ ?(initial_ugraph = CicUniv.empty_ugraph) ?owner ~aliases:current_env
=
debug_print "NEW DISAMBIGUATE INPUT";
let disambiguate_context = (* cic context -> disambiguate context *)
(try
Hashtbl.find id_choices id
with Not_found ->
- let choices = choices_of_id dbd id in
+ let choices = choices_of_id ?owner dbd id in
Hashtbl.add id_choices id choices;
choices)
| Symbol (symb, _) -> DisambiguateChoices.lookup_symbol_choices symb
Cic.metasenv ->
CicAst.term ->
?initial_ugraph:CicUniv.universe_graph ->
+ ?owner:string ->
aliases:environment -> (* previous interpretation status *)
(environment * (* new interpretation status *)
Cic.metasenv * (* new metasenv *)
let suffix = String.sub s (len-4) 4 in
not (suffix = ".var")
-let locate ~(dbd:Mysql.dbd) ?(vars = false) pat =
+let locate ~(dbd:Mysql.dbd) ?(vars = false) ?owner pat =
let sql_pat = sqlpat_of_shellglob pat in
let query =
- sprintf "SELECT source FROM %s WHERE value LIKE \"%s\""
- MetadataTypes.name_tbl sql_pat
+ match owner with
+ | None ->
+ sprintf "SELECT source FROM %s WHERE value LIKE \"%s\""
+ MetadataTypes.name_tbl sql_pat
+ | Some owner ->
+ sprintf "SELECT %s.source FROM %s,%s WHERE
+ (%s.source LIKE CONCAT(%s.source,\"#%%\") OR
+ %s.source = %s.source) AND
+ value LIKE \"%s\" AND owner = \"%s\""
+ MetadataTypes.name_tbl
+ MetadataTypes.name_tbl MetadataTypes.owners_tbl
+ MetadataTypes.name_tbl MetadataTypes.owners_tbl
+ MetadataTypes.name_tbl MetadataTypes.owners_tbl
+ sql_pat owner
in
let result = Mysql.exec dbd query in
List.filter nonvar
* is interpreted as 0 or more characters and "?" as exactly one character *)
val locate:
dbd:Mysql.dbd ->
- ?vars:bool -> string -> string list
+ ?vars:bool -> ?owner:string -> string -> string list
val hint:
dbd:Mysql.dbd ->