1 open Mathql_semantics;;
4 (* prende una lista di uri (contenente alternativamente uri e pos) e costruisce una lista di attributed_uri *)
5 let rec attl uril svar =
9 let suri = List.hd uril in
11 let uril_tl = List.tl uril in
14 {uri = suri; attributes = [(svar, (List.hd
15 uril_tl))]; extra = ""} :: attl (List.tl uril_tl) svar (*
16 NON SONO SICURO DI AVER COSTRUITO BENE LA STRUTTURA DATI!!!!*)
23 (* prende un attributed_uri e una svar e restituisce la lista degli
24 attributed_uri (backward o forward in base al parametro "d") associando
25 la posizione alla var passata *)
27 let muse svar d path =
30 "F" -> "/home/projects/helm/metadata/create4/forward"
31 | _ -> "/home/projects/helm/metadata/create4/backward"
36 | _ -> "backPointer" in
38 let xq ="namespace h=\"http://www.cs.unibo.it/helm/schemas/mattone.rdf#\"
39 namespace rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"
40 for $i in document(" ^ "\"" ^ dir ^ path.uri ^ "\"" ^
41 ")//rdf:RDF//h:Object//h:" ^ dtag ^ "//h:Occurrence
42 return ($i//h:occurrence, $i//h:position)"
46 let uril = Toputils.eval_query_string xq in (* e' una lista di liste di stringhe*)
47 let hd_uril = List.hd uril in(*prendo l'elemento in testa che e' quello
48 che contiene la lista di uri*)
50 attl hd_uril svar (* adesso dalla lista di uri(hd_uril) costruisco una lista di attributed_uri*)
55 (* prende una lista di uri (Mathql_semantics.result), una variabile (a cui
56 associare la posizione), e la direzione (forward o backward) e per ogni uri chiama la muse *)
57 let use_ex ulist svar d =
58 List.concat (List.map (muse svar d) ulist)