comparison src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java @ 63:9f8c9611848a

fixed bug with new rectangle shapes. added limit, offset and sortBy parameters to annotator/ and annotator/search.
author casties
date Fri, 23 Nov 2012 17:55:04 +0100
parents e2f86ef9b871
children 5b568de5ee0d
comparison
equal deleted inserted replaced
62:15569aa35d62 63:9f8c9611848a
787 /** 787 /**
788 * Returns all annotations with the given uri and/or user. 788 * Returns all annotations with the given uri and/or user.
789 * 789 *
790 * @param uri 790 * @param uri
791 * @param userUri 791 * @param userUri
792 * @param limit 792 * @return
793 * @param offset 793 */
794 * @return 794 public List<Annotation> searchAnnotationByUriUser(String targetUri, String userUri) {
795 */
796 public List<Annotation> searchAnnotationByUriUser(String targetUri, String userUri, String limit, String offset) {
797 List<Annotation> annotations = new ArrayList<Annotation>(); 795 List<Annotation> annotations = new ArrayList<Annotation>();
798 if (targetUri != null) { 796 if (targetUri != null) {
799 // there should be only one 797 // there should be only one
800 Node target = getNodeIndex(NodeTypes.TARGET).get("uri", targetUri).getSingle(); 798 Node target = getNodeFromIndex("uri", targetUri, NodeTypes.TARGET);
801 if (target != null) { 799 if (target != null) {
802 Iterable<Relationship> relations = target.getRelationships(RelationTypes.ANNOTATES); 800 Iterable<Relationship> relations = target.getRelationships(RelationTypes.ANNOTATES);
803 for (Relationship relation : relations) { 801 for (Relationship relation : relations) {
804 Node ann = relation.getStartNode(); 802 Node ann = relation.getStartNode();
805 if (ann.getProperty("TYPE", "").equals("ANNOTATION")) { 803 if (ann.getProperty("TYPE", "").equals("ANNOTATION")) {
826 } 824 }
827 } 825 }
828 } 826 }
829 } 827 }
830 // TODO: if both uri and user are given we should intersect 828 // TODO: if both uri and user are given we should intersect
829
831 return annotations; 830 return annotations;
832 } 831 }
833 832
834 /** 833 /**
835 * Returns Relationship of type from Node start to Node end. Creates one if 834 * Returns Relationship of type from Node start to Node end. Creates one if