Sébastien Ferré avatar Sébastien Ferré committed 10f4080

When defining labels, only remove existing labels when they exist.

Comments (0)

Files changed (1)

   | Some focus_foc when same_focus focus_foc foc -> true
   | _ -> false
 
-
 let get_object_as_string ~obs store s p : string option =
   try match store#get_objects ~obs s p with
   | Rdf.Literal (str, (Rdf.Plain ("" | "en") | Rdf.Typed _)) :: _ -> Some str
 	self#tell ~src a)
 
     method set_value ~src (s : Name.t) (p : Uri.t) (o : Name.t) : unit = (* for functional properties *)
-      Common.prof "Lisql.store#set_value" (fun () -> (* TODO: optimize by direct access to store#rdfs_label ? *)
-	let remove_previous_values =
-	  name_is
-	    s
-	    (Not (Role (RAtom (Fwd, p), exists (Var "X")))) in
-(*
-   let remove_previous_subject = NameIs
-   (o,
-   Not (Role (RAtom (Bwd, p), Var "X"))) in
- *)
+      Common.prof "Lisql.store#set_value" (fun () ->
+	List.iter
+	  (fun prev_o ->
+	    let remove_previous_value = name_is s (Not (prop_name p prev_o)) in
+	    self#tell ~src remove_previous_value)
+	  (self#get_objects ~obs:Tarpit.blind_observer s p);
 	let add_new_value = name_is s (prop_name p o) in
-	self#tell ~src remove_previous_values;
-(*	    self#tell ~src remove_previous_subject; *)
 	self#tell ~src add_new_value)
 
     method set_label ~src (uri : Uri.t) (label : string) : unit =
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.