Commits

Sébastien Ferré  committed 90494a8

Removal of reification and sources in [store] + other improvements for further efficiency (up to a few 100,000 triples)

  • Participants
  • Parent commits c508025

Comments (0)

Files changed (5)

     class virtual t =
       object (self)
 	method virtual string : string
-	method virtual run : src:Name.t -> store -> Ext.map -> Ext.map
-(*	method virtual undo : src:Ext.oid -> store -> Ext.map -> Ext.map *)
+	method virtual run : store -> Ext.map -> Ext.map
+(*	method virtual undo : store -> Ext.map -> Ext.map *)
       end
 
 (*
-    class nop =
-      object
-	inherit t
-	method string = "nop"
-	method run ~src store m = m
-	method undo ~src store m = m
-      end
-
-    let nop = (new nop : t)
-*)
-(*
     class ['a] quote (other_src : Ext.oid t) (p : 'a t) =
       object
 	inherit ['a] t
       object
 	inherit t
 	method string = "add(" ^ r#uri ^ ": " ^ String.concat "," (List.map (fun (arg,v) -> arg ^ "=" ^ v) largs) ^ ")"
-	method run ~src store m =
+	method run store m =
 	  let args, m' =
 	    List.fold_left
 	      (fun (args,m1) (arg,v) ->
 		    let x = store#new_resource in x, (v,x)::m1 in
 		(arg,x)::args, m2)
 	      ([],m) largs in
-	  r#add ~src args;
+	  r#add args;
 	  m'
 (*
-	method undo ~src store m =
+	method undo store m =
 	  let vxs = List.map (fun (v,e) -> (v,store#get_entity (e#eval store m))) le in
-	  if effective then ignore (r#remove ~src vxs);
+	  if effective then ignore (r#remove vxs);
 	  m
 *)
       end
       object
 	inherit t
 	method string = "remove(" ^ r#uri ^ ": " ^ String.concat "," (List.map (fun (arg,v) -> arg ^ "=" ^ v) largs) ^ ")"
-	method run ~src store m =
+	method run store m =
 	  let args = List.map (fun (arg,v) -> (arg, List.assoc v m)) largs in
-	  r#remove ~src args;
+	  r#remove args;
 	  m
 (*
-	method undo ~src store m =
+	method undo store m =
 	  let vxs = List.map (fun (v,e) -> (v,store#get_entity (e#eval store m))) le in
-	  if effective then ignore (r#add ~src vxs);
+	  if effective then ignore (r#add vxs);
 	  m
 *)
       end
       object
 	inherit t
 	method string = v ^ "=" ^ expr#string
-	method run ~src store m =
+	method run store m =
 	  expr#fold store
 	    (fun _ m1 n ->
 	      (v,n)::List.remove_assoc v m1)
 	    m m
 (*
-	method undo ~src store m =
+	method undo store m =
 	  List.remove_assoc v m
 *)
       end
       object
 	inherit t
 	method string = v1 ^ ":=" ^ v2
-	method run ~src store m =
+	method run store m =
 	  let n = List.assoc v2 m in
 	  (v1,n) :: List.remove_assoc v1 m
       end
       object
 	inherit t
 	method string = v1 ^ " == " ^ v2
-	method run ~src store m =
+	method run store m =
 	  try
 	    let x1 = List.assoc v1 m in
 	    try
     class seq (p1 : t) (p2 : t) =
       object
 	inherit t
-	method run ~src store m =
-	  let m1 = p1#run ~src store m in
-	  p2#run ~src store m1
-	method undo ~src store m =
-	  let m1 = p2#undo ~src store m in
-	  let m2 = p1#undo ~src store m1 in
+	method run store m =
+	  let m1 = p1#run store m in
+	  p2#run store m1
+	method undo store m =
+	  let m1 = p2#undo store m in
+	  let m2 = p1#undo store m1 in
 	  m2
       end
 
     class fork (p1 : t) (p2 : t) =
       object
 	inherit t
-	method run ~src store m =
-	  p1#run ~src store m;
-	  p2#run ~src store m
-	method undo ~src store m1=
-	  let m = p2#undo ~src store m1 in
-	  let _ = p1#undo ~src store m1 in
+	method run store m =
+	  p1#run store m;
+	  p2#run store m
+	method undo store m1=
+	  let m = p2#undo store m1 in
+	  let _ = p1#undo store m1 in
 	  m
       end
 
     let list_string = function
       | [] -> "skip"
       | lp -> String.concat "; " (List.map (fun p -> p#string) lp)
-    let list_run ~src store m lp =
-      List.fold_left (fun m' p -> p#run ~src store m') m lp
-    let list_undo ~src store m' lp =
-      List.fold_right (fun p m -> p#undo ~src store m) lp m'
+    let list_run store m lp =
+      List.fold_left (fun m' p -> p#run store m') m lp
+    let list_undo store m' lp =
+      List.fold_right (fun p m -> p#undo store m) lp m'
 
 (*
     class choose (ext : Ext.t) =
       object
 	inherit t
 	method string = "choose(" ^ ext#string ^ ")"
-	method run ~src store m =
+	method run store m =
 	  ext#choose store m
       end
 
 	inherit t
 (*	val mutable cond = false *)
 	method string = "if " ^ c#string ^ " then " ^ list_string lp1 ^ " else " ^ list_string lp2 ^ " endif"
-	method run ~src store m =
+	method run store m =
 	  if c#succeeds store m
-	  then list_run ~src store m lp1
-	  else list_run ~src store m lp2
+	  then list_run store m lp1
+	  else list_run store m lp2
 (*
 	  try
 	    let m' = ext#choose store m in
 	    cond <- true;
-	    list_run ~src store m' lp1
+	    list_run store m' lp1
 	  with Not_found ->
-	    list_run ~src store m lp2
+	    list_run store m lp2
 *)
 (*
-	method undo ~src store m =
+	method undo store m =
 	  if cond
-	  then list_undo ~src store m lp1
-	  else list_undo ~src store m lp2
+	  then list_undo store m lp1
+	  else list_undo store m lp2
 *)
       end
 
       object
 	inherit t
 	method string = "given " ^ list_string lp_cond_assert ^ " do " ^ list_string lp ^ " finally " ^ list_string lp_cond_retract ^ " done"
-	method run ~src store m =
-	  let m1 = list_run ~src store m lp_cond_assert in
-	  let m2 = list_run ~src store m1 lp in
-	  let _ = list_run ~src store m1 lp_cond_retract in
+	method run store m =
+	  let m1 = list_run store m lp_cond_assert in
+	  let m2 = list_run store m1 lp in
+	  let _ = list_run store m1 lp_cond_retract in
 	  m2
       end
 
       object
 	inherit t
 	method string = "foreach " ^ e#string ^ " do " ^ list_string lp ^ " done"
-	method run ~src store m =
-	  let _ = e#fold (store :> Ext.store) (fun () m' -> ignore (list_run ~src store m' lp)) () m in
+	method run store m =
+	  let _ = e#fold (store :> Ext.store) (fun () m' -> ignore (list_run store m' lp)) () m in
 	  m
 (*
-	method undo ~src store m =
-	  let _ = e#fold (store :> Ext.store) (fun () m' -> ignore (list_undo ~src store m' lp)) () m in
+	method undo store m =
+	  let _ = e#fold (store :> Ext.store) (fun () m' -> ignore (list_undo store m' lp)) () m in
 	  m
 *)
       end
       object
 	inherit t
 	method string = "forany " ^ e#string ^ " do " ^ list_string lp ^ " done"
-	method run ~src store m =
+	method run store m =
 	  try
 	    let m1 = e#choose store m in
-	    list_run ~src store m1 lp
+	    list_run store m1 lp
 	  with Not_found -> m
       end
 
       object
 	inherit t
 	method string = "repeat " ^ string_of_int n ^ " " ^ list_string lp ^ " done"
-	method run ~src store m =
+	method run store m =
 	  for i = 1 to n do
-	    ignore (list_run ~src store m lp)
+	    ignore (list_run store m lp)
 	  done;
 	  m
       end
       object
 	inherit t
 	method string = "while " ^ e#string ^ " do " ^ list_string lp ^ " done"
-	method run ~src store m =
+	method run store m =
 	  let ref_m = ref m in
 	  (try
 	    while true do
 	      let m' = e#choose store !ref_m in
-	      let m'' = list_run ~src store m' lp in
+	      let m'' = list_run store m' lp in
 	      ref_m := List.map (fun (v,o) -> (v, try List.assoc v m'' with Not_found -> o)) m
 	    done
 	  with _ -> ());
       object
 	inherit t
 	method string = "display(" ^ e#string ^ ")"
-	method run ~src store m =
+	method run store m =
 	  e#fold store
 	    (fun _ m1 n1 ->
 	      print_string (Name.contents n1))
       object
 	inherit t
 	method string = "display(" ^ String.concat "," (List.map (fun e -> e#string) le) ^ ")"
-	method run ~src store m =
+	method run store m =
 	  display_run store true m [] le
       end
 
       object
 	inherit t
 	method string = p#uri ^ "(" ^ String.concat "," (List.map (fun (pp,e) -> e#string) expr_args) ^ ")"
-	method run ~src store m =
+	method run store m =
 	  Ext.expr_list_fold store
 	    (fun _ m1 args -> p#run args)
 	    () m [] expr_args;
       | FAssign of Ext.var * Ext.var
       | FSame of Ext.var * Ext.var
       | FDiff of Ext.var * Ext.var
-      | FStat of Ext.var * Ext.var * Ext.var * Ext.var * Ext.var (* s, p, o, t, src *)
-      | FClass of Uri.t * Ext.var * Ext.var * Ext.var (* cc, s, t, src *)
-      | FProp of modifier list * Uri.t * Ext.var * Ext.var * Ext.var * Ext.var (* lm, pp, s, o, t, src *)
-      | FFunct of Uri.t * Ext.var * Ext.var array * Ext.var (* ff, x, args, src *)
+(*      | FStat of Ext.var * Ext.var * Ext.var * Ext.var * Ext.var (* s, p, o, t, src *) *)
+      | FClass of Uri.t * Ext.var (* cc, s *)
+      | FProp of modifier list * Uri.t * Ext.var * Ext.var (* lm, pp, s, o *)
+      | FFunct of Uri.t * Ext.var * Ext.var array (* ff, x, args *)
       | FPred of Prim.pred * (Uri.t * Ext.var) list
       | FProc of Prim.proc * (Uri.t * expr_prop) list
       | FOrder of modifier list * Ext.var * Ext.var
 				( match p2 with
 				| Prop.Atom x ->
 				    ( match x with
-				    | FTrue | FSame _ | FDiff _ | FAssign _ | FStat _
+				    | FTrue | FSame _ | FDiff _ | FAssign _ (*| FStat _*)
 				    | FClass _ | FProp _ | FPred _ | FFunct _
 				    | FOrder _ | FMatches _ | FContains _ -> true
 				    | FEqual (_, Prop.Atom (EAggreg _)) -> false
 			ignore (eval_fol_prop vars1 (List.hd lp1)); (* to raise some "Unbound" exception *)
 			assert false
 		      with Unbound v ->
-			let lp2 = Prop.Atom (FClass (Rdfs.uri_Resource, v, "", ""))::lp1 in
+			let lp2 = Prop.Atom (FClass (Rdfs.uri_Resource, v))::lp1 in
 			Some (lp2, first, d, vars1, p'))
 	      (lp, true, 0, vars, Prop.Atom FTrue) in
 	  d, vars1, p'
 	  if LSet.mem v1 vars && LSet.mem v2 vars
 	  then 0, vars, fol
 	  else raise (Unbound v1)
+(*
       | FStat (s, p, o, t, src) ->
 	  let d =
 	    if t <> "" && LSet.mem t vars
 	      then (if s = "" || LSet.mem s vars then 0 else 1) * (if o = "" || LSet.mem o vars then 0 else 1)
 	      else raise (Unbound p) in
 	  d, LSet.add s (LSet.add p (LSet.add o (LSet.add src (if t = "" then vars else LSet.add t vars)))), fol
-      | FClass (cl, s, t, src) ->
-	  let d = if t <> "" && LSet.mem t vars then 0 else if s = "" || LSet.mem s vars then 0 else 1 in
-	  d, LSet.add s (LSet.add src (if t = "" then vars else LSet.add t vars)), fol
-      | FProp (lm, pr, s, o, t, src) ->
+*)
+      | FClass (cl, s) ->
+	  let d = if s = "" || LSet.mem s vars then 0 else 1 in
+	  d, LSet.add s vars, fol
+      | FProp (lm, pr, s, o) ->
 	  let d =
-	    if t <> "" && LSet.mem t vars
-	    then 0
-	    else
-	      (if s = "" || LSet.mem s vars then 0 else 1) * (* YES! multiplication *)
-		(if o = "" || LSet.mem o vars then 0 else 1) in
-	  d, LSet.add s (LSet.add o (LSet.add src (if t = "" then vars else LSet.add t vars))), fol
-      | FFunct (funct, x, args, src) ->
+	    (if s = "" || LSet.mem s vars then 0 else 1) * (* YES! multiplication *)
+	      (if o = "" || LSet.mem o vars then 0 else 1) in
+	  d, LSet.add s (LSet.add o vars), fol
+      | FFunct (funct, x, args) ->
 	  let d =
 	    if x <> "" && LSet.mem x vars
 	    then 0
 	    else Array.fold_left (fun res arg -> if arg = "" || LSet.mem arg vars then res else res+1) 0 args in
-	  d, Array.fold_left (fun res arg -> LSet.add arg res) (LSet.add x (LSet.add src vars)) args, fol
+	  d, Array.fold_left (fun res arg -> LSet.add arg res) (LSet.add x vars) args, fol
       | FPred (pred, args) ->
 	  let d, vars1 = List.fold_left
 	      (fun (d,vars1) (_,x) -> if LSet.mem x vars1 then (d+1,vars1) else (d, LSet.add x vars1))
 	  let d, vars1, args' = eval_args vars args in
 	  d, vars1, FProc (proc, args')
       | FOrder (lm,x,y) -> eval_prim vars [x;y] fol
-(*
-	  let d, vars1 = eval_lv vars [(x,2);(y,2)] in
-	  d, vars1, fol
-*)
       | FMatches (x,y) -> eval_prim vars [x;y] fol
-(*
-	  let d, vars1 = eval_lv vars [(x,2);(y,3)] in
-	  d, vars1, fol
-*)
       | FContains (x,y) -> eval_prim vars [x;y] fol
-(*
-	  let d, vars1 = eval_lv vars [(x,2);(y,3)] in
-	  d, vars1, fol
-*)
       | FDisplay expr ->
 	  let d, vars1, expr' = eval_expr_prop vars expr in
 	  d, vars1, FDisplay expr'
       if List.for_all (fun v -> List.mem v vars) lv
       then 0, vars, fol
       else 100, vars, FTrue
-(*
-    and eval_lv vars lv =
-      List.fold_left
-	(fun (d,vars1) (v,w) ->
-	  if v = "" || LSet.mem v vars1
-	  then (d, vars1)
-	  else (d+w, LSet.add v vars1))
-	(0,vars) lv
-*)
 	  
 
 (* ---- Extension/Code for formulas -------- *)
     class type rel =
       object
 	method uri : Uri.t
-	method add : src:Name.t -> Ext.map -> unit
-	method remove : src:Name.t -> Ext.map -> unit
+	method add : Ext.map -> unit
+	method remove : Ext.map -> unit
       end
 
 
 	  Ext.unify x y
       | FDiff (x,y) ->
 	  Ext.neq x y
+(*
       | FStat (s, p, o, t, src) ->
 	  store#get_statement#extension ~obs s p o t src
-      | FClass (cl, s, t, src) ->
+*)
+      | FClass (cl, s) ->
 	  let cc = store#get_class cl in
-	  cc#relation#extension ~obs s t src
-      | FProp (lm, pr, s, o, t, src) ->
+	  cc#relation#extension ~obs s
+      | FProp (lm, pr, s, o) ->
 	  let pp = store#get_property pr in
 	  let name, pp_ext =
 	    if List.mem Direct lm
 	    then "direct " ^ pr, pp#direct_relation#extension ~obs
 	    else pr, pp#relation#extension ~obs in
-	  let ext = (fun x y -> pp_ext x y t src) in
+	  let ext = pp_ext in
 	  let name, ext = if List.mem Transitive lm then "trans "^name, Ext.transitive ext else name, ext in
 	  let name, ext = if List.mem Reflexive lm then "opt "^name, Ext.reflexive ext else name, ext in
 	  let name, ext = if List.mem Symmetric lm then "sym "^name, Ext.symmetric ext else name, ext in
 	  ext s o
-      | FFunct (funct, x, args, src) ->
+      | FFunct (funct, x, args) ->
 	  let ff = store#get_functor funct (Array.length args) in
-	  ff#relation#extension ~obs x args src
+	  ff#relation#extension ~obs x args
       | FPred (pred, args) ->
 	  let pr = store#get_predicate pred in
 	  pr#relation#extension ~obs args
       | FSame (x,y) ->
 	  [Code.unify x y]
       | FDiff (x,y) -> assert false
+(*
       | FStat (s,p,o,t,src) ->
 	  [mode#update (store#get_statement :> rel)
 	     ((Store._s, s) :: (Store._p, p) :: (Store._o, o) :: if t = "" then [] else [(Store._t, t)])]
-      | FClass (cl,s,t,src) ->
+*)
+      | FClass (cl,s) ->
 	  [mode#update (store#get_class cl :> rel)
-	     ((Store._s, s) :: if t = "" then [] else [(Store._t, t)])]
-      | FProp (lm,pr,s,o,t,src) ->
+	     [(Store._s, s)]]
+      | FProp (lm,pr,s,o) ->
 	  [mode#update (store#get_property pr :> rel)
-	     ((Store._s, s) :: (Store._o, o) :: if t = "" then [] else [(Store._t, t)])]
-      | FFunct (funct,x,args,src) ->
+	     [(Store._s, s); (Store._o, o)]]
+      | FFunct (funct,x,args) ->
 	  [mode#update (store#get_functor funct (Array.length args) :> rel)
 	     (("0", x) :: Array.to_list (Array.mapi (fun i arg -> (string_of_int (i+1), arg)) args))]
       | FPred _

File src/lisql.ml

   end
 
 let rec list_heads n = function (* return boolean 'partial', and n heads *)
-  | [] -> n>0, []
+  | [] -> false, []
   | x::l ->
       if n = 0
       then true, []
 let eval_command store = function
   | Base uri -> store#set_base uri
   | Prefix (pre,uri) -> store#add_prefix pre uri
-  | Import (src,base,filename) -> store#import_rdf_file ~src ~base filename
+  | Import (src,base,filename) -> store#import_rdf_file ~base filename
   | LinkedData uri -> store#import_uri uri
   | Assert (src,a) -> store#tell ~src a
   | Comment s -> ()
 
     method get_property uri =
       if Term.is_arg uri then begin
-	super#add_triple ~src:self#name (Rdf.URI uri) Rdfs.uri_subPropertyOf (Rdf.URI Term.uri_argAny);
-	super#add_triple ~src:self#name (Rdf.URI uri) Rdf.uri_type (Rdf.URI Term.uri_ArgProperty) end
+	super#add_triple (Rdf.URI uri) Rdfs.uri_subPropertyOf (Rdf.URI Term.uri_argAny);
+	super#add_triple (Rdf.URI uri) Rdf.uri_type (Rdf.URI Term.uri_ArgProperty) end
       else if Term.is_functorArg uri then begin
-	super#add_triple ~src:self#name (Rdf.URI uri) Rdfs.uri_domain (Rdf.URI Term.uri_ImplicitFunctor);
-	super#add_triple ~src:self#name (Rdf.URI uri) Rdfs.uri_range (Rdf.URI Term.uri_ArgProperty)
+	super#add_triple (Rdf.URI uri) Rdfs.uri_domain (Rdf.URI Term.uri_ImplicitFunctor);
+	super#add_triple (Rdf.URI uri) Rdfs.uri_range (Rdf.URI Term.uri_ArgProperty)
       end;
       super#get_property uri
 
     method import_rdf ~src ~base filename = Common.prof "Lisql.store#import_rdf" (fun () ->
       Tarpit.effect (fun obs ->
 	log#append (Syntax.print_to_string ~ctx:self#as_context Syntax.print_command (Import (src,base,filename)));
-	self#import_rdf_file ~src ~base filename))
+	self#import_rdf_file ~base filename))
 
     method import_uri (uri : Uri.t) : unit = (* import linked data about [uri] *)
       Tarpit.effect (fun obs ->
 	    let rdf_file = Filename.temp_file "sewelis" ".rdf" in
 	    print_endline "HTTP GET of RDF data";
 	    Sys.command ("wget --header \"Accept:application/rdf+xml\" -O \"" ^ rdf_file ^ "\" \"" ^ uri ^ "\"");
-	    self#import_rdf_file ~src:uri ~base:uri rdf_file;
+	    self#import_rdf_file ~base:uri rdf_file;
 	    Sys.remove rdf_file
 	| Some filename -> ())
 	(* extract facts about this filename *)
 	~f_file:(import_file self)
 	abs_path
 
-    method export_rdf ~src ~base ~xmlns filename =
-      self#export_rdf_file ~src ~base ~xmlns filename
+    method export_rdf ~(src : Uri.t) ~base ~xmlns filename =
+      self#export_rdf_file ~base ~xmlns filename
 
 	(* parsing and printing *)
 
       super#init;
       (* base knowledge *)
       List.iter
-	(fun (s,p,o) -> self#add_triple ~src:self#name (Rdf.URI s) p (Rdf.URI o))
+	(fun (s,p,o) -> self#add_triple (Rdf.URI s) p (Rdf.URI o))
 	[ Term.uri_ImplicitFunctor, Rdfs.uri_subClassOf, Term.uri_Functor;
 	  Term.uri_Verb, Rdfs.uri_subClassOf, Term.uri_Functor;
 	  Term.uri_IntransitiveVerb, Rdfs.uri_subClassOf, Term.uri_Verb;
 	  Term.uri_stat, Term.uri_functorArg 2, Rdf.uri_predicate;
 	  Term.uri_stat, Term.uri_functorArg 3, Rdf.uri_object;
 	  File.uri_directory, Rdf.uri_type, Owl.uri_TransitiveProperty];
-      self#add_triple ~src:self#name (Rdf.URI Term.uri_nil) Term.uri_arity (Rdf.Literal ("0", Rdf.Typed Xsd.uri_integer));
-      self#add_triple ~src:self#name (Rdf.URI Term.uri_cons) Term.uri_arity (Rdf.Literal ("2", Rdf.Typed Xsd.uri_integer));
-      self#add_triple ~src:self#name (Rdf.URI Term.uri_stat) Term.uri_arity (Rdf.Literal ("3", Rdf.Typed Xsd.uri_integer));
-      self#add_triple ~src:self#name (Rdf.URI Rdfs.uri_subClassOf) Namespace.uri_inverseLabel (Rdf.Literal ("subclass", Rdf.Plain "en"));
-      self#add_triple ~src:self#name (Rdf.URI Rdfs.uri_subPropertyOf) Namespace.uri_inverseLabel (Rdf.Literal ("subproperty", Rdf.Plain "en"));
+      self#add_triple (Rdf.URI Term.uri_nil) Term.uri_arity (Rdf.Literal ("0", Rdf.Typed Xsd.uri_integer));
+      self#add_triple (Rdf.URI Term.uri_cons) Term.uri_arity (Rdf.Literal ("2", Rdf.Typed Xsd.uri_integer));
+      self#add_triple (Rdf.URI Term.uri_stat) Term.uri_arity (Rdf.Literal ("3", Rdf.Typed Xsd.uri_integer));
+      self#add_triple (Rdf.URI Rdfs.uri_subClassOf) Namespace.uri_inverseLabel (Rdf.Literal ("subclass", Rdf.Plain "en"));
+      self#add_triple (Rdf.URI Rdfs.uri_subPropertyOf) Namespace.uri_inverseLabel (Rdf.Literal ("subproperty", Rdf.Plain "en"));
+      (* perform PageRank iterations *)
+      self#pagerank_iterations 5;
       (* load user knowledge *)
       log#iter
 	(fun s ->
 	  print_string "parsing logline: "; print_endline s;
 	  let cmd = Syntax.parse_of_string ~ctx:self#as_context Syntax.parse_command s in
-	  eval_command self cmd);
-      (* perform PageRank iterations *)
-      self#pagerank_iterations 5
+	  eval_command self cmd)
 
   end
 

File src/lisql_semantics.ml

       Prop.Atom (Fol.FForNo (d1 x, d2 x))
 and fol_p1 ~obs store gv (x : Extension.var) : p1 -> Fol.fol_prop = function
   | Type a ->
-      Prop.Atom (Fol.FClass (a, x, "", ""))
+      Prop.Atom (Fol.FClass (a, x))
 (* optimization leading to bugs in updates: ex., 'every fournisseur not remise ?' *)
 (*
   | Role (RAtom _ as r, Det (Qu (An, None), Thing)) ->
   else if a = Operator.contains then
     Prop.Atom (Fol.FContains (x,y))
   else
-    Prop.Atom (Fol.FProp (lm, a, x, y, "", ""))
+    Prop.Atom (Fol.FProp (lm, a, x, y))
 and fol_struct ~obs store gv x funct args =
   let arity = Array.length args in
   Common.fold_for_down
     (fun i res ->
       fun rev_xargs -> fol_s1 ~obs store gv (fun xi -> res (xi::rev_xargs)) args.(i-1))
     arity 1
-    (fun rev_xargs -> Prop.Atom (Fol.FFunct (funct, x, Array.of_list (List.rev rev_xargs), "")))
+    (fun rev_xargs -> Prop.Atom (Fol.FFunct (funct, x, Array.of_list (List.rev rev_xargs))))
     []
 
 
     print_string "tell: ";
     List.iter (fun c -> print_string c#string; print_string "; ") lc;
     print_newline ();
-    ignore (Code.list_run ~src:(Rdf.URI src) (store :> Code.store) [] lc))
+    ignore (Code.list_run (store :> Code.store) [] lc))
 
 let ask ~obs store (a : s) : bool =
   let fol = fol_of_assertion ~obs store a in

File src/store.ml

     let begin_tag typ name = () (* Printf.printf "%d<%s %s>\n" !tag_depth typ (Name.to_string "" [] [] name); incr tag_depth *)
     let end_tag typ name = () (* decr tag_depth; Printf.printf "%d</%s %s>\n" !tag_depth typ (Name.to_string "" [] [] name) *)
 
-    let _s, _p, _o, _t, _src = "_s", "_p", "_o", "_t", "_src"
+    let _s, _p, _o = "_s", "_p", "_o"
 
     let symmetric_closure : Rel.t * Rel.t -> Rel.t * Rel.t =
       fun (r1,r2) -> Common.prof "Store.symmetric_closure" (fun () ->
 		(fun (rt1',rt2') x _ ->
 		  Rel.fold_assoc (* for each successor of z *)
 		    (fun (rt1'',rt2'') y _ ->
-		      (Rel.add [x;y;0;0] rt1'', Rel.add [y;x;0;0] rt2''))
+		      (Rel.add [x;y] rt1'', Rel.add [y;x] rt2''))
 		    (rt1',rt2') rt1_z)
 		(rt1,rt2) rt2_z)
 	    (r1,r2) zs in
     class virtual property_data store (name : string) =
       object (self)
 	inherit [Rel.t * Rel.t] data
-	method extension ~(obs : observer) (s : Ext.var) (o : Ext.var) (t : Ext.var) (src : Ext.var) : Ext.t =
-	  Ext.relation2 name s o [t;src] (fun _ -> self#contents ~obs)
+	method extension ~(obs : observer) (s : Ext.var) (o : Ext.var) : Ext.t =
+	  Ext.relation2 name s o [] (fun _ -> self#contents ~obs)
 	method has_instance ~obs n1 n2 = Common.prof "Store.property_data#has_instance" (fun () ->
 	  let r1, _ = self#contents ~obs in
 	  try
 	method has_object ~(obs : observer) n =
 	  let _, r2 = self#contents ~obs in
 	  Rel.mem_assoc (store#get_entity n) r2
-	method iter : (src:Name.t -> s:Name.t -> o:Name.t -> t_opt:(Name.t option) -> unit) -> unit =
+	method iter : (Name.t -> Name.t -> unit) -> unit =
 	  fun f -> Common.prof "Store.property_data#iter" (fun () ->
 	    effect (fun obs ->
 	      Rel.fold
 		(fun _ -> function
-		  | [s; o; t; src] ->
-		      f
-			~src:(store#get_name src)
-			~s:(store#get_name s)
-			~o:(store#get_name o)
-			~t_opt:(if t = 0 then None else Some (store#get_name t))
+		  | [s; o] -> f (store#get_name s) (store#get_name o)
 		  | _ -> assert false)
 		()
 		(fst (self#contents ~obs))))
 	      let r2_n2 = Rel.assoc (store#get_entity n2) r2 in
 	      Rel.fold_assoc (fun res o1 _ -> f res (store#get_name o1)) init r2_n2
 	    with _ -> init)
-	method fold_successors_statements : 'a. obs:observer -> ('a -> Name.t -> Name.t option -> 'a) -> 'a -> Name.t -> 'a =
-	  fun ~obs f init n1 -> Common.prof "Store.property_data#fold_successors_statements" (fun () ->
-	    let r1, _ = self#contents ~obs in
-	    try
-	      let r1_n1 = Rel.assoc (store#get_entity n1) r1 in
-	      Rel.fold_assoc
-		(fun res o2 r1_n1_n2 ->
-		  let n2 = store#get_name o2 in
-		  Rel.fold_assoc
-		    (fun res1 o3 _ ->
-		      f res n2 (if o3=0 then None else Some (store#get_name o3)))
-		    res r1_n1_n2)
-		init r1_n1
-	    with _ -> init)
-	method fold_predecessors_statements : 'a. obs:observer -> ('a -> Name.t -> Name.t option -> 'a) -> 'a -> Name.t -> 'a =
-	  fun ~obs f init n2 -> Common.prof "Store.property_data#fold_predecessors_statements" (fun () ->
-	    let _, r2 = self#contents ~obs in
-	    try
-	      let r2_n2 = Rel.assoc (store#get_entity n2) r2 in
-	      Rel.fold_assoc
-		(fun res o1 r2_n2_n1 ->
-		  let n1 = store#get_name o1 in
-		  Rel.fold_assoc
-		    (fun res1 o3 _ ->
-		      f res n1 (if o3=0 then None else Some (store#get_name o3)))
-		    res r2_n2_n1)
-		init r2_n2
-	    with _ -> init)
       end
 
     class property_state store name =
       object
-	inherit [Rel.t * Rel.t] state (Rel.empty 4, Rel.empty 4)
+	inherit [Rel.t * Rel.t] state (Rel.empty 2, Rel.empty 2)
 	inherit property_data store name
       end
 
 	method virtual uri : Uri.t
 	method name : Name.t = Rdf.URI self#uri
 	method virtual oid : Ext.oid
-	method virtual add : src:Name.t -> Ext.map -> unit
-	method virtual remove : src:Name.t -> Ext.map -> unit
+	method virtual add : Ext.map -> unit
+	method virtual remove : Ext.map -> unit
 	method explicit_relation = (new property_state store ("explicit_" ^ self#uri) :> property_data)
 	method strict_direct_relation = self#explicit_relation
 	method strict_relation = self#strict_direct_relation
 	method direct_relation = self#strict_direct_relation
 	method relation = self#strict_direct_relation
-	method iter_triples (f : src:Name.t -> Rdf.triple -> unit) : unit =
+	method iter_triples (f : Rdf.triple -> unit) : unit =
 	  self#explicit_relation#iter
-	    (fun ~src ~s ~o ~t_opt -> f ~src {Rdf.s; Rdf.p = self#uri; Rdf.o; Rdf.t_opt})
-
-(*	method increments : property list = [] *)
-
-(*	method virtual initialize : unit *)
+	    (fun s o -> f {Rdf.s; Rdf.p = self#uri; Rdf.o; Rdf.t_opt=None})
       end
 
     class virtual class_data store (name : string) =
       object (self)
 	inherit [Rel.t] data
-	method extension ~(obs : observer) (s : Ext.var) (t : Ext.var) (src : Ext.var) : Ext.t =
-	  Ext.relation1 name s [t;src] (fun _ -> self#contents ~obs)
+	method extension ~(obs : observer) (s : Ext.var) : Ext.t =
+	  Ext.relation1 name s [] (fun _ -> self#contents ~obs)
 	method has_instance ~(obs : observer) (n : Name.t) : bool = Common.prof "Store.class_data#has_instance" (fun () ->
 	  Rel.mem_assoc (store#get_entity n) (self#contents ~obs))
 	method instances ~(obs : observer) : Intset.t = Common.prof "Store.class_data#instances" (fun () ->
 	  Rel.keys (self#contents ~obs))
-	method iter : (src:Name.t -> s:Name.t -> t_opt:(Name.t option) -> unit) -> unit =
+	method iter : (Name.t -> unit) -> unit =
 	  fun f -> Common.prof "Store.class_data#iter" (fun () ->
 	    effect (fun obs ->
 	      Rel.fold
 		(fun _ -> function
-		  | [s; t; src] ->
-		      f
-			~src:(store#get_name src)
-			~s:(store#get_name s)
-			~t_opt:(if t = 0 then None else Some (store#get_name t))
+		  | [s] -> f (store#get_name s)
 		  | _ -> assert false)
 		()
 		(self#contents ~obs)))
 	method fold_instances : 'a. obs:observer -> ('a -> Name.t -> 'a) -> 'a -> 'a =
 	  fun ~obs f init -> Common.prof "Store.class_data#fold_instances" (fun () ->
 	    Rel.fold_assoc (fun res o _ -> f res (store#get_name o)) init (self#contents ~obs))
-	method fold_instance_statements : 'a. obs:observer -> ('a -> Name.t option -> 'a) -> 'a -> Name.t -> 'a =
-	  fun ~obs f init n -> Common.prof "Store.class_data#fold_instance_statements" (fun () ->
-	    try
-	      let r1 = Rel.assoc (store#get_entity n) (self#contents ~obs) in
-	      Rel.fold_assoc (fun res t _ -> f res (if t=0 then None else Some (store#get_name t))) init r1
-	    with _ -> init)
       end
 
     class class_state store name =
       object (self)
-	inherit [Rel.t] state (Rel.empty 3)
+	inherit [Rel.t] state (Rel.empty 1)
 	inherit class_data store name
       end
 
 	method virtual uri : Uri.t
 	method name = Rdf.URI self#uri
 	method virtual oid : Ext.oid
-	method virtual add : src:Name.t -> Ext.map -> unit
-	method virtual remove : src:Name.t -> Ext.map -> unit
+	method virtual add : Ext.map -> unit
+	method virtual remove : Ext.map -> unit
 	method explicit_relation = (new class_state store ("explicit_" ^ self#uri) :> class_data)
 	method relation = self#explicit_relation
-	method iter_triples (f : src:Name.t -> Rdf.triple -> unit) : unit =
+	method iter_triples (f : Rdf.triple -> unit) : unit =
 	  self#explicit_relation#iter
-	    (fun ~src ~s ~t_opt -> f ~src {Rdf.s; Rdf.p = Rdf.uri_type; Rdf.o = self#name; Rdf.t_opt})
-
-(*	method increments : classe list = [] *)
-
-(*	method virtual initialize : unit *)
+	    (fun s -> f {Rdf.s; Rdf.p = Rdf.uri_type; Rdf.o = self#name; Rdf.t_opt=None})
       end
 
 
     class virtual functor_data store (name : string) =
       object (self)
 	inherit [Rel.t * Rel.t] data
-	method extension ~(obs : observer) (x : Ext.var) (args : Ext.var array) (src : Ext.var) : Ext.t =
+	method extension ~(obs : observer) (x : Ext.var) (args : Ext.var array) : Ext.t =
 	  let largs = Array.to_list args in
-	  Ext.relation_multi name (largs @ [x;src])
+	  Ext.relation_multi name (largs @ [x])
 	    (fun _ ->
 	      let r1, r2 = self#contents ~obs in
-	      r1, [([x],x::largs@[src],r2)])
+	      r1, [([x],x::largs,r2)])
 	method fold_args : 'a. obs:observer -> ('a -> Name.t list -> 'a) -> 'a -> Name.t -> 'a =
 	  fun ~obs f init n1 -> Common.prof "Store.functor_data#fold_args" (fun () ->
 	    let _, r2 = self#contents ~obs in
 	      let r2_n1 = Rel.assoc (store#get_entity n1) r2 in
 	      Rel.fold
 		(fun res l ->
-		  let rev_args_oid = List.tl (List.rev l) in
-		  let args = List.rev_map store#get_name rev_args_oid in
+		  let args = List.map store#get_name l in
 		  f res args)
 		init r2_n1
 	    with _ -> init)
 
-	method iter : (src:Name.t -> x:Name.t -> args:(Name.t array) -> unit) -> unit =
+	method iter : (Name.t -> (Name.t array) -> unit) -> unit =
 	  fun f -> Common.prof "Store.functor_data#iter" (fun () ->
 	    effect (fun obs ->
 	      let r1, r2 = self#contents ~obs in
 	      Rel.fold
 		(fun _ l ->
-		  match List.rev l with
-		  | src::x::rev_args ->
-		      f
-			~src:(store#get_name src)
-			~x:(store#get_name x)
-			~args:(Array.of_list (List.rev_map store#get_name rev_args))
+		  match l with
+		  | x::args -> f (store#get_name x) (Array.of_list (List.map store#get_name args))
 		  | _ -> assert false)
 		()
-		r1))
+		r2))
       end
 
     class functor_state store arity name =
       object (self)
-	inherit [Rel.t * Rel.t] state (Rel.empty (arity + 2), Rel.empty (arity + 2)) (* 2 for the structure itself and the source *)
+	inherit [Rel.t * Rel.t] state (Rel.empty (arity + 1), Rel.empty (arity + 1)) (* 1 for the structure itself *)
 	inherit functor_data store name
       end
 
 	method virtual arity : int
 	method name = Rdf.URI self#uri
 	method virtual oid : Ext.oid
-	method virtual add : src:Name.t -> Ext.map -> unit
-	method virtual remove : src:Name.t -> Ext.map -> unit
+	method virtual add : Ext.map -> unit
+	method virtual remove : Ext.map -> unit
 	method explicit_relation = 
 	  (new functor_state store self#arity
 	     ("explicit_" ^ self#uri ^ "/" ^ string_of_int self#arity) :> functor_data)
 	method relation = self#explicit_relation
-	method iter_triples (f : src:Name.t -> Rdf.triple -> unit) : unit =
+	method iter_triples (f : Rdf.triple -> unit) : unit =
 	  self#explicit_relation#iter
-	    (fun ~src ~x ~args ->
-	      f ~src {Rdf.s = x; Rdf.p = Term.uri_functor; Rdf.o = self#name; Rdf.t_opt = None};
-	      Array.iteri (fun i arg -> f ~src {Rdf.s = x; Rdf.p = Term.uri_arg (i+1); Rdf.o = arg; Rdf.t_opt = None}) args)
+	    (fun x args ->
+	      f {Rdf.s = x; Rdf.p = Term.uri_functor; Rdf.o = self#name; Rdf.t_opt = None};
+	      Array.iteri (fun i arg -> f {Rdf.s = x; Rdf.p = Term.uri_arg (i+1); Rdf.o = arg; Rdf.t_opt = None}) args)
       end
 
 
 	val mutable inverse_func = Option.get inverse_functional (fun () -> false)
 *)
 
-	method add ~src m = (* returns whether the addition was effective *)
+	method add m = (* returns whether the addition was effective *)
 	  let p = self#oid in
 	  let d_s = store#get_description (List.assoc _s m) in
 	  let d_o = store#get_description (List.assoc _o m) in
 	  let s = d_s#oid in
 	  let o = d_o#oid in
-	  let t = try store#get_entity (List.assoc _t m) with _ -> 0 in
-	  let src = store#get_entity src in
-	  let tup = [s; o; t; src] in
+	  let tup = [s; o] in
 	  store#add_pagelink s o;
 	  store#add_pagelink o s;
 	  store#add_pagelink s p;
 	  d_o#bwd_properties#add p;
 	  explicit_rel#update (fun (r1,r2) ->
 	    if not (Rel.mem tup r1)
-	    then Some (Rel.add tup r1, Rel.add [o; s; t; src] r2)
+	    then Some (Rel.add tup r1, Rel.add [o; s] r2)
 (*
 	    if false && func then
 	      explicit_rel <- Rel.filter_restr [(_s, List.assoc _s m)] [_s; _o; _t; _src] (fun _ -> false) explicit_rel;
 *)
 	    else None)
 	  
-	method remove ~src m =
+	method remove m =
 	  let s = store#get_entity (List.assoc _s m) in
 	  let o = store#get_entity (List.assoc _o m) in
-	  let t = try store#get_entity (List.assoc _t m) with _ -> 0 in
-	  let src = store#get_entity src in
-	  let tup = [s; o; t; src] in
+	  let tup = [s; o] in
 	  explicit_rel#update (fun (r1,r2) ->
 	    if Rel.mem tup r1
-	    then Some (Rel.remove tup r1, Rel.remove [o; s; t; src] r2)
+	    then Some (Rel.remove tup r1, Rel.remove [o; s] r2)
 	    else None)
 
 (*
 	method strict_direct_relation = (strict_direct_view :> property_data)
 	initializer strict_direct_view#define (fun obs -> Common.prof "Store.expr_property#strict_direct_relation" (fun () ->
 	  begin_tag "strictdirext" r;
-	  let ext = self#explicit_relation#extension ~obs _s _o _t _src in
+	  let ext = self#explicit_relation#extension ~obs _s _o in
 	  let ext =
 	    if subproperties
 	    then
 		(fun res -> function
 		  | Rdf.URI uri ->
 		      let sp = store#get_property uri in
-		      Ext.union res (sp#relation#extension ~obs _s _o "" "")
+		      Ext.union res (sp#relation#extension ~obs _s _o)
 		  | _ -> res)
 		ext self#name
 	    else ext in
 	  end_tag "strictdirext" r;
-	  ext#relation2 (store :> Ext.store) _s _o [_t; _src]))
+	  ext#relation2 (store :> Ext.store) _s _o []))
 
 	val strict_view = new property_view store ("strict_" ^ r)
 	method strict_relation = (strict_view :> property_data)
 	    else r12 in
 	  r12))
 
-(*
-	  begin_tag "strictext" r;
-	  let ext = self#strict_direct_relation#extension ~obs _s _o _t _src in
-	  let ext =
-	    if Option.get transitive (fun () -> store#owl_TransitiveProperty#relation#has_instance ~obs self#name)
-	    then
-	      let ext_trans =
-		Ext.transitive
-		  (fun x y -> Ext.relation2 (r ^ "_intern") x y [] (fun _ ->
-		    ext#relation2 (store :> Ext.store) _s _o []))
-		  _s _o in
-	      Ext.union ext ext_trans
-	    else ext in
-(* entails loop
-(*
-	      if r = Name.rdfs_subClassOf then
-		Ext.union ext
-		  (Ext.join ~ordered:true (store#rdfs_Class#extension _s "" "") (Ext.unify _s _o))
-	      else if r = Name.rdfs_subPropertyOf then
-		Ext.union ext
-		  (Ext.join ~ordered:true (store#rdf_Property#extension _s "" "") (Ext.unify _s _o))
-*)
-              if Option.get reflexive (fun () -> store#owl_ReflexiveProperty#relation#has_instance ~obs self#name) then
-		Ext.union ext
-		  (Ext.join ~ordered:true (store#rdfs_Resource#relation#extension ~obs _s "" "") (Ext.unify _s _o))
-	      else ext in
-*)
-	  let ext =
-	    if Option.get symmetric (fun () -> store#owl_SymmetricProperty#relation#has_instance ~obs self#name)
-	    then
-	      let ext_inv = Ext.relation2 (r ^ "_intern") _o _s [_t; _src] (fun _ ->
-		ext#relation2 (store :> Ext.store) _s _o [_t; _src]) in
-	      Ext.union ext ext_inv
-	    else ext in
-(* loops: don't know why: subClassOf -facet-> Class -range/domain-> subClassOf ?? *)
-(*
-	    let ext =
-	      if Option.get transitive (fun () -> store#owl_TransitiveProperty#has_instance ~obs self#name)
-	      then
-		(store#rdfc_self : property)#fold_direct_predecessors ~obs
-		  (fun res (Rdf.URI uri) ->
-		    let cl = store#get_class uri in
-		    (* cl#register (self :> observer);*)
-		    Ext.union res (Ext.join ~ordered:true (cl#relation#extension ~obs _s "" "") (Ext.assign _o _s)))
-		  ext self#name
-	      else ext in
-*)
-	  end_tag "strictext" r;
-	  ext#relation2 (store :> Ext.store) _s _o [_t; _src]))
-*)
-
 	val direct_view = new property_view store ("direct_" ^ r)
 	method direct_relation = (direct_view :> property_data)
 	initializer direct_view#define (fun obs -> Common.prof "Store.expr_property#direct_relation" (fun () ->
 	  begin_tag "dirext" r;
-	  let ext = self#strict_direct_relation#extension ~obs _s _o _t _src in
+	  let ext = self#strict_direct_relation#extension ~obs _s _o in
 	  let ext =
 	    if equivalents
 	    then
 		(fun res -> function
 		  | Rdf.URI uri ->
 		      let p = store#get_property uri in
-		      Ext.union res (p#strict_direct_relation#extension ~obs _o _s "" "")
+		      Ext.union res (p#strict_direct_relation#extension ~obs _o _s)
 		  | _ -> res)
 		ext self#name
 	    else ext in
 	  end_tag "dirext" r;
-	  ext#relation2 (store :> Ext.store) _s _o [_t; _src]))
+	  ext#relation2 (store :> Ext.store) _s _o []))
     
 	val view = new property_view store r
 	method relation = (view :> property_data)
 	initializer view#define (fun obs -> Common.prof "Store.expr_property#relation" (fun () ->
 	  begin_tag "ext" r;
-	  let ext = self#strict_relation#extension ~obs _s _o _t _src in
+	  let ext = self#strict_relation#extension ~obs _s _o in
 	  let ext =
 	    if equivalents
 	    then
 		(fun res -> function
 		  | Rdf.URI uri ->
 		      let p = store#get_property uri in
-		      Ext.union res (p#strict_relation#extension ~obs _o _s "" "")
+		      Ext.union res (p#strict_relation#extension ~obs _o _s)
 		  | _ -> res)
 		ext self#name
 	    else ext in
 	  end_tag "ext" r;
-	  ext#relation2 (store :> Ext.store) _s _o [_t; _src]))
-
-(*
-	method increments : property list =
-	  if subproperties
-	  then
-	    (store#rdfs_subPropertyOf : property)#fold_direct_predecessors
-	      (fun res name ->
-		let sp = store#get_property (Name.as_uri name) in
-		sp :: res)
-	      [] self#name
-	  else []
-*)
-(*
-	method notified_by s =
-	  func <- Option.get functional (fun () -> store#owl_FunctionalProperty#has_instance self#name);
-	  inverse_func <- Option.get inverse_functional (fun () -> store#owl_InverseFunctionalProperty#has_instance self#name);
-*)
+	  ext#relation2 (store :> Ext.store) _s _o []))
       end
 
     class expr_type store =
 
 	method oid : Ext.oid = store#get_entity self#name
 
-	method add ~src m : unit =
+	method add m : unit =
 	  let s = List.assoc _s m in
 	  let o = List.assoc _o m in
 	  match o with
 	  | Rdf.URI uri ->
-	      (store#get_class uri)#add ~src [(_s,s)]
+	      (store#get_class uri)#add [(_s,s)]
 	  | _ -> print_endline "Store.expr_type#add: object is not a URI"
 
-	method remove ~src m : unit =
+	method remove m : unit =
 	  let s = List.assoc _s m in
 	  let o = List.assoc _o m in
 	  match o with
 	  | Rdf.URI uri ->
-	      (store#get_class uri)#remove ~src [(_s,s)]
+	      (store#get_class uri)#remove [(_s,s)]
 	  | _ -> print_endline "Store.expr_type#add: object is not a URI"
 
 	val view = new property_view store "strict_direct_rdf:type"
 		| Rdf.URI uri when not (Name.is_primitive_class uri) ->
 		    let c = store#get_class uri in
 		    (* c#register (self :> observer); *)
-		    Ext.union res (Ext.join (Ext.single _o n) (c#relation#extension ~obs _s _t _src))
+		    Ext.union res (Ext.join (Ext.single _o n) (c#relation#extension ~obs _s))
 		| _ -> res)
 	      Ext.empty in
 	  end_tag "ext" Rdf.uri_type;
-	  ext#relation2 (store :> Ext.store) _s _o [_t; _src]))
+	  ext#relation2 (store :> Ext.store) _s _o []))
       end
 
+(*
     class expr_subject store =
       let r = Rdf.uri_subject in
       object (self)
 	  end_tag "ext" r;
 	  ext#relation1 (store :> Ext.store) _t [_src]))
       end
-
+*)
 
     class expr_class store (r : Uri.t) =
       object (self : 'self)
 
 	val explicit_rel = new class_state store ("explicit_" ^ r)
 	method explicit_relation = (explicit_rel :> class_data)
-(*	val premises : expr subjects = new subjects *)
 
-	method add ~src m = (* returns whether the addition was effective *)
+	method add m = (* returns whether the addition was effective *)
 	  let c = self#oid in
 	  let d_s = store#get_description (List.assoc _s m) in
 	  let s = d_s#oid in
-	  let t = try store#get_entity (List.assoc _t m) with _ -> 0 in
-	  let tup = [s; t; store#get_entity src] in
+	  let tup = [s] in
 	  store#add_pagelink s c;
 	  store#add_pagelink c s;
 	  d_s#classes#add c;
 	    then Some (Rel.add tup rel)
 	    else None)
 
-	method remove ~src m =
-	  let s =store#get_entity (List.assoc _s m) in
-	  let t = try store#get_entity (List.assoc _t m) with _ -> 0 in
-	  let src = store#get_entity src in
-	  let tup = [s; t; src] in
+	method remove m =
+	  let s = store#get_entity (List.assoc _s m) in
+	  let tup = [s] in
 	  explicit_rel#update (fun rel ->
 	    if Rel.mem tup rel
 	    then Some (Rel.remove tup rel)
 	    else None)
 
-(*
-	method add_premise e = premises#add (self :> observer) e
-	method remove_premise e = premises#remove (self :> observer) e
-*)
 	val view = new class_view store r
 	method relation = (view :> class_data)
 	initializer view#define (fun obs -> Common.prof "Store.expr_class#relation" (fun () ->
 	  then explicit_rel#contents ~obs
 	  else begin
 	    begin_tag "ext" r;
-	    let ext = self#explicit_relation#extension ~obs _s _t _src in
+	    let ext = self#explicit_relation#extension ~obs _s in
 	    let ext =
 	      (store#rdfs_subClassOf : property)#direct_relation#fold_predecessors ~obs
 		(fun res -> function
 		  | Rdf.URI uri ->
 		      let sc : classe = store#get_class uri in
-		      Ext.union res (sc#relation#extension _s ~obs "" "")
+		      Ext.union res (sc#relation#extension ~obs _s)
 		  | _ -> res)
 		ext self#name in
 	    let ext =
 		      then res
 		      else
 			let p : property = store#get_property uri in
-			Ext.union res (p#relation#extension _s ~obs "" "" "")
+			Ext.union res (p#relation#extension ~obs _s "")
 		  | _ -> res)
 		ext self#name in
 	    let ext =
 		      then res
 		      else
 			let p : property = store#get_property uri in
-			Ext.union res (p#relation#extension ~obs "" _s "" "")
+			Ext.union res (p#relation#extension ~obs "" _s)
 		  | _ -> res)
 		ext self#name in
 	    end_tag "ext" r;
-	    ext#relation1 (store :> Ext.store) _s [_t; _src]
+	    ext#relation1 (store :> Ext.store) _s []
 	  end))
-
-(*
-	method increments : classe list =
-	  if r = Name.rdfs_Resource
-	  then
-	    let ext =
-	      Ext.minus 
-		(store#rdfs_Class#extension "x" "" "")
-		(store#rdfs_subClassOf#direct_extension "x" "" "" "") in
-	    ext#fold (store :> Ext.store)
-	      (fun res m ->
-		let sc : classe = store#get_class (List.assoc "x" m) in
-		sc :: res)
-	      [] []
-	  else
-	    (store#rdfs_subClassOf : property)#fold_direct_predecessors
-	      (fun res n ->
-		let sc : classe = store#get_class n in
-		sc :: res)
-	      [] self#name
-*)
       end
 
     class expr_functor store (r : Uri.t) (a : int) =
 	val explicit_rel = new functor_state store a ("explicit_" ^ r ^ "/" ^ string_of_int a)
 	method explicit_relation = (explicit_rel :> functor_data)
 
-	method add ~src m =
+	method add m =
 	  let f = self#oid in
 	  let d_x = store#get_description (List.assoc "0" m) in
 	  let x = d_x#oid in
 	    List.map
 	      (fun i -> try store#get_entity (List.assoc (string_of_int (i+1)) m) with _ -> 0)
 	      (Common.list_n self#arity) in
-	  let src = store#get_entity src in
-	  let tup = args @ [x; src] in
+	  let tup = args @ [x] in
 	  store#add_pagelink x f;
 	  store#add_pagelink f x;
 	  List.iter
 	  explicit_rel#update (fun (r1,r2) ->
 	    if not (Rel.mem tup r1)
 	    then begin
-	      let r1', r2' = (Rel.add tup r1, Rel.add (x::args@[src]) r2) in
+	      let r1', r2' = (Rel.add tup r1, Rel.add (x::args) r2) in
 	      Some (r1',r2') end
 	    else None)
 
-	method remove ~src m =
+	method remove m =
 	  let f = self#oid in
 	  let x, args =
 	    match
 		(Common.list_n (self#arity+1)) with
 	    | x::args -> x, args
 	    | [] -> assert false in
-	  let src = store#get_entity src in
-	  let tup = args @ [x; src] in
+	  let tup = args @ [x] in
 	  explicit_rel#update (fun (r1,r2) ->
 	    if not (Rel.mem tup r1)
-	    then Some (Rel.remove tup r1, Rel.remove (x::args@[src]) r2)
+	    then Some (Rel.remove tup r1, Rel.remove (x::args) r2)
 	    else None)
 
 	val view = new functor_view store (r ^ "/" ^ string_of_int a)
 	  let _x = "0" in
 	  let _args = Array.init a (fun i -> string_of_int (i+1)) in
 	  begin_tag "ext" ra;
-	  let ext_explicit = self#explicit_relation#extension ~obs _x _args _src in
+	  let ext_explicit = self#explicit_relation#extension ~obs _x _args in
 	  let ext =
 	    if (store#get_class Term.uri_ImplicitFunctor : classe)#relation#has_instance ~obs self#name
 	    then
 		  (fun res -> function
 		    | Rdf.URI uri_c ->
 			let c : classe = store#get_class uri_c in
-			c#relation#extension ~obs _x "" ""
+			c#relation#extension ~obs _x
 		    | _ -> res)
 		  Ext.one self#name in
 	      let ext_implicit =
 		      (fun res -> function
 			| Rdf.URI uri_pi ->
 			    let p : property = store#get_property uri_pi in
-			    Ext.join res (p#relation#extension ~obs _x _args.(i-1) "" "")
+			    Ext.join res (p#relation#extension ~obs _x _args.(i-1))
 			| _ -> res)
 		      res self#name)
 		  1 a ext_implicit in
 	  end_tag "ext" ra;
 	  let _largs = Array.to_list _args in
 	  match ext#relation_multi (store :> Ext.store)
-	      [ _largs @ [_x; _src];
-		_x :: _largs @ [_src] ] with
+	      [ _largs @ [_x];
+		_x :: _largs ] with
 	  | [r1;r2] -> (r1,r2)
 	  | _ -> assert false))
       end
 
+(*
     class statement store =
       object (self)
 	method uri : Uri.t = store#uri
 
-	method add ~src m : unit =
+	method add m : unit =
 	  let s = List.assoc _s m in
 	  let p = List.assoc _p m in
 	  let o = List.assoc _o m in
-	  (*if p = Name.rdf_type then
-	    (store#get_class (Name.as_uri o) : classe)#add ~src
-	      ((_s,s) :: try [(_t,List.assoc _t m)] with _ -> [])
-	  else*)
-	  if p = Name.rdf_subject then
-	    invalid_arg "Store: add_statement called with rdf:subject"
-	  else if p = Name.rdf_object then
-	    invalid_arg "Store: add_statement called with rdf:object"
-	  else if p = Name.rdf_predicate then
-	    invalid_arg "Store: add_statement called with rdf:predicate"
-	  else
-	    match p with
-	    | Rdf.URI uri_p ->
-		(store#get_property uri_p : property)#add ~src
-		  ((_s,s) :: (_o,o) :: try [(_t,List.assoc _t m)] with _ -> [])
-	    | _ -> invalid_arg "Store: add_statement called with non-URI predicate"
-
-	method remove ~src m : unit =
+	  match p with
+	  | Rdf.URI uri_p ->
+	      (store#get_property uri_p : property)#add [(_s,s); (_o,o)]
+	  | _ -> invalid_arg "Store: add_statement called with non-URI predicate"
+
+	method remove m : unit =
 	  let s = List.assoc _s m in
 	  let p = List.assoc _p m in
 	  let o = List.assoc _o m in
-	  (*if p = Name.rdf_type then
-	    (store#get_class (Name.as_uri o))#remove ~src
-	      ((_s,s) :: try [(_t,List.assoc _t m)] with _ -> [])
-	  else*)
-	  if p = Name.rdf_subject then
-	    invalid_arg "Store: remove_statement called with rdf:subject"
-	  else if p = Name.rdf_object then
-	    invalid_arg "Store: remove_statement called with rdf:object"
-	  else if p = Name.rdf_predicate then
-	    invalid_arg "Store: remove_statement called with rdf:predicate"
-	  else
-	    match p with
-	    | Rdf.URI uri_p ->
-		(store#get_property uri_p)#remove ~src
-		  ((_s,s) :: (_o,o) :: try [(_t,List.assoc _t m)] with _ -> [])
-	    | _ -> invalid_arg "Store: add_statement called with non-URI predicate"
+	  match p with
+	  | Rdf.URI uri_p ->
+	      (store#get_property uri_p)#remove	[(_s,s); (_o,o)]
+	  | _ -> invalid_arg "Store: add_statement called with non-URI predicate"
 
 	val view = (new view : Rel.t view)
-	method raw_extension ~(obs : observer) (s : Ext.var) (p : Ext.var) (o : Ext.var) (t : Ext.var) (src : Ext.var) : Ext.t =
+	method raw_extension ~(obs : observer) (s : Ext.var) (p : Ext.var) (o : Ext.var) : Ext.t =
 	  Common.prof "Store.statement#raw_extension" (fun () ->
 	    Ext.relation1 "statement" t [s; p; o; src] (fun _ ->
 	      view#contents ~obs))
 	    ~from_property:(fun pp -> (store#get_property pp)#relation#extension ~obs)
 	    ~from_statement:(fun s p o t src -> self#raw_extension ~obs s p o t src)
       end
-
+*)
 
     let rec rel_predicate ~obs store pred rel tup pred_args tup_has_new_elem = function
       | [] ->
 	    
 	method add (store : 'store) (p : 'a) : unit =
 	  let r = p#uri in
-	  (store#get_class c)#add ~src:store#name [(_s, Rdf.URI r)]; (* r is a c *)
+	  (store#get_class c)#add [(_s, Rdf.URI r)]; (* r is a c *)
 	  Hashtbl.replace h r p
       end
 
     class page (oid : Ext.oid) =
       object
 	val mutable rank = 1.
-	val mutable succs : Intset.t = Intset.empty
 	val mutable preds : Intset.t = Intset.empty
+	val mutable succs : Intset.t = Intset.empty
+	val mutable nb_succs : int option = None
 
 	method rank = rank
 	method preds = preds
 	method succs = succs
 	method set_rank r = rank <- r
 	method add_pred o = preds <- Intset.add o preds
-	method add_succ o = succs <- Intset.add o succs
+	method add_succ o = succs <- Intset.add o succs; nb_succs <- None
+
+	method nb_succs =
+	  match nb_succs with
+	  | Some n -> n
+	  | None ->
+	      let n = Intset.cardinal succs in
+	      nb_succs <- Some n;
+	      n
       end
 
     (* descriptions *)
 	val h_class : (Uri.t, classe) Hashtbl.t = Hashtbl.create 101
 	val h_property : (Uri.t, property) Hashtbl.t = Hashtbl.create 71
 	val h_functor : (Uri.t * int, funct) Hashtbl.t = Hashtbl.create 53
-	val h_statement : (unit, statement) Hashtbl.t = Hashtbl.create 1
+(*	val h_statement : (unit, statement) Hashtbl.t = Hashtbl.create 1 *)
 	val h_predicate : (Uri.t, predicate) Hashtbl.t = Hashtbl.create 13
 	val h_page : (Ext.oid, page) Hashtbl.t = Hashtbl.create 1003
 
 	  fun f ->
 	    Hashtbl.iter f h_predicate
 
-	method iter_triples : (src:Name.t -> Rdf.triple -> unit) -> unit =
+	method iter_triples : (Rdf.triple -> unit) -> unit =
 	  fun f -> Common.prof "Store.store#iter_triples" (fun () ->
-	    self#iter_classes (fun uri cc -> cc#iter_triples f);
+	    self#iter_classes (fun uri cc -> if not (List.mem uri [Rdfs.uri_Resource; Rdfs.uri_Literal]) then cc#iter_triples f);
 	    self#iter_properties (fun uri pp -> pp#iter_triples f);
 	    self#iter_functors (fun (uri,arity) ff -> ff#iter_triples f))
 
 	  let oid = self#alloc_oid in
 	  let name = Name.of_oid oid in
 	  Hashtbl.add h_page oid (new page oid);
-	  self#rdfs_Resource#add ~src:self#name [(_s,name)];
+	  self#rdfs_Resource#add [(_s,name)];
 	  name)
 
 	method private make_name r : unit =
 	  | Rdf.URI uri -> ()
 (*
 	      let r_uri = Rdf.Literal (uri, Rdf.Typed Xsd.uri_anyURI) in
-	      self#xml_uri#add ~src:self#name [(_s,r); (_o,r_uri)]
+	      self#xml_uri#add [(_s,r); (_o,r_uri)]
 *)
 	  | Rdf.Blank s -> ()
 	  | Rdf.Literal (s, dt) ->
-	      self#rdfs_Literal#add ~src:self#name [(_s,r)];
+	      self#rdfs_Literal#add [(_s,r)];
 	      ( match dt with
 	      | Rdf.Plain "" -> ()
 	      | Rdf.Plain lang -> ()
 (*
 		  let r_lang = Rdf.Literal (lang, Rdf.Typed Xsd.uri_language) in
-		  self#xml_lang#add ~src:self#name [(_s,r); (_o,r_lang)]
+		  self#xml_lang#add [(_s,r); (_o,r_lang)]
 *)
 	      | Rdf.Typed uri ->
 		  let cl_datatype = self#get_class uri in
-		  self#rdfs_Datatype#add ~src:self#name [(_s, Rdf.URI uri)];
-		  cl_datatype#add ~src:self#name [(_s,r)]);
+		  self#rdfs_Datatype#add [(_s, Rdf.URI uri)];
+		  cl_datatype#add [(_s,r)]);
 	      store_integer#add r;
 	      store_integer#add r;
 	      store_date#add r;
 	      store_time#add r;
 	      store_match#add r
 	  | Rdf.XMLLiteral xml ->
-	      self#rdf_XMLLiteral#add ~src:self#name [(_s,r)]
+	      self#rdf_XMLLiteral#add [(_s,r)]
 
 	method has_name (name : Name.t) : bool =
 	  Hashtbl.mem h_description name
 		Hashtbl.add h_name oid name;
 		Hashtbl.add h_description name descr;
 		Hashtbl.add h_page oid (new page oid);
-		self#rdfs_Resource#add ~src:self#name [(_s,name)];
+		self#rdfs_Resource#add [(_s,name)];
 		self#make_name name;
 (*
-	    if Name.is_literal r then self#rdfs_Literal#add ~src:self#name [(_s,oid)];
-	    if Name.is_xmlliteral r then self#rdf_XMLLiteral#add ~src:self#name [(_s,oid)];
+	    if Name.is_literal r then self#rdfs_Literal#add [(_s,oid)];
+	    if Name.is_xmlliteral r then self#rdf_XMLLiteral#add [(_s,oid)];
 *)
 		descr)
 
 	method get_class_prim (r : Uri.t) (fc : unit -> classe) : classe =
 	  try Hashtbl.find h_class r
 	  with Not_found ->
-(*
-	    let _oid =
-	      try Hashtbl.find h_entity r
-	      with Not_found ->
-		let oid = self#alloc_oid in
-		Hashtbl.add h_name oid r;
-		Hashtbl.add h_entity r oid;
-		oid in
-*)
 	    let c = fc () in
 	    Hashtbl.add h_class r (c :> classe);
 (*
-	    self#rdfs_Resource#add ~src:self#name [(_s,r)]; (* r is a Resource *)
+	    self#rdfs_Resource#add [(_s,r)]; (* r is a Resource *)
 *)
-	    self#rdfs_Class#add ~src:self#name [(_s,c#name)]; (* r is a Class *)
+	    self#rdfs_Class#add [(_s,c#name)]; (* r is a Class *)
 	    self#make_name c#name;
 (*
-	    (self#get_property Name.rdfs_subClassOf)#add ~src:oid_system [("s",o); ("o",self#get_entity Name.rdfs_Resource)];
+	    (self#get_property Name.rdfs_subClassOf)#add [("s",o); ("o",self#get_entity Name.rdfs_Resource)];
 *) (* commented to avoid noise in extension of subClassOf *)
 	    c
 
 	method xsd_string = self#get_class Xsd.uri_string
 	method xsd_integer = self#get_class Xsd.uri_integer
 	method rdf_Property = self#get_class Rdf.uri_Property
-	method rdf_Statement = self#get_class_prim Rdf.uri_Statement (fun () -> (new expr_Statement self :> classe))
+(*	method rdf_Statement = self#get_class_prim Rdf.uri_Statement (fun () -> (new expr_Statement self :> classe)) *)
+	method rdf_Statement = self#get_class Rdf.uri_Statement
 	method rdf_XMLLiteral = self#get_class Rdf.uri_XMLLiteral
 	method rdf_Bag = self#get_class Rdf.uri_Bag
 	method rdf_Seq = self#get_class Rdf.uri_Seq
 	method private get_property_prim (r : Uri.t) (fp : unit -> property) (proc : Uri.t -> unit) : property =
 	  try Hashtbl.find h_property r
 	  with Not_found ->
-(*
-	    let _oid =
-	      try Hashtbl.find h_entity r
-	      with Not_found ->
-		let oid = self#alloc_oid in
-		Hashtbl.add h_name oid r;
-		Hashtbl.add h_entity r oid;
-		oid in
-*)
 	    let p = fp () in
 	    Hashtbl.add h_property r p;
 (*
-	    self#rdfs_Resource#add ~src:self#name [(_s,r)];
+	    self#rdfs_Resource#add [(_s,r)];
 *)
-	    self#rdf_Property#add ~src:self#name [(_s,p#name)];
+	    self#rdf_Property#add [(_s,p#name)];
 	    self#make_name p#name;
 	    proc r;
 	    p
 		 self r :> property))
 	    (fun r ->
 	      let n = Rdf.URI r in
-	      self#rdfs_ContainerMembershipProperty#add ~src:self#name [(_s,n)];
-	      self#rdfs_domain#add ~src:self#name [(_s,n); (_o, Name.rdfs_Container)];
+	      self#rdfs_ContainerMembershipProperty#add [(_s,n)];
+	      self#rdfs_domain#add [(_s,n); (_o, Name.rdfs_Container)];
 	      ())
 
 (* replaced by functions
 	    ~transitive:false ~reflexive:false ~symmetric:false ~functional:true ~inverse_functional:false
 	    Name.xml_lang
 *)
+(*
 	method rdf_subject = self#get_property_prim
 	    Rdf.uri_subject
 	    (fun () -> (new expr_subject self :> property)) (fun r -> ())
 	method rdf_predicate = self#get_property_prim
 	    Rdf.uri_predicate
 	    (fun () -> (new expr_predicate self :> property)) (fun r -> ())
+*)
 	method rdf_type = self#get_property_prim
 	    Rdf.uri_type 
 	    (fun () -> (new expr_type self :> property)) (fun r -> ())
+	method rdf_subject = self#get_property_aux
+	    ~subproperties:false ~equivalents:false
+	    ~transitive:false ~reflexive:false ~symmetric:false ~functional:true ~inverse_functional:false
+	    Rdf.uri_subject
+	method rdf_predicate = self#get_property_aux
+	    ~subproperties:false ~equivalents:false
+	    ~transitive:false ~reflexive:false ~symmetric:false ~functional:true ~inverse_functional:false
+	    Rdf.uri_predicate
+	method rdf_object = self#get_property_aux
+	    ~subproperties:false ~equivalents:false
+	    ~transitive:false ~reflexive:false ~symmetric:false ~functional:true ~inverse_functional:false
+	    Rdf.uri_object
 	method rdf_first = self#get_property_aux
 	    ~subproperties:false ~equivalents:false
 	    ~transitive:false ~reflexive:false ~symmetric:false ~functional:true ~inverse_functional:false
 	    with Not_found ->
 	      let f = (new expr_functor self r a :> funct) in
 	      Hashtbl.add h_functor (r,a) f;
-	      (self#get_class Term.uri_Functor)#add ~src:self#name [(_s,f#name)];
+	      (self#get_class Term.uri_Functor)#add [(_s,f#name)];
 	      self#make_name f#name;
 	      f)
 
+(*
 	method get_statement =
 	  try Hashtbl.find h_statement ()
 	  with Not_found ->
 	    let stmt = new statement self in
 	    Hashtbl.add h_statement () stmt;
 	    stmt
+*)
 
-	method add_triple : src:Name.t -> Name.t -> Uri.t -> Name.t -> unit =
-	  fun ~src s p o ->
-	    (self#get_property p)#add ~src [(_s,s); (_o,o)]
+	method add_triple : Name.t -> Uri.t -> Name.t -> unit =
+	  fun s p o ->
+	    (self#get_property p)#add [(_s,s); (_o,o)]
 
 	method get_property : Uri.t -> property =
 	  fun r -> Common.prof "Store.store#get_property" (fun () ->
 print_endline ("get_predicate :" ^ pred#uri);
 	      let pr = (new prim_predicate self pred :> predicate) in
 	      Hashtbl.add h_predicate pred#uri pr;
-	      self#lisprim_Predicate#add ~src:self#name [(_s,pr#name)];
+	      self#lisprim_Predicate#add [(_s,pr#name)];
 	      self#make_name pr#name;
 	      pr)
 
 
         (* Import functions *)
 
-	method import_triples ~src triples = Common.prof "Store.store#import_triples" (fun () ->
+	method import_triples triples = Common.prof "Store.store#import_triples" (fun () ->
 	  let open Rdf in
 	  let norm =
 	    let h = Hashtbl.create 13 in
 		  end
 	      | n -> n
 	  in
+	  let cpt = ref 0 in
 	  List.iter
 	    (fun {s; p; o; t_opt} ->
-	      (self#get_property p)#add ~src:(URI src) ((_s, norm s) :: (_o, norm o) :: Option.fold (fun t -> (_t, norm t)::[]) [] t_opt))
+	      incr cpt;
+	      if !cpt mod 100000 = 0 then begin prerr_int !cpt; prerr_endline " triples loaded" end;
+	      match t_opt with
+	      | None ->
+		  (self#get_property p)#add [(_s, norm s); (_o, norm o)]
+	      | Some t ->
+		  (self#get_property Rdf.uri_subject)#add [(_s, norm t); (_o, norm s)];
+		  (self#get_property Rdf.uri_predicate)#add [(_s, norm t); (_o, norm (Rdf.URI p))];
+		  (self#get_property Rdf.uri_object)#add [(_s, norm t); (_o, norm o)])
 	    triples)
 
-	method import_rdf_xml ~src ~base (rdf_file : string) : unit =
-	  print_endline "Parsing RDF/XML...";
-	  let xml = Xml.parse_file rdf_file in
-	  let rdf = Rdf.from_xml base xml in
-	  let triples = Rdf.triples_of_rdf rdf in
-	  print_endline "Importing RDF...";
-	  self#import_triples ~src triples
-
-	method import_ntriples ~src (nt_file : string) : unit =
-	  let triples = Ntriples.parse_file nt_file in
-	  self#import_triples ~src triples
-
-	method import_turtle ~src ~base (ttl_file : string) : unit =
-	  let turtle = Turtle.parse_file ttl_file in
-	  let triples = Turtle.triples_of_turtle base turtle in
-	  self#import_triples ~src triples
-
-	method import_rdf_file ~src ~base (filename : string) : unit = Common.prof "Store.store#import_rdf_file" (fun () ->
-	  if
-	    Filename.check_suffix filename ".rdf" ||
-	    Filename.check_suffix filename ".owl" ||
-	    Filename.check_suffix filename ".xml"
-	  then
-	    self#import_rdf_xml ~src ~base filename
-	  else if Filename.check_suffix filename ".nt" then
-	    self#import_ntriples ~src filename
-	  else if Filename.check_suffix filename ".ttl" then
-	    self#import_turtle ~src ~base filename
-	  else invalid_arg "Store.store#import_rdf_file: unrecognized format");
-	  self#pagerank_iterations 5
+	method import_rdf_xml ~base (rdf_file : string) : unit =
+	  Common.prof "Store.store#import_rdf_xml" (fun () ->
+	    try
+	      print_endline "Parsing RDF/XML...";
+	      let xml = Xml.parse_file rdf_file in
+	      let rdf = Rdf.from_xml base xml in
+	      let triples = Rdf.triples_of_rdf rdf in
+	      print_endline "Importing RDF...";
+	      self#import_triples triples
+	    with
+	    | Xml.Error e -> prerr_endline (Xml.error e)
+	    | Dtd.Parse_error e -> prerr_endline (Dtd.parse_error e)
+	    | Dtd.Check_error e -> prerr_endline (Dtd.check_error e)
+	    | Dtd.Prove_error e -> prerr_endline (Dtd.prove_error e))
+
+	method import_ntriples (nt_file : string) : unit =
+	  Common.prof "Store.store#import_ntriples" (fun () ->
+	    let triples = Ntriples.parse_file nt_file in
+	    self#import_triples triples)
+
+	method import_turtle ~base (ttl_file : string) : unit =
+	  Common.prof "Store.store#import_turtle" (fun () ->
+	    let turtle = Turtle.parse_file ttl_file in
+	    let triples = Turtle.triples_of_turtle base turtle in
+	    self#import_triples triples)
+
+	method import_rdf_file ~base (filename : string) : unit =
+	  Common.prof "Store.store#import_rdf_file" (fun () ->
+	    if
+	      Filename.check_suffix filename ".rdf" ||
+	      Filename.check_suffix filename ".owl" ||
+	      Filename.check_suffix filename ".xml"
+	    then
+	      self#import_rdf_xml ~base filename
+	    else if Filename.check_suffix filename ".nt" then
+	      self#import_ntriples filename
+	    else if Filename.check_suffix filename ".ttl" then
+	      self#import_turtle ~base filename
+	    else invalid_arg "Store.store#import_rdf_file: unrecognized format";
+	    self#pagerank_iterations 5)
 
         (* Export functions *)
 
-	method export_triples ~src:query output_triple =
-	  self#iter_triples
-	    (fun ~src triple ->
-	      if src = Rdf.URI query && triple.Rdf.t_opt = None
-	      then output_triple triple)
+	method export_triples output_triple =
+	  self#iter_triples output_triple
 	  
-	method export_ntriples ~src nt_file =
+	method export_ntriples nt_file =
 	  let out = open_out nt_file in
-	  self#export_triples ~src
+	  self#export_triples
 	    (fun triple -> Ntriples.output out [triple]);
 	  close_out out
 
-	method export_turtle ~src ~base ~xmlns ttl_file =
+	method export_turtle ~base ~xmlns ttl_file =
 	  let out = open_out ttl_file in
 	  Turtle.output out
 	    (List.map
 	       (fun (pre,uri) -> Turtle.Prefix (pre, Turtle.Absolute uri))
 	       xmlns);
-	  self#export_triples ~src
+	  self#export_triples
 	    (fun triple -> Turtle.output out [Turtle.turtle_of_triple base xmlns triple]);
 	  close_out out
 
-	method export_rdf_file ~(src : Uri.t) ~(base : Uri.t) ~(xmlns : Rdf.xmlns) (filename : string) : unit =
+	method export_rdf_file ~(base : Uri.t) ~(xmlns : Rdf.xmlns) (filename : string) : unit =
 	  if Filename.check_suffix filename ".nt" then
-	    self#export_ntriples ~src filename
+	    self#export_ntriples filename
 	  else if Filename.check_suffix filename ".ttl" then
-	    self#export_turtle ~src ~base ~xmlns filename
+	    self#export_turtle ~base ~xmlns filename
 	  else invalid_arg "Store.store#export_rdf_file: unsupported format"
 
         (* PageRank *)
 	  px#add_succ y;
 	  py#add_pred x
 
-	method pagerank_iterations n =
+	method pagerank_iterations n = Common.prof "Store.store#pagerank_iterations" (fun () ->
 	  print_endline "Performing PageRank iterations";
 	  for i = 1 to n do
 	    Hashtbl.iter
 		  Intset.fold
 		    (fun res pred ->
 		      let page_pred = self#get_page pred in
-		      res +. page_pred#rank /. float (Intset.cardinal page_pred#succs))
+		      res +. page_pred#rank /. float page_pred#nb_succs)
 		    0.
 		    page#preds in
 		page#set_rank (0.15 +. 0.85 *. sum))
 	      h_page
-	  done
+	  done)
 
 
-	method init =
-	  
+	method init =	  
 print_endline "Creating core properties and classes...";
 	  let res = self#rdfs_Resource in
 	  let lit = self#rdfs_Literal in
 	  let prim_proc = self#lisprim_Procedure in
 	  let prim_aggreg = self#lisprim_Aggregator in
 print_endline "Asserting primitive axioms...";
-	  let axiom_type inst cl : unit = cl#add ~src:self#name [(_s,inst#name)] in
-	  let axiom subj prop obj : unit = prop#add ~src:self#name [(_s,subj#name); (_o,obj#name)] in
+	  let axiom_type inst cl : unit = cl#add [(_s,inst#name)] in
+	  let axiom subj prop obj : unit = prop#add [(_s,subj#name); (_o,obj#name)] in
 
 	  axiom_type dt_uri data; (* xsd:uri is a rdfs:Datatype *)
 	  axiom_type dt_lang data; (* xsd:lang is a rdfs:Datatype *)
           axiom cl slf sub_cl; (* rdfs:Class has rdfc:self rdfs:subClassOf *)
 *)
 
-	  list#add ~src:self#name [(_s, Rdf.URI Rdf.uri_nil)]; (* rdf:nil is a rdf:List *)
+	  list#add [(_s, Rdf.URI Rdf.uri_nil)]; (* rdf:nil is a rdf:List *)
 
           ignore (self#get_predicate Prim.leq);
           ignore (self#get_predicate Prim.geq);