1 (* Copyright (C) 2000, HELM Team.
3 * This file is part of HELM, an Hypertextual, Electronic
4 * Library of Mathematics, developed at the Computer Science
5 * Department, University of Bologna, Italy.
7 * HELM is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * HELM is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with HELM; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 * For details, see the HELM World-Wide-Web page,
23 * http://cs.unibo.it/helm/.
36 if (p = "refObj") then "F"
41 * implementazione delle funzioni dublin core
43 let rec property_ex rop path inv = function
45 | s::tl -> let mprop = fst path in
47 let l_sub_p = snd path in
49 let prop = (if (l_sub_p <> []) then List.hd l_sub_p
54 "refObj" (* in base al valore di prop restituisco i valori del relativo campo della tabella relativa all'uri rappresentata da s *)
57 let mpid = getpid mprop in
61 Str.global_substitute (Str.regexp "'")
62 (function _ -> "\\'") s in
63 let tv = pgresult_to_string (c#exec ("select distinct id from registry where uri='" ^ quoted_s ^ "' order by id")) in
64 let q = "select distinct t" ^ tv ^ "." ^ prop ^ " from t" ^ tv ^ " where prop_id= '" ^ mpid ^ "' order by t" ^ tv ^ "." ^ prop in
66 pgresult_to_string_list (c#exec q)
68 append (res,(property_ex rop path inv tl))
70 (*Rimane da capire cosa restituire nelle inverse!!!!*)
75 if inv then (* restituisco gli uri che il valore della prop richiesta uguale a s *)
78 let q = ("select distinct h" ^ mprop ^ ".uri from h" ^ mprop ^ " where h" ^ mprop ^ "." ^ prop ^ "= '" ^ s ^ "' order by h" ^ mprop ^ ".uri") in
80 pgresult_to_string_list (c#exec q)
82 append (res,(property_ex rop path inv tl))
85 let res = (* restituisco il valore della prop relativo all'uri rappresentato da s*)
88 Str.global_substitute (Str.regexp "'")
89 (function _ -> "\\'") s in
90 let q = ("select distinct h" ^ mprop ^ "." ^ prop ^" from h" ^ mprop ^ " where h" ^ mprop ^ ".uri = '" ^ quoted_s ^ "' order by h" ^ mprop ^ "." ^ prop) in
91 pgresult_to_string_list (c#exec q)
93 append (res,(property_ex rop path inv tl))
96 | _ -> (* metadati DC !!!! Controllare se i nomi delle tabelle cominciano con h !!!!*)
101 let q = ("select " ^ mprop ^ ".uri from " ^ mprop ^ " where " ^ mprop ^ ".value = '" ^ s ^ "'") in
103 pgresult_to_string_list (c#exec q)
105 append (res,(property_ex rop path inv tl))
110 Str.global_substitute (Str.regexp "'")
111 (function _ -> "\\'") s in
112 let q = ("select " ^ mprop ^ ".value from " ^ mprop ^ " where " ^ mprop ^ ".uri = '" ^ quoted_s ^ "'") in
113 pgresult_to_string_list (c#exec q)
115 append (res,(property_ex rop path inv tl))