Index: src/main/java/de/mpiwg/itgroup/annotations/Person.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/Person.java	(revision 15)
+++ src/main/java/de/mpiwg/itgroup/annotations/Person.java	(revision 32)
@@ -3,4 +3,6 @@
  */
 package de.mpiwg.itgroup.annotations;
+
+import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
 
 /**
@@ -55,3 +57,16 @@
         return null;
     }
+
+    /**
+     * Sets the name from the id using getFullNameFromLdap of the Application.
+     *  
+     * @param application
+     * @return
+     */
+    public String updateName(BaseRestlet application) {
+        if (id != null) {
+            name = application.getFullNameFromLdap(id);
+        }
+        return name;
+    }
 }
Index: src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java	(revision 31)
+++ src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java	(revision 32)
@@ -5,4 +5,5 @@
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Calendar;
 import java.util.HashSet;
@@ -28,4 +29,6 @@
 
 /**
+ * Neo4J based Annotation store.
+ * 
  * @author casties
  * 
@@ -40,4 +43,7 @@
         ANNOTATION, PERSON, TARGET, GROUP, TAG
     }
+
+    // types of nodes that should not be automatically deleted.
+    public Set<String> permanentNodeTypes = new HashSet<String>(Arrays.asList("PERSON", "GROUP", "TAG"));
 
     protected List<Index<Node>> nodeIndexes;
@@ -85,6 +91,4 @@
     }
 
-    
-    
     public List<Actor> getActors(String key, String query, NodeTypes type) {
         ArrayList<Actor> actors = new ArrayList<Actor>();
@@ -103,6 +107,5 @@
 
     /**
-     * Returns List of Groups.
-     * Key has to be indexed.
+     * Returns List of Groups. Key has to be indexed.
      * 
      * @param key
@@ -124,34 +127,7 @@
         return groups;
     }
-    
-    
-    /**
-     * Returns List of Annotations.
-     * Key has to be indexed.
-     * 
-     * @param key
-     * @param query
-     * @return
-     */
-    public List<Annotation> getAnnotations(String key, String query) {
-        ArrayList<Annotation> annotations = new ArrayList<Annotation>();
-        Index<Node> idx = getNodeIndex(NodeTypes.ANNOTATION);
-        if (key == null) {
-            key = "id";
-            query = "*";
-        }
-        IndexHits<Node> annotNodes = idx.query(key, query);
-        for (Node annotNode : annotNodes) {
-            Annotation annotation = createAnnotationFromNode(annotNode);
-            annotations.add(annotation);
-        }
-        return annotations;
-    }
-
- 
-    
-    /**
-     * Returns List of Tags.
-     * Key has to be indexed.
+
+    /**
+     * Returns List of Tags. Key has to be indexed.
      * 
      * @param key
@@ -174,6 +150,5 @@
     }
 
- 
-   /**
+    /**
      * Returns List of Groups the person is member of.
      * 
@@ -240,5 +215,5 @@
         return members;
     }
-    
+
     /**
      * Add Person newMember to Group group.
@@ -257,5 +232,5 @@
         return addedMember;
     }
-    
+
     /**
      * Delete Person oldMember from Group group.
@@ -266,15 +241,22 @@
     public void deleteGroupMember(Group group, Person member) {
         Node gn = getActorNode(group);
+        Node pn = getActorNode(member);
         Iterable<Relationship> rels = gn.getRelationships(RelationTypes.MEMBER_OF);
         for (Relationship rel : rels) {
             Node mn = rel.getStartNode();
-            if (mn.equals(member)) {
-                rel.delete();
+            if (mn.equals(pn)) {
+                Transaction tx = graphDb.beginTx();
+                try {
+                    rel.delete();
+                    tx.success();
+                } finally {
+                    tx.finish();
+                }
                 // there should be only one
                 break;
             }
-        }        
-    }
-    
+        }
+    }
+
     /**
      * Returns the stored Actor matching the given one.
@@ -284,11 +266,12 @@
      */
     public Actor getActor(Actor actor) {
-    	Node actorNode = getActorNode(actor);
-    	Actor storedActor = createActorFromNode(actorNode);
-    	return storedActor;
-    }
-    
-    /**
-     * Stores an Actor (Person or Group). Creates a new actor Node or returns an existing one.
+        Node actorNode = getActorNode(actor);
+        Actor storedActor = createActorFromNode(actorNode);
+        return storedActor;
+    }
+
+    /**
+     * Stores an Actor (Person or Group). Creates a new actor Node or update an
+     * existing one.
      * 
      * @param actor
@@ -296,9 +279,64 @@
      */
     public Actor storeActor(Actor actor) {
-    	Node actorNode = getOrCreateActorNode(actor);
-    	Actor storedActor = createActorFromNode(actorNode);
-    	return storedActor;
-    }
-    
+        Node actorNode = getOrCreateActorNode(actor);
+        Transaction tx = graphDb.beginTx();
+        try {
+            // id
+            String id = actor.getId();
+            if (id != null) {
+                actorNode.setProperty("id", id);
+            }
+            // name
+            String name = actor.getName();
+            if (name != null) {
+                actorNode.setProperty("name", name);
+            }
+            // uri
+            String uri = actor.getUri();
+            if (uri != null) {
+                actorNode.setProperty("uri", uri);
+            }
+            tx.success();
+        } finally {
+            tx.finish();
+        }
+        Actor storedActor = createActorFromNode(actorNode);
+        return storedActor;
+    }
+
+    /**
+     * Deletes the given Actor.
+     * 
+     * @param actor
+     */
+    public void deleteActor(Actor actor) {
+        String uri = actor.getUriString();
+        Index<Node> idx;
+        if (actor.isGroup()) {
+            idx = getNodeIndex(NodeTypes.GROUP);
+        } else {
+            idx = getNodeIndex(NodeTypes.PERSON);
+        }
+        Node actorNode = idx.get("uri", uri).getSingle();
+        if (actorNode != null) {
+            // delete relations
+            Transaction tx = graphDb.beginTx();
+            try {
+                for (Relationship rel : actorNode.getRelationships()) {
+                    rel.delete();
+                }
+                if (!actorNode.hasRelationship()) {
+                    // this shouldn't happen
+                    deleteNode(actorNode);
+                } else {
+                    logger.error("deleteActor: unable to delete: Node still has relations.");
+                }
+                tx.success();
+            } finally {
+                tx.finish();
+            }
+        }
+    }
+
     /**
      * Returns the Annotation with the given id.
@@ -403,4 +441,5 @@
      */
     protected Actor createActorFromNode(Node actorNode) {
+        if (actorNode == null) return null;
         String id = (String) actorNode.getProperty("id", null);
         String uri = (String) actorNode.getProperty("uri", null);
@@ -414,14 +453,14 @@
         return null;
     }
-    
+
     public Tag createTagFromNode(Node tagNode) {
-    	String name = (String) tagNode.getProperty("name", null);
-    	String uri = (String) tagNode.getProperty("uri", null);
-    	String id = (String) tagNode.getProperty("id", null);
-    	
-    	return new Tag(id, uri, name);
-		
-	}
-
+        if (tagNode == null) return null;
+        String name = (String) tagNode.getProperty("name", null);
+        String uri = (String) tagNode.getProperty("uri", null);
+        String id = (String) tagNode.getProperty("id", null);
+
+        return new Tag(id, uri, name);
+
+    }
 
     /**
@@ -539,5 +578,5 @@
                         for (String tag : newTags) {
                             // create new tag
-                            Node tagNode = getOrCreateTagNode(new Tag(null,null,tag));
+                            Node tagNode = getOrCreateTagNode(new Tag(null, null, tag));
                             getOrCreateRelation(annotNode, RelationTypes.HAS_TAG, tagNode);
                         }
@@ -561,5 +600,5 @@
      * @param id
      */
-    public void deleteById(String id) {
+    public void deleteAnnotationById(String id) {
         Node annotNode = getNodeIndex(NodeTypes.ANNOTATION).get("id", id).getSingle();
         if (annotNode != null) {
@@ -569,8 +608,8 @@
                 for (Relationship rel : annotNode.getRelationships()) {
                     // delete relation and the related node if it has no other
-                    // relations
+                    // relations and is not permanent
                     Node other = rel.getOtherNode(annotNode);
                     rel.delete();
-                    if (!other.hasRelationship()) {
+                    if (!(other.hasRelationship() || permanentNodeTypes.contains(other.getProperty("TYPE", null)))) {
                         deleteNode(other);
                     }
@@ -597,5 +636,5 @@
      * @return
      */
-    public List<Annotation> searchByUriUser(String targetUri, String userUri, String limit, String offset) {
+    public List<Annotation> searchAnnotationByUriUser(String targetUri, String userUri, String limit, String offset) {
         List<Annotation> annotations = new ArrayList<Annotation>();
         if (targetUri != null) {
@@ -720,5 +759,5 @@
         return person;
     }
-    
+
     protected Node getOrCreateActorNode(Actor actor) {
         // Person/Group is identified by URI or id
@@ -773,9 +812,9 @@
                 tag.setProperty("name", tagname);
                 idx.add(tag, "name", tagname);
-                
+
                 tag.setProperty("id", inTag.getId());
                 tag.setProperty("uri", inTag.getUri());
                 idx.add(tag, "uri", inTag.getUri());
-                
+
                 tx.success();
             } finally {
@@ -881,19 +920,18 @@
     }
 
-	public List<Annotation> getAnnotationsByTag(String tagUri) {
-		
-		ArrayList<Annotation> ret = new  ArrayList<Annotation>();
-		Node tag = getTagNodeByUri(tagUri);
-		
-		
-		Iterable<Relationship> rels = tag.getRelationships(Direction.INCOMING,RelationTypes.HAS_TAG);
-		
-		for (Relationship rel:rels){
-			Node node = rel.getStartNode();
-			ret.add(createAnnotationFromNode(node));
-			
-		}
-		return ret;
-	}
+    public List<Annotation> getAnnotationsByTag(String tagUri) {
+
+        ArrayList<Annotation> ret = new ArrayList<Annotation>();
+        Node tag = getTagNodeByUri(tagUri);
+
+        Iterable<Relationship> rels = tag.getRelationships(Direction.INCOMING, RelationTypes.HAS_TAG);
+
+        for (Relationship rel : rels) {
+            Node node = rel.getStartNode();
+            ret.add(createAnnotationFromNode(node));
+
+        }
+        return ret;
+    }
 
 }
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	(revision 31)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotations.java	(revision 32)
@@ -6,12 +6,7 @@
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.json.JSONArray;
+
 import org.json.JSONException;
 import org.json.JSONObject;
-import org.restlet.data.Form;
-import org.restlet.data.Parameter;
 import org.restlet.data.Status;
 import org.restlet.ext.json.JsonRepresentation;
@@ -24,7 +19,5 @@
 import de.mpiwg.itgroup.annotations.Annotation;
 import de.mpiwg.itgroup.annotations.Person;
-import de.mpiwg.itgroup.annotations.Tag;
 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
-import de.mpiwg.itgroup.annotations.restlet.utils.JSONObjectComparator;
 
 /**
@@ -57,6 +50,7 @@
 
         if (id == null) {
-            
-            return getAllAnnotations();
+            // TODO: what to return without id - list all annotations?
+            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
+            return null;
         }
 
@@ -83,53 +77,5 @@
     }
 
-    private Representation getAllAnnotations() {
-    	
-    	 Form form = getRequest().getResourceRef().getQueryAsForm();
-           String sortBy=null;
-           for (Parameter parameter : form) {
-             if (parameter.getName().equals("sortBy")){
-             sortBy =  parameter.getValue();
-             }
-           }
-        
-        AnnotationStore store = getAnnotationStore();
-        ArrayList<JSONObject> results = new ArrayList<JSONObject>();
-       
-       	List<Annotation> annotations = store.getAnnotations(null, null);
-        for (Annotation annotation : annotations) {
-            	
-        	 JSONObject jo = createAnnotatorJson(annotation,false);
-             results.add(jo);
-           
-            }
-        
-        if (sortBy!=null){
-    		JSONObjectComparator.sortAnnotations(results,sortBy);
-    	}
-        
-    	JSONArray resultsJa = new JSONArray();
-    	for (JSONObject result:results){
-    		resultsJa.put(result);
-    	}
-    	
-        // assemble result object
-        JSONObject result = new JSONObject();
-        try {
-            result.put("rows", resultsJa);
-            result.put("total", resultsJa.length());
-        } catch (JSONException e) {
-            setStatus(Status.SERVER_ERROR_INTERNAL, "JSON Error");
-            return null;
-        }
-        logger.debug("sending:");
-        logger.debug(result);
-        return new JsonRepresentation(result);
-    }
-
-       	
-        
-	
-
-	/**
+    /**
      * POST with JSON content-type. Creates a new Annotation.
      * 
@@ -276,5 +222,5 @@
         
         // delete annotation
-        store.deleteById(id);
+        store.deleteAnnotationById(id);
         setStatus(Status.SUCCESS_NO_CONTENT);
         return null;
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotationsByTags.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotationsByTags.java	(revision 31)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorAnnotationsByTags.java	(revision 28)
@@ -65,5 +65,5 @@
     
 	if (sortBy!=null){
-		JSONObjectComparator.sortAnnotations(results,sortBy);
+		sortAnnotations(results,sortBy);
 	}
 		
@@ -88,4 +88,18 @@
 
     
+	/**
+	 * Sortiere array nach einem Parameter in den Annotationen
+	 * @param results
+	 * @return
+	 */
+	private void sortAnnotations(List<JSONObject> results,String attribute) {
+		JSONObjectComparator comp = new JSONObjectComparator(attribute);
+		
+		
 	
+		java.util.Collections.sort( results, comp);
+		
+		
+
+	}        	
 }
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorSearch.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorSearch.java	(revision 15)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorSearch.java	(revision 32)
@@ -57,5 +57,5 @@
         logger.debug(String.format("searching for uri=%s user=%s", uri, user));
         AnnotationStore store = getAnnotationStore();
-        List<Annotation> annots = store.searchByUriUser(uri, user, limit, offset);
+        List<Annotation> annots = store.searchAnnotationByUriUser(uri, user, limit, offset);
         for (Annotation annot : annots) {
             // check permission
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java	(revision 31)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/AnnotationsUiRestlet.java	(revision 32)
@@ -17,5 +17,5 @@
 public class AnnotationsUiRestlet extends BaseRestlet {
 
-    public final String version = "AnnotationManagerN4J/AnnotationStore 0.1";
+    public final String version = "AnnotationManagerN4J/AnnotationsUI 0.2";
 
     public static Logger logger = Logger.getLogger(AnnotationsUiRestlet.class);
@@ -42,5 +42,9 @@
         router.attach("/groups/{id}/", GroupResource.class);
         router.attach("/groups/{id}/members", GroupMembersResource.class);
-              
+        router.attach("/persons", PersonsResource.class);
+        router.attach("/persons/", PersonsResource.class);
+        router.attach("/persons/{id}", PersonResource.class);
+        router.attach("/persons/{id}/", PersonResource.class);
+
         router.attach("/", InfoResource.class);
         // authenticator.setNext(router);
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupResource.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupResource.java	(revision 24)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupResource.java	(revision 32)
@@ -5,4 +5,5 @@
 
 import org.apache.log4j.Logger;
+import org.restlet.data.Form;
 import org.restlet.data.MediaType;
 import org.restlet.data.Reference;
@@ -10,5 +11,7 @@
 import org.restlet.representation.Representation;
 import org.restlet.representation.StringRepresentation;
+import org.restlet.resource.Delete;
 import org.restlet.resource.Get;
+import org.restlet.resource.Put;
 import org.restlet.resource.ResourceException;
 import org.restlet.resource.ServerResource;
@@ -29,9 +32,9 @@
 
     protected AnnotationStore store;
-    
+
     protected String requestId;
-    
+
     protected Group group;
-    
+
     @Override
     protected void doInit() throws ResourceException {
@@ -58,25 +61,104 @@
     @Get("html")
     public Representation doGetHTML(Representation entity) {
-        if (requestId == null || requestId.isEmpty()) {
+        if (group == null) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_NOT_FOUND);
+            return null;
+        }
+        String result = null;
+        // get form parameter
+        Form f = this.getQuery();
+        String form = f.getFirstValue("form");
+        if (form != null && form.equals("edit")) {
+            // output edit form
+            result = "<html><body>\n";
+            result += String.format("<h1>Edit group %s</h1>\n", group.getId());
+            result += String.format("<p><a href=\"%s\">All groups</a></p>", this.getReference().getParentRef());
+            // tunnel PUT method through POST
+            result += String.format("<form method=\"post\" action=\"%s?method=PUT\">\n", this.getReference().getHierarchicalPart());
+            result += "<table>";
+            result += String.format("<tr><td><b>name</b></td><td><input type=\"text\" name=\"name\" value=\"%s\"/></td></tr>\n",
+                    group.getName());
+            result += String.format("<tr><td><b>uri</b></td><td><input type=\"text\" name=\"uri\" value=\"%s\"/></td></tr>\n",
+                    group.getUriString());
+            result += "</table>\n";
+            result += "<p><input type=\"submit\"/></p>";
+            result += "</table>\n</form>\n</body>\n</html>";
+        } else {
+            // output group content
+            result = "<html><body>\n<h1>Group</h1>\n";
+            result += String.format("<p><a href=\"%s\">All groups</a></p>", this.getReference().getParentRef());
+            result += "<table>";
+            result += String.format("<tr><td><b>id</b></td><td>%s</td></tr>\n", group.getId());
+            result += String.format("<tr><td><b>name</b></td><td>%s</td></tr>\n", group.getName());
+            result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", group.getUri());
+            result += String.format("<tr><td><b>members</b></td><td><a href=\"%s\">view members</a></td></tr>\n", this
+                    .getReference().addSegment("members"));
+            result += "</table>\n";
+            result += "<p><a href=\"?form=edit\">Edit group</a></p>\n";
+            // tunnel POST as DELETE
+            result += String.format(
+                    "<form method=\"post\" action=\"%s?method=DELETE\"><input type=\"submit\" value=\"Delete group\"/></form>\n",
+                    this.getReference().getHierarchicalPart());
+            result += "</body>\n</html>";
+        }
+        return new StringRepresentation(result, MediaType.TEXT_HTML);
+    }
+
+    /**
+     * PUT updates the group.
+     * 
+     * @param entity
+     * @return
+     */
+    @Put
+    public Representation doPut(Representation entity) {
+        logger.debug("GroupResource.doPut!");
+        if (group == null) {
             // invalid id
             setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
             return null;
         }
-        String result = null;
-        Reference groupsUrl = this.getReference().getParentRef();
-        result = "<html><body>\n<h1>Group</h1>\n";
-        result += String.format("<p><a href=\"%s\">All groups</a></p>", groupsUrl);
-        result += "<table>";
-        result += String.format("<tr><td><b>id</b></td><td>%s</td></tr>\n", group.getId());
-        result += String.format("<tr><td><b>name</b></td><td>%s</td></tr>\n", group.getName());
-        result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", group.getUri());
-        result += String.format("<tr><td><b>members</b></td><td><a href=\"%s\">view members</a></td></tr>\n", this.getReference()
-                .addSegment("members"));
-        result += "</table>\n</body>\n</html>";
-
-        logger.debug("sending:");
-        logger.debug(result);
-        return new StringRepresentation(result, MediaType.TEXT_HTML);
+        // TODO: do authentication
+        Form form = new Form(entity);
+        String name = form.getFirstValue("name");
+        String uri = form.getFirstValue("uri");
+        if (name != null && !name.isEmpty()) {
+            group.setName(name);
+        }
+        if (uri != null && !uri.isEmpty()) {
+            group.setUri(uri);
+        }
+        store.storeActor(group);
+        // return 303: see other
+        setStatus(Status.REDIRECTION_SEE_OTHER);
+        // go GET same URL
+        Reference url = this.getReference();
+        this.getResponse().setLocationRef(url);
+        return null;
     }
 
+    /**
+     * DELETE deletes the group.
+     * 
+     * @param entity
+     * @return
+     */
+    @Delete
+    public Representation doDelete(Representation entity) {
+        logger.debug("GroupResource.doDelete!");
+        if (group == null) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
+            return null;
+        }
+        // TODO: do authentication
+        store.deleteActor(group);
+        // return 303: see other
+        setStatus(Status.REDIRECTION_SEE_OTHER);
+        // go GET parent URL
+        Reference url = this.getReference().getParentRef();
+        this.getResponse().setLocationRef(url);
+        return null;
+    }
 }
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupsResource.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupsResource.java	(revision 23)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupsResource.java	(revision 32)
@@ -15,4 +15,5 @@
 import org.restlet.resource.Get;
 import org.restlet.resource.Post;
+import org.restlet.resource.ResourceException;
 import org.restlet.resource.ServerResource;
 
@@ -34,4 +35,13 @@
     private AnnotationStore store;
 
+    @Override
+    protected void doInit() throws ResourceException {
+        super.doInit();
+        // get store instance
+        if (store == null) {
+            store = ((BaseRestlet) getApplication()).getAnnotationStore();
+        }
+    }
+
     /**
      * GET with HTML content type. Lists all groups.
@@ -43,18 +53,35 @@
     public Representation doGetHTML(Representation entity) {
         String result = null;
-        store = getAnnotationStore();
-        // list all groups
-        result = "<html><body>\n<h1>Groups</h1>\n<table>";
-        result += "<tr><th>id</th><th>name</th><th>uri</th></tr>";
-        List<Group> groups = store.getGroups("uri", "*");
-        for (Group group : groups) {
-            Reference groupUrl = this.getReference();
-            groupUrl.addSegment(group.getId());
-            result += String.format("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", groupUrl, group.getId(),
-                    group.getName(), group.getUri());
+        // get form parameter
+        Form f = this.getQuery();
+        String form = f.getFirstValue("form");
+        if (form != null && form.equals("new_group")) {
+            // output new group form
+            result = "<html><body>\n";
+            result += "<h1>New group</h1>\n";
+            result += String.format("<p><a href=\"%s\">All groups</a></p>", this.getReference());
+            result += String.format("<form method=\"post\" action=\"%s\">\n", this.getReference().getHierarchicalPart());
+            result += "<table>";
+            result += "<tr><td><b>id</b></td><td><input type=\"text\" name=\"id\"/></td></tr>\n";
+            result += "<tr><td><b>name</b></td><td><input type=\"text\" name=\"name\"/></td></tr>\n";
+            result += "</table>\n";
+            result += "<p><input type=\"submit\"/></p>\n";
+            result += "</form>\n</body>\n</html>";
+        } else {
+            // list all groups
+            result = "<html><body>\n<h1>Groups</h1>\n";
+            result += "<table>\n";
+            result += "<tr><th>id</th><th>name</th><th>uri</th></tr>";
+            List<Group> groups = store.getGroups("uri", "*");
+            for (Group group : groups) {
+                Reference groupUrl = this.getReference().clone();
+                groupUrl.addSegment(group.getId());
+                result += String.format("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", groupUrl, group.getId(),
+                        group.getName(), group.getUri());
+            }
+            result += "</table>\n";
+            result += "<p><a href=\"?form=new_group\">Add new group</a></p>\n";
+            result += "</body>\n</html>";
         }
-        result += "</table>\n</body>\n</html>";
-        logger.debug("sending:");
-        logger.debug(result);
         return new StringRepresentation(result, MediaType.TEXT_HTML);
     }
@@ -79,5 +106,4 @@
         String gid = makeGroupId(id);
         Group newGroup = new Group(gid, null, name);
-        store = getAnnotationStore();
         Actor storedGroup = store.storeActor(newGroup);
         gid = storedGroup.getId();
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonResource.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonResource.java	(revision 32)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonResource.java	(revision 32)
@@ -0,0 +1,162 @@
+/**
+ * 
+ */
+package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
+
+import org.apache.log4j.Logger;
+import org.restlet.data.Form;
+import org.restlet.data.MediaType;
+import org.restlet.data.Reference;
+import org.restlet.data.Status;
+import org.restlet.representation.Representation;
+import org.restlet.representation.StringRepresentation;
+import org.restlet.resource.Delete;
+import org.restlet.resource.Get;
+import org.restlet.resource.Put;
+import org.restlet.resource.ResourceException;
+import org.restlet.resource.ServerResource;
+
+import de.mpiwg.itgroup.annotations.Person;
+import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
+import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
+
+/**
+ * Resource class for a single person.
+ * 
+ * @author casties
+ * 
+ */
+public class PersonResource extends ServerResource {
+
+    public static Logger logger = Logger.getLogger(PersonResource.class);
+
+    protected AnnotationStore store;
+
+    protected String requestId;
+
+    protected Person person;
+
+    @Override
+    protected void doInit() throws ResourceException {
+        super.doInit();
+        // id from URI /annotations/persons/{id}
+        requestId = (String) getRequest().getAttributes().get("id");
+        logger.debug("group-id=" + requestId);
+        // get store instance
+        if (store == null) {
+            store = ((BaseRestlet) getApplication()).getAnnotationStore();
+        }
+        // get group from store
+        if (requestId != null) {
+            person = (Person) store.getActor(new Person(requestId));
+        }
+    }
+
+    /**
+     * GET with HTML content type. Shows the person.
+     * 
+     * @param entity
+     * @return
+     */
+    @Get("html")
+    public Representation doGetHTML(Representation entity) {
+        if (person == null) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_NOT_FOUND);
+            return null;
+        }
+        String result = null;
+        // get form parameter
+        Form f = this.getQuery();
+        String form = f.getFirstValue("form");
+        if (form != null && form.equals("edit")) {
+            // output edit form
+            result = "<html><body>\n";
+            result += String.format("<h1>Edit person %s</h1>\n", person.getId());
+            result += String.format("<p><a href=\"%s\">All persons</a></p>", this.getReference().getParentRef());
+            // tunnel PUT method through POST
+            result += String.format("<form method=\"post\" action=\"%s?method=PUT\">\n", this.getReference().getHierarchicalPart());
+            result += "<table>";
+            result += String.format("<tr><td><b>name</b></td><td><input type=\"text\" name=\"name\" value=\"%s\"/></td></tr>\n",
+                    person.getName());
+            result += String.format("<tr><td><b>uri</b></td><td><input type=\"text\" name=\"uri\" value=\"%s\"/></td></tr>\n",
+                    person.getUriString());
+            result += "</table>\n";
+            result += "<p><input type=\"submit\"/></p>";
+            result += "</table>\n</form>\n</body>\n</html>";
+        } else {
+            // output person content
+            result = "<html><body>\n<h1>Person</h1>\n";
+            result += String.format("<p><a href=\"%s\">All persons</a></p>", this.getReference().getParentRef());
+            result += "<table>";
+            result += String.format("<tr><td><b>id</b></td><td>%s</td></tr>\n", person.getId());
+            result += String.format("<tr><td><b>name</b></td><td>%s</td></tr>\n", person.getName());
+            result += String.format("<tr><td><b>uri</b></td><td>%s</td></tr>\n", person.getUri());
+            result += "</table>\n";
+            result += "<p><a href=\"?form=edit\">Edit person</a></p>\n";
+            // tunnel POST as DELETE
+            result += String.format(
+                    "<form method=\"post\" action=\"%s?method=DELETE\"><input type=\"submit\" value=\"Delete person\"/></form>\n",
+                    this.getReference().getHierarchicalPart());
+            result += "</body>\n</html>";
+        }
+        return new StringRepresentation(result, MediaType.TEXT_HTML);
+    }
+
+    /**
+     * PUT updates the person.
+     * 
+     * @param entity
+     * @return
+     */
+    @Put
+    public Representation doPut(Representation entity) {
+        logger.debug("PersonResource.doPut!");
+        if (person == null) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
+            return null;
+        }
+        // TODO: do authentication
+        Form form = new Form(entity);
+        String name = form.getFirstValue("name");
+        String uri = form.getFirstValue("uri");
+        if (name != null && !name.isEmpty()) {
+            person.setName(name);
+        }
+        if (uri != null && !uri.isEmpty()) {
+            person.setUri(uri);
+        }
+        store.storeActor(person);
+        // return 303: see other
+        setStatus(Status.REDIRECTION_SEE_OTHER);
+        // go GET same URL
+        Reference url = this.getReference();
+        this.getResponse().setLocationRef(url);
+        return null;
+    }
+
+    /**
+     * DELETE deletes the person.
+     * 
+     * @param entity
+     * @return
+     */
+    @Delete
+    public Representation doDelete(Representation entity) {
+        logger.debug("PersonResource.doDelete!");
+        if (person == null) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
+            return null;
+        }
+        // TODO: do authentication
+        store.deleteActor(person);
+        // return 303: see other
+        setStatus(Status.REDIRECTION_SEE_OTHER);
+        // go GET parent URL
+        Reference url = this.getReference().getParentRef();
+        this.getResponse().setLocationRef(url);
+        return null;
+    }
+}
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java	(revision 32)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java	(revision 32)
@@ -0,0 +1,123 @@
+/**
+ * 
+ */
+package de.mpiwg.itgroup.annotations.restlet.annotations_ui;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.restlet.data.Form;
+import org.restlet.data.MediaType;
+import org.restlet.data.Reference;
+import org.restlet.data.Status;
+import org.restlet.representation.Representation;
+import org.restlet.representation.StringRepresentation;
+import org.restlet.resource.Get;
+import org.restlet.resource.Post;
+import org.restlet.resource.ResourceException;
+import org.restlet.resource.ServerResource;
+
+import de.mpiwg.itgroup.annotations.Actor;
+import de.mpiwg.itgroup.annotations.Person;
+import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
+import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore.NodeTypes;
+import de.mpiwg.itgroup.annotations.restlet.BaseRestlet;
+
+/**
+ * Resource class for the list of annotation users (Person class).
+ * 
+ * @author casties
+ * 
+ */
+public class PersonsResource extends ServerResource {
+
+    public static Logger logger = Logger.getLogger(PersonsResource.class);
+
+    private AnnotationStore store;
+
+    @Override
+    protected void doInit() throws ResourceException {
+        super.doInit();
+        // get store instance
+        if (store == null) {
+            store = ((BaseRestlet) getApplication()).getAnnotationStore();
+        }
+    }
+
+    /**
+     * GET with HTML content type. Lists all persons.
+     * 
+     * @param entity
+     * @return
+     */
+    @Get("html")
+    public Representation doGetHTML(Representation entity) {
+        String result = null;
+        // get form parameter
+        Form f = this.getQuery();
+        String form = f.getFirstValue("form");
+        if (form != null && form.equals("new_person")) {
+            // output new group form
+            result = "<html><body>\n";
+            result += "<h1>New person</h1>\n";
+            result += String.format("<p><a href=\"%s\">All persons</a></p>", this.getReference());
+            result += String.format("<form method=\"post\" action=\"%s\">\n", this.getReference().getHierarchicalPart());
+            result += "<table>";
+            result += "<tr><td><b>id</b></td><td><input type=\"text\" name=\"id\"/></td></tr>\n";
+            result += "<tr><td><b>name</b></td><td><input type=\"text\" name=\"name\"/></td></tr>\n";
+            result += "</table>\n";
+            result += "<p><input type=\"submit\"/></p>\n";
+            result += "</form>\n</body>\n</html>";
+        } else {
+            // list all groups
+            result = "<html><body>\n<h1>Persons</h1>\n<table>";
+            result += "<tr><th>id</th><th>name</th><th>uri</th></tr>";
+            List<Actor> persons = store.getActors("uri", "*", NodeTypes.PERSON);
+            for (Actor person : persons) {
+                Reference url = this.getReference().clone();
+                url.addSegment(person.getId());
+                result += String.format("<tr><td><a href=\"%s\">%s</a></td><td>%s</td><td>%s</td></tr>\n", url,
+                        person.getIdString(), person.getName(), person.getUri());
+            }
+            result += "</table>\n";
+            result += "<p><a href=\"?form=new_person\">Add new person</a></p>\n";
+            result += "</body>\n</html>";
+        }
+        return new StringRepresentation(result, MediaType.TEXT_HTML);
+    }
+
+    /**
+     * POST creates a new Group.
+     * 
+     * @return
+     */
+    @Post
+    public Representation doPost(Representation entity) {
+        logger.debug("PersonsResource doPost!");
+        // TODO: do authentication
+        Form form = new Form(entity);
+        String id = form.getFirstValue("id");
+        if (id == null || id.isEmpty() || id.matches("\\W")) {
+            // invalid id
+            setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
+            return null;
+        }
+        String name = form.getFirstValue("name");
+        if (name == null || name.isEmpty()) {
+            name = ((BaseRestlet) getApplication()).getFullNameFromLdap(id);
+        }
+        String uri = form.getFirstValue("uri");
+        if (uri != null && uri.isEmpty()) uri = null;
+        Person newPerson = new Person(id, uri, name);
+        Actor storedPerson = store.storeActor(newPerson);
+        id = storedPerson.getId();
+        // return 303: see other
+        setStatus(Status.REDIRECTION_SEE_OTHER);
+        // go GET URL for this person
+        Reference url = this.getReference().clone();
+        url.addSegment(id);
+        this.getResponse().setLocationRef(url);
+        return null;
+    }
+
+}
Index: src/main/java/de/mpiwg/itgroup/annotations/restlet/utils/JSONObjectComparator.java
===================================================================
--- src/main/java/de/mpiwg/itgroup/annotations/restlet/utils/JSONObjectComparator.java	(revision 31)
+++ src/main/java/de/mpiwg/itgroup/annotations/restlet/utils/JSONObjectComparator.java	(revision 28)
@@ -2,5 +2,4 @@
 
 import java.util.Comparator;
-import java.util.List;
 
 import de.mpiwg.itgroup.annotations.Annotation;
@@ -35,19 +34,5 @@
     }
         
-	/**
-	 * Sortiere array nach einem Parameter in den Annotationen
-	 * @param results
-	 * @return
-	 */
-	public static void sortAnnotations(List<JSONObject> results,String attribute) {
-		JSONObjectComparator comp = new JSONObjectComparator(attribute);
-		
-		
-	
-		java.util.Collections.sort( results, comp);
-		
-		
-
-	}        
+  
 	
 }
