gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] fenfire/org/fenfire/modules/pp PPActionsImpl.ja...


From: Matti Katila
Subject: [Gzz-commits] fenfire/org/fenfire/modules/pp PPActionsImpl.ja...
Date: Sat, 08 Mar 2003 20:35:37 -0500

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Matti Katila <address@hidden>   03/03/08 20:35:37

Modified files:
        org/fenfire/modules/pp: PPActionsImpl.java PPVocab.java 

Log message:
        implement delete, jena seems to be ugly..

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPActionsImpl.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPVocab.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/modules/pp/PPActionsImpl.java
diff -u fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.7 
fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.8
--- fenfire/org/fenfire/modules/pp/PPActionsImpl.java:1.7       Sat Mar  8 
20:28:20 2003
+++ fenfire/org/fenfire/modules/pp/PPActionsImpl.java   Sat Mar  8 20:35:37 2003
@@ -12,7 +12,7 @@
 /** The implementation of PPActions.
  */
 public class PPActionsImpl extends UnicastRemoteObject implements PPActions {
-public static final String rcsid = "$Id: PPActionsImpl.java,v 1.7 2003/03/09 
01:28:20 mudyc Exp $";
+public static final String rcsid = "$Id: PPActionsImpl.java,v 1.8 2003/03/09 
01:35:37 mudyc Exp $";
     public static final boolean dbg = true;
     protected static void p(String s) { if(dbg) pa(s); }
     protected static void pa(String s) { System.out.println(s); }
@@ -303,15 +303,42 @@
 
 
     public void deleteText(String noteURI, int begin, int end)
-       throws RemoteException { synchronized(model) {
+       throws RemoteException 
+    { synchronized(model) { try {
            /*
        Cell note = space.getCell(noteId);
        note.deleteText(begin, end);
            */
 
-       // not implemented
-       // ===============
+       Resource note = model.getResource(noteURI);
+       
+       // find actual data
+       Selector s = 
+           new SelectorImpl(note, PP.LinkToContentRef, (RDFNode) null);
+       StmtIterator iter = model.listStatements(s);
+       Statement stmt = null;
+       while (iter.hasNext()) {
+           if (stmt != null) throw new Error("Too many data!!");
+           stmt = iter.next();
+       }
 
+       Resource data = (Resource) stmt.getObject();
 
-    }}
+       // find literal
+       s = new SelectorImpl(data, PP.Data, (RDFNode) null);
+       iter = model.listStatements(s);
+       stmt = null;
+       while (iter.hasNext()) {
+           if (stmt != null) throw new Error("Too many data!!");
+           stmt = iter.next();
+       }
+
+       StringBuffer str = new StringBuffer(stmt.getObject().toString());
+       model.remove(stmt);
+       str.delete(begin, end);
+       data.addProperty(PP.Data, str.toString());
+
+    } catch (RDFException e) {
+       pa("Fault inserting text to note: "+e);
+    }}}
 }
Index: fenfire/org/fenfire/modules/pp/PPVocab.java
diff -u fenfire/org/fenfire/modules/pp/PPVocab.java:1.3 
fenfire/org/fenfire/modules/pp/PPVocab.java:1.4
--- fenfire/org/fenfire/modules/pp/PPVocab.java:1.3     Sat Mar  8 20:28:20 2003
+++ fenfire/org/fenfire/modules/pp/PPVocab.java Sat Mar  8 20:35:37 2003
@@ -5,7 +5,7 @@
 import com.hp.hpl.mesa.rdf.jena.common.*;
 
 public class PPVocab {
-public static final String rcsid = "$Id: PPVocab.java,v 1.3 2003/03/09 
01:28:20 mudyc Exp $";
+public static final String rcsid = "$Id: PPVocab.java,v 1.4 2003/03/09 
01:35:37 mudyc Exp $";
     public static final boolean dbg = true;
     protected static void p(String s) { if(dbg) pa(s); }
     protected static void pa(String s) { System.out.println(s); }
@@ -41,14 +41,12 @@
                new PropertyImpl(pp_voc + "#linkToContentReference");
            Data = new PropertyImpl(pp_voc + "#realData");
 
-
-
            // Resources
            PaperType = new ResourceImpl(pp_voc + "#paperType");
            Note = new ResourceImpl(pp_voc + "#note");
            DataType = new ResourceImpl(pp_voc + "#dataType");
        } catch (RDFException e) {
-           p("Failed: "+e);
+           p("Failed: PP vocabulary "+e);
        }
     }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]