Changes in [29:3be0ebb6d5ad:27:6bc918105c9a] in AnnotationManagerN4J


Ignore:
Location:
src/main/java/de/mpiwg/itgroup/annotations
Files:
4 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/NS.java

    r28 r18  
    33public class NS {
    44    public static final String MPIWG_PERSONS_URL = "http://entities.mpiwg-berlin.mpg.de/persons/";
    5     public static final String MPIWG_TAGS_URL = "http://entities.mpiwg-berlin.mpg.de/tags/";
    65    public static final String MPIWG_GROUPS_URL = "http://entities.mpiwg-berlin.mpg.de/groups/";
    76    public static final String OAC_NS = "http://www.openannotation.org/ns/";
  • src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java

    r29 r25  
    2525import de.mpiwg.itgroup.annotations.Group;
    2626import de.mpiwg.itgroup.annotations.Person;
    27 import de.mpiwg.itgroup.annotations.Tag;
    2827
    2928/**
     
    7574    }
    7675
    77     /**
    78      * @param tagUri
    79      * @return
    80      */
    81     public Node getTagNodeByUri(String tagUri) {
    82         if (tagUri == null) return null;
    83         Node person = getNodeIndex(NodeTypes.TAG).get("uri", tagUri).getSingle();
    84         return person;
    85     }
    86 
    8776    public List<Actor> getActors(String key, String query, NodeTypes type) {
    8877        ArrayList<Actor> actors = new ArrayList<Actor>();
     
    122111        return groups;
    123112    }
    124    
    125    
    126     /**
    127      * Returns List of Tags.
    128      * Key has to be indexed.
    129      *
    130      * @param key
    131      * @param query
    132      * @return
    133      */
    134     public List<Tag> getTags(String key, String query) {
    135         ArrayList<Tag> tags = new ArrayList<Tag>();
    136         Index<Node> idx = getNodeIndex(NodeTypes.TAG);
    137         if (key == null) {
    138             key = "uri";
    139             query = "*";
    140         }
    141         IndexHits<Node> groupNodes = idx.query(key, query);
    142         for (Node groupNode : groupNodes) {
    143             Tag tag = createTagFromNode(groupNode);
    144             tags.add(tag);
    145         }
    146         return tags;
    147     }
    148 
    149  
    150    /**
     113
     114    /**
    151115     * Returns List of Groups the person is member of.
    152116     *
     
    387351        return null;
    388352    }
    389    
    390     public Tag createTagFromNode(Node tagNode) {
    391         String name = (String) tagNode.getProperty("name", null);
    392         String uri = (String) tagNode.getProperty("uri", null);
    393         String id = (String) tagNode.getProperty("id", null);
    394        
    395         return new Tag(id, uri, name);
    396                
    397         }
    398 
    399353
    400354    /**
     
    512466                        for (String tag : newTags) {
    513467                            // create new tag
    514                             Node tagNode = getOrCreateTagNode(new Tag(null,null,tag));
     468                            Node tagNode = getOrCreateTagNode(tag);
    515469                            getOrCreateRelation(annotNode, RelationTypes.HAS_TAG, tagNode);
    516470                        }
     
    733687    }
    734688
    735     protected Node getOrCreateTagNode(Tag inTag) {
     689    protected Node getOrCreateTagNode(String tagname) {
    736690        Index<Node> idx = getNodeIndex(NodeTypes.TAG);
    737         String tagname = inTag.getName();
    738691        IndexHits<Node> tags = idx.get("name", tagname);
    739692        Node tag = tags.getSingle();
     
    746699                tag.setProperty("name", tagname);
    747700                idx.add(tag, "name", tagname);
    748                
    749                 tag.setProperty("id", inTag.getId());
    750                 tag.setProperty("uri", inTag.getUri());
    751                 idx.add(tag, "uri", inTag.getUri());
    752                
    753701                tx.success();
    754702            } finally {
     
    854802    }
    855803
    856         public List<Annotation> getAnnotationsByTag(String tagUri) {
    857                
    858                 ArrayList<Annotation> ret = new  ArrayList<Annotation>();
    859                 Node tag = getTagNodeByUri(tagUri);
    860                
    861                
    862                 Iterable<Relationship> rels = tag.getRelationships(Direction.INCOMING,RelationTypes.HAS_TAG);
    863                
    864                 for (Relationship rel:rels){
    865                         Node node = rel.getStartNode();
    866                         ret.add(createAnnotationFromNode(node));
    867                        
    868                 }
    869                 return ret;
    870         }
    871 
    872804}
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorRestlet.java

    r28 r18  
    4242        router.attach("/search", AnnotatorSearch.class);
    4343        router.attach("/groups", AnnotatorGroups.class);
    44         router.attach("/tags", AnnotatorTags.class);
    45         router.attach("/tags/{id}", AnnotatorTags.class);
    46         router.attach("/tags/{id}", AnnotatorTags.class);
    47         router.attach("/tags/{id}/annotations", AnnotatorAnnotationsByTags.class);
     44
    4845        router.attach("/", AnnotatorInfo.class);
    4946        // authenticator.setNext(router);
Note: See TracChangeset for help on using the changeset viewer.