From d6dd3cb8ee6718a0992a87e15a4b98b438d0f30d Mon Sep 17 00:00:00 2001 From: natile Date: Wed, 27 Nov 2002 11:09:26 +0000 Subject: [PATCH] Relation patched, property added. --- helm/ocaml/mathql_interpreter/.depend | 12 +- helm/ocaml/mathql_interpreter/Makefile | 4 +- helm/ocaml/mathql_interpreter/mqint.ml | 11 +- helm/ocaml/mathql_interpreter/pattern.ml | 6 +- helm/ocaml/mathql_interpreter/property.ml | 104 +++++ helm/ocaml/mathql_interpreter/property.mli | 27 ++ helm/ocaml/mathql_interpreter/relation.ml | 432 +++++++++++++++++++-- helm/ocaml/mathql_interpreter/relation.mli | 4 +- 8 files changed, 549 insertions(+), 51 deletions(-) create mode 100644 helm/ocaml/mathql_interpreter/property.ml create mode 100644 helm/ocaml/mathql_interpreter/property.mli diff --git a/helm/ocaml/mathql_interpreter/.depend b/helm/ocaml/mathql_interpreter/.depend index f240778d9..ecb037346 100644 --- a/helm/ocaml/mathql_interpreter/.depend +++ b/helm/ocaml/mathql_interpreter/.depend @@ -16,11 +16,11 @@ intersect.cmo: intersect.cmi intersect.cmx: intersect.cmi func.cmo: dbconn.cmi intersect.cmi utility.cmi func.cmi func.cmx: dbconn.cmx intersect.cmx utility.cmx func.cmi -attribute.cmo: dbconn.cmi intersect.cmi utility.cmi attribute.cmi -attribute.cmx: dbconn.cmx intersect.cmx utility.cmx attribute.cmi +property.cmo: dbconn.cmi intersect.cmi utility.cmi property.cmi +property.cmx: dbconn.cmx intersect.cmx utility.cmx property.cmi pattern.cmo: dbconn.cmi utility.cmi pattern.cmi pattern.cmx: dbconn.cmx utility.cmx pattern.cmi -mqint.cmo: attribute.cmi context.cmo dbconn.cmi diff.cmi func.cmi \ - intersect.cmi meet.cmi relation.cmi sub.cmi union.cmi mqint.cmi -mqint.cmx: attribute.cmx context.cmx dbconn.cmx diff.cmx func.cmx \ - intersect.cmx meet.cmx relation.cmx sub.cmx union.cmx mqint.cmi +mqint.cmo: context.cmo dbconn.cmi diff.cmi func.cmi intersect.cmi meet.cmi \ + pattern.cmi property.cmi relation.cmi sub.cmi union.cmi mqint.cmi +mqint.cmx: context.cmx dbconn.cmx diff.cmx func.cmx intersect.cmx meet.cmx \ + pattern.cmx property.cmx relation.cmx sub.cmx union.cmx mqint.cmi diff --git a/helm/ocaml/mathql_interpreter/Makefile b/helm/ocaml/mathql_interpreter/Makefile index 5b3d56c37..4bd667625 100644 --- a/helm/ocaml/mathql_interpreter/Makefile +++ b/helm/ocaml/mathql_interpreter/Makefile @@ -2,9 +2,9 @@ PACKAGE = mathql_interpreter REQUIRES = helm-urimanager postgres unix natile-galax helm-mathql PREDICATES = -INTERFACE_FILES = dbconn.mli utility.mli union.mli relation.mli diff.mli meet.mli sub.mli intersect.mli func.mli attribute.mli pattern.mli mqint.mli +INTERFACE_FILES = dbconn.mli utility.mli union.mli relation.mli diff.mli meet.mli sub.mli intersect.mli func.mli property.mli pattern.mli mqint.mli -IMPLEMENTATION_FILES = dbconn.ml utility.ml union.ml relation.ml diff.ml meet.ml sub.ml intersect.ml context.ml func.ml attribute.ml pattern.ml mqint.ml +IMPLEMENTATION_FILES = dbconn.ml utility.ml union.ml relation.ml diff.ml meet.ml sub.ml intersect.ml context.ml func.ml property.ml pattern.ml mqint.ml # $(INTERFACE_FILES:%.mli=%.ml) diff --git a/helm/ocaml/mathql_interpreter/mqint.ml b/helm/ocaml/mathql_interpreter/mqint.ml index e9f606b2e..03247f64f 100644 --- a/helm/ocaml/mathql_interpreter/mqint.ml +++ b/helm/ocaml/mathql_interpreter/mqint.ml @@ -37,12 +37,12 @@ open Dbconn;; open Union;; open Intersect;; open Meet;; +open Property;; open Sub;; open Context;; open Diff;; open Relation;; open Func;; -open Attribute;; open Pattern;; exception BooleExpTrue @@ -121,17 +121,18 @@ let rec exec_set_exp c = function print_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res - | MathQL.Relation (inv, rop, path, sexp, attl) -> + | MathQL.Relation (inv, rop, path, sexp, assl) -> let before = Sys.time() in if ! dbname = postgres_db then - (let res = relation_ex inv rop path (exec_set_exp c sexp) [] in (* tolto attl solo pe far compilare, rimetterlo *) + (let res = relation_ex inv rop path (exec_set_exp c sexp) assl in if ! stat then (print_string ("RELATION " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); print_endline (string_of_float (Sys.time() -. before) ^ "s"); flush stdout); res) + else - (let res = relation_galax_ex inv rop path (exec_set_exp c sexp) [] in (* tolto attl solo pe far compilare, rimetterlo *) + (let res = relation_galax_ex inv rop path (exec_set_exp c sexp) assl in if !stat then (print_string ("RELATION-GALAX " ^ (fst path) ^ " = " ^ string_of_int(List.length res) ^ ": "); print_endline (string_of_float (Sys.time() -. before) ^ "s"); @@ -207,7 +208,7 @@ and exec_val_exp c = function | MathQL.VVar s -> List.assoc s c.vvars | MathQL.RefOf sexp -> List.map (fun (s,_) -> s) (exec_set_exp c sexp) | MathQL.Fun (s, vexp) -> fun_ex s (exec_val_exp c vexp) - | MathQL.Property (inv, rop, path, vexp) -> attribute_ex rop path inv (exec_val_exp c vexp) + | MathQL.Property (inv, rop, path, vexp) -> property_ex rop path inv (exec_val_exp c vexp) (* valuta una MathQL.set_exp nel contesto vuoto e ritorna un MathQL.resource_set *) and execute x = diff --git a/helm/ocaml/mathql_interpreter/pattern.ml b/helm/ocaml/mathql_interpreter/pattern.ml index 86ef522b9..45b439952 100644 --- a/helm/ocaml/mathql_interpreter/pattern.ml +++ b/helm/ocaml/mathql_interpreter/pattern.ml @@ -41,7 +41,11 @@ let rec pattern_ex l = let qq = "select uri from registry where uri ~ '" ^ s ^ "' order by registry.uri asc" in let res = c#exec (qq) in List.map (function uri -> (uri,[])) (pgresult_to_string_list res) - in + (*for i = 0 to res#ntuples do + List.map (function uri -> (uri,[])) (res#get_tuple_list i) + done*) + + in cat result (pattern_ex tl) ;; diff --git a/helm/ocaml/mathql_interpreter/property.ml b/helm/ocaml/mathql_interpreter/property.ml new file mode 100644 index 000000000..6052c2072 --- /dev/null +++ b/helm/ocaml/mathql_interpreter/property.ml @@ -0,0 +1,104 @@ +(* 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/. + *) + +(* + * + *) + +open Dbconn;; +open Utility;; +open Intersect;; + + +let getpid p = + if (p = "refObj") then "F" + else "B" +;; + +(* + * implementazione delle funzioni dublin core + *) +let rec property_ex rop path inv = function + [] -> [] + | s::tl -> let mprop = fst path in + print_endline mprop; + let prop = List.hd (snd path) in + match mprop with + + "refObj" (* in base al valore di prop restituisco i valori del relativo campo della tabella relativa all'uri rappresentata da s *) + | "backPointer" -> + print_endline mprop; + let mpid = getpid mprop in + let res = + let c = pgc () in + let tv = pgresult_to_string (c#exec ("select id from registry where uri='" ^ s ^ "'")) in + let q = "select t" ^ tv ^ "." ^ prop ^ " from t" ^ tv ^ " where prop_id= '" ^ mpid ^ "'" in + print_endline q; + pgresult_to_string_list (c#exec q) + in + append (res,(property_ex rop path inv tl)) + + (*Rimane da capire cosa restituire nelle inverse!!!!*) + + + | "refRel" + | "refSort" -> + if inv then (* restituisco gli uri che il valore della prop richiesta uguale a s *) + let res = + let c = pgc () in + let q = ("select h" ^ mprop ^ ".uri from h" ^ mprop ^ " where h" ^ mprop ^ "." ^ prop ^ "= '" ^ s ^ "'") in + print_endline q; + pgresult_to_string_list (c#exec q) + in + append (res,(property_ex rop path inv tl)) + + else + let res = (* restituisco il valore della prop relativo all'uri rappresentato da s*) + let c = pgc () in + let q = ("select h" ^ mprop ^ "." ^ prop ^" from h" ^ mprop ^ " where h" ^ mprop ^ ".uri = '" ^ s ^ "'") in + pgresult_to_string_list (c#exec q) + in + append (res,(property_ex rop path inv tl)) + + + + | _ -> (* metadati DC !!!! Controllare se i nomi delle tabelle cominciano con h !!!!*) + if inv then + let res = + let c = pgc () in + let q = ("select " ^ mprop ^ ".uri from " ^ mprop ^ " where " ^ mprop ^ ".value = '" ^ s ^ "'") in + pgresult_to_string_list (c#exec q) + in + append (res,(property_ex rop path inv tl)) + else + let res = + let c = pgc () in + let q = ("select " ^ mprop ^ ".value from " ^ mprop ^ " where " ^ mprop ^ ".uri = '" ^ s ^ "'") in + pgresult_to_string_list (c#exec q) + in + append (res,(property_ex rop path inv tl)) + +;; + diff --git a/helm/ocaml/mathql_interpreter/property.mli b/helm/ocaml/mathql_interpreter/property.mli new file mode 100644 index 000000000..cd02493bf --- /dev/null +++ b/helm/ocaml/mathql_interpreter/property.mli @@ -0,0 +1,27 @@ +(* 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/. + *) + +val property_ex: MathQL.refine -> MathQL.path -> bool -> MathQL.value -> MathQL.value + diff --git a/helm/ocaml/mathql_interpreter/relation.ml b/helm/ocaml/mathql_interpreter/relation.ml index ea4fb9cc3..e5b700064 100644 --- a/helm/ocaml/mathql_interpreter/relation.ml +++ b/helm/ocaml/mathql_interpreter/relation.ml @@ -1,6 +1,7 @@ (* Copyright (C) 2000, HELM Team. * - * This file is part of HELM, an Hypertextual, Electronic + * + if This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * @@ -36,41 +37,399 @@ open Dbconn;; open Utility;; +(* Cerca in una lista di assegnamenti (lista di coppie (path,path) dove path e' +di tipo (string * string list) quello relativo alla proprietà p e ne +restituisce la variabile a cui tale proprietà deve essere associata *) +let rec search p = function + [] -> "" + | (path1,path2)::tl -> if (fst(path2) = p) then fst(path1) + else search p tl +;; -let get_prop_id propl = - let prop = fst propl in +let get_prop_id prop = if prop="refObj" then "F" else if prop="backPointer" then "B" else assert false ;; -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 - in - let c = pgc () in - 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, 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])]])] - | _ -> assert false ) - res#get_list) @ acc - ) - [] rset - ) - in - let rec edup = function - [] -> [] - | rs1::tl -> union_ex rs1 (edup tl) - in - edup rset_list +let relation_ex inv rop path rset assl = + let relk = fst path in + match relk with + + (* Nota: mancano le inverse di refObj e backPointer!!!! *) + +(* Notabis: ora per refObj si restituiscono tutti gli uri della tabella, nella diretta c'e` l'uri vuota *) +(* Notater: quando non richiedo tutte le proprieta` della tabella quelle che non voglio mi vengono restituite lo stesso ma con nome vuoto *) + + "refObj" + | "backPointer" -> (* proprieta` refObj e backPointer *) + print_endline "IN BACKPOINTER"; + let prop = get_prop_id relk in + if assl = [] then (* se non ci sono assegnamenti *) + let c = pgc () in + 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 from t" ^ tv ^ " where prop_id='" ^ prop ^ "' order by uri asc" in + print_endline qq; + let res = c#exec qq in + + let l = (pgresult_to_string_list res) in + List.iter print_endline l; + (List.map + (function + [uri] -> [(uri,[])] + | _ -> assert false ) + res#get_list) @ acc + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + + + else (* con assegnamenti *) + let c = pgc () in + 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, position, depth from t" ^ tv ^ " where prop_id='" ^ prop ^ "' order by uri asc" in + print_endline qq; + let res = c#exec qq in + let pos = search "position" assl in + let dep = search "depth" assl in + if ((pos != "") && (dep != "")) then (*caso in cui voglio sia position che depth*) + (List.map + (function + [uri;position;depth] -> [(uri,[[((pos, []),[position]);((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + else + if (dep = "") then (* voglio solo position *) + (List.map + (function + [uri;position;depth] -> [(uri,[[((pos, []),[position])]])] + | _ -> assert false ) + res#get_list) @ acc + else (* voglio solo depth *) + (List.map + (function + [uri;position;depth] -> [(uri,[[((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + +(* Fine proprieta` refObj e backPointer *) + + | "refRel" -> (* proprietà refRel *) + if assl = [] then [] (* se non ci sono assegnamenti *) +(* let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select uri from hrefRel order by uri asc" in + let res = c#exec qq in + (List.map + (function + [uri] -> [(uri,[])] + | _ -> assert false ) + res#get_list) @ acc + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list +*) + + else (* con assegnamenti *) + if inv then (* INVERSA *) + let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select uri, position, depth from hrefRel order by uri asc" in + let res = c#exec qq in + let pos = search "position" assl in + let dep = search "depth" assl in + if ((pos != "") && (dep != "")) then (*caso in cui voglio sia position che depth*) + (List.map + (function + [uri;position;depth] -> [(uri,[[((pos, []),[position]);((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + else + if (dep = "") then (* voglio solo position *) + (List.map + (function + [uri;position;depth] -> [(uri,[[((pos, []),[position])]])] + | _ -> assert false ) + res#get_list) @ acc + else (* voglio solo depth *) + (List.map + (function + [uri;position;depth] -> [(uri,[[((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + else (* DIRETTA, con risorsa nulla *) + let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select position, depth from hrefRel order by uri asc" in + let res = c#exec qq in + let pos = search "position" assl in + let dep = search "depth" assl in + if ((pos != "") && (dep != "")) then (*caso in cui voglio sia position che depth*) + (List.map + (function + [position;depth] -> [("",[[((pos, []),[position]);((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + else + if (dep = "") then (* voglio solo position *) + (List.map + (function + [position;depth] -> [("",[[((pos, []),[position])]])] + | _ -> assert false ) + res#get_list) @ acc + else (* voglio solo depth *) + (List.map + (function + [position;depth] -> [("",[[((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + + + + + +(* Fine proprieta` refRel *) + + + + + | "refSort" -> (* proprietà refSort *) + if assl = [] then [] (* se non ci sono assegnamenti *) +(* let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select uri from hrefSort order by uri asc" in + let res = c#exec qq in + (List.map + (function + [uri] -> [(uri,[])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list +*) + + + else (* con assegnamenti *) + if inv then (*INVERSA ----> SISTEMARE: vedi refRel!!!!*) + let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select uri, position, depth, sort from hrefSort order by uri asc" in + let res = c#exec qq in + let pos = search "position" assl in + let dep = search "depth" assl in + let sor = search "sort" assl in + if ((pos != "") && (dep != "") && (sor != "")) then (*caso in cui + voglio position, depth e sort*) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((pos, []),[position]);((dep, []),[depth]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + else + if ((dep = "") && (sor = "")) then (* voglio solo position *) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((pos, []),[position])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (sor = "")) then (* voglio solo depth *) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (dep = "")) then (* voglio solo sort *) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (dep != "") && (sor != "")) then (*voglio depth e sort*) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((dep, []),[depth]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if((pos != "") && (dep = "") && (sor != "")) then (*voglio + position e sort*) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((pos, []),[position]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + (* if ((pos != "") && (dep != "") && (sor = "")) then*) (*voglio + position e depth*) + (List.map + (function + [uri;position;depth;sort] -> [(uri,[[((pos, []),[position]);((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + + else (* DIRETTA con risorsa vuota ----> SISTEMARE: vedi refRel!!!!*) + let c = pgc () in + let rset_list = (* lista di singoletti:resource_set di un elemento *) + (List.fold_left (fun acc (uri,l) -> + let qq = "select position, depth, sort from hrefSort order by uri asc" in + let res = c#exec qq in + let pos = search "position" assl in + let dep = search "depth" assl in + let sor = search "sort" assl in + if ((pos != "") && (dep != "") && (sor != "")) then (*caso in cui + voglio position, depth e sort*) + (List.map + (function + [position;depth;sort] -> [("",[[((pos, []),[position]);((dep, []),[depth]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + else + if ((dep = "") && (sor = "")) then (* voglio solo position *) + (List.map + (function + [position;depth;sort] -> [("",[[((pos, []),[position])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (sor = "")) then (* voglio solo depth *) + (List.map + (function + [position;depth;sort] -> [("",[[((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (dep = "")) then (* voglio solo sort *) + (List.map + (function + [position;depth;sort] -> [("",[[((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if ((pos = "") && (dep != "") && (sor != "")) then (*voglio depth e sort*) + (List.map + (function + [position;depth;sort] -> [("",[[((dep, []),[depth]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + if((pos != "") && (dep = "") && (sor != "")) then (*voglio + position e sort*) + (List.map + (function + [position;depth;sort] -> [("",[[((pos, []),[position]);((sor, []),[sort])]])] + | _ -> assert false ) + res#get_list) @ acc + + else + (* if ((pos != "") && (dep != "") && (sor = "")) then*) (*voglio + position e depth*) + (List.map + (function + [position;depth;sort] -> [("",[[((pos, []),[position]);((dep, []),[depth])]])] + | _ -> assert false ) + res#get_list) @ acc + + ) + [] rset + ) + in + let rec edup = function + [] -> [] + | rs1::tl -> union_ex rs1 (edup tl) + in + edup rset_list + + + +(* Fine proprieta` refSort *) + + + + | _ -> [] + ;; @@ -105,10 +464,10 @@ let rec rsetl uril 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 = - let vvar = if attl = [] then "position" - else List.hd attl +(* 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 "assl" *) +let muse path assl r = + let vvar = if assl = [] then "position" + else List.hd assl in let uri = fst r in let furi = tofname uri in @@ -137,9 +496,12 @@ let muse path attl r = -(* 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 +(* prende un resource_set, una vvar (primo el. di assl) 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 inv rop path rset attl = - List.stable_sort (fun (uri1,l1) (uri2,l2) -> compare uri1 uri2) (List.concat (List.map (muse path attl) rset)) +let relation_galax_ex inv rop path rset assl = [] + +(* + List.stable_sort (fun (uri1,l1) (uri2,l2) -> compare uri1 uri2) (List.concat (List.map (muse path assl) rset)) +*) diff --git a/helm/ocaml/mathql_interpreter/relation.mli b/helm/ocaml/mathql_interpreter/relation.mli index 66df961c5..71c939970 100644 --- a/helm/ocaml/mathql_interpreter/relation.mli +++ b/helm/ocaml/mathql_interpreter/relation.mli @@ -24,9 +24,9 @@ *) val relation_ex : - bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set + bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> MathQL.assign list-> MathQL.resource_set val relation_galax_ex : -bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> string list -> MathQL.resource_set +bool -> MathQL.refine -> MathQL.path -> MathQL.resource_set -> MathQL.assign list -> MathQL.resource_set -- 2.39.2