Mercurial > hg > AnnotationManagerN4J
diff src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java @ 31:9f653697437e
annotationbrowser
author | dwinter |
---|---|
date | Tue, 25 Sep 2012 21:47:58 +0200 |
parents | 3be0ebb6d5ad |
children | 8427930c5f88 |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java Tue Sep 25 16:08:11 2012 +0200 +++ b/src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java Tue Sep 25 21:47:58 2012 +0200 @@ -84,6 +84,8 @@ return person; } + + public List<Actor> getActors(String key, String query, NodeTypes type) { ArrayList<Actor> actors = new ArrayList<Actor>(); Index<Node> idx = getNodeIndex(type); @@ -124,6 +126,31 @@ /** + * 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. *