let get_prop_id propl =
- let prop = List.hd propl in
+ let prop = fst propl in
if prop="refObj" then "F"
else if prop="backPointer" then "B"
else assert false
;;
-let relation_ex rop path rset attl =
- if path = [] then []
- else
+let relation_ex inv rop path rset attl =
let usek = get_prop_id path in
let vvar = if attl = [] then "position"
else List.hd attl
let rset_list = (* lista di singoletti:resource_set di un elemento *)
(List.fold_left (fun acc (uri,l) ->
let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ uri ^ "'")) in
- let qq = "select uri, context from t" ^ tv ^ " where prop_id='" ^ usek ^ "' order by uri asc" in
+ let qq = "select uri, position from t" ^ tv ^ " where prop_id='" ^ usek ^ "' order by uri asc" in
let res = c#exec qq in
(List.map
(function
- [uri;context] -> [(uri,[[(vvar,[context])]])]
+ [uri;context] -> [(uri,[[((vvar, []),[context])]])]
| _ -> assert false )
res#get_list) @ acc
)
let rec rsetl uril vvar =
match uril with
| uri::tl -> let scuri = (*tofname*) uri in
- [(scuri, [[(vvar, [(List.hd tl)])]])]::(rsetl (List.tl tl) vvar)
+ [(scuri, [[((vvar, []), [(List.hd tl)])]])]::(rsetl (List.tl tl) vvar)
| [] -> []
(* prende una resource e una vvar e restituisce la lista delle resource in relazione (refObj o backPointer in base al parametro "path") con tale resource e associa alla proprieta' il nome della vvar contenuto in "attl" *)
let muse path attl r =
- if path = [] then []
- else
let vvar = if attl = [] then "position"
else List.hd attl
in
let uri = fst r in
let furi = tofname uri in
- let dtag = List.hd path in
+ let dtag = fst path in
let dir =
match dtag with
"refObj" -> "/projects/helm/metadata/create4/forward"
(* prende un resource_set, una vvar (primo el. di attl) a cui associare la posizione, e la relazione (refObj o backPointer) e per ogni resource chiama la muse
NOTA: "rop" per ora non viene usato perche' vale sempre "ExactOp" *)
-let relation_galax_ex rop path rset attl =
+let relation_galax_ex inv rop path rset attl =
List.stable_sort (fun (uri1,l1) (uri2,l2) -> compare uri1 uri2) (List.concat (List.map (muse path attl) rset))