Changeset 45:707902d468f6 in AnnotationManagerN4J for src


Ignore:
Timestamp:
Sep 26, 2012, 3:28:31 PM (12 years ago)
Author:
casties
Branch:
default
Message:

store reads and sends annotations resources now.

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

Legend:

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

    r43 r45  
    136136     */
    137137    @SuppressWarnings("unchecked")
    138     public <T extends Actor> List<T> getActors(String key, String query, NodeTypes type) {
     138    protected <T extends Actor> List<T> getActors(String key, String query, NodeTypes type) {
    139139        ArrayList<T> actors = new ArrayList<T>();
    140140        Index<Node> idx = getNodeIndex(type);
     
    183183     */
    184184    @SuppressWarnings("unchecked")
    185     public <T extends Uri> List<T> getUris(String key, String query, NodeTypes type) {
     185    protected <T extends Uri> List<T> getUris(String key, String query, NodeTypes type) {
    186186        ArrayList<T> uris = new ArrayList<T>();
    187187        Index<Node> idx = getNodeIndex(type);
     
    482482        annot.setBodyUri((String) annotNode.getProperty("bodyUri", null));
    483483        /*
    484          * get annotation target from relation
     484         * get annotation target and resource from relation
    485485         */
    486         Relationship targetRel = getRelation(annotNode, RelationTypes.ANNOTATES, null);
    487         if (targetRel != null) {
    488             Node target = targetRel.getEndNode();
    489             annot.setTargetBaseUri((String) target.getProperty("uri", null));
    490         } else {
     486        for (Relationship rel : annotNode.getRelationships(RelationTypes.ANNOTATES)) {
     487            Node target = rel.getEndNode();
     488            String type = (String) target.getProperty("TYPE");
     489            if (type.equals("TARGET")) {
     490                annot.setTargetBaseUri((String) target.getProperty("uri", null));
     491            } else if (type.equals("RESOURCE")) {
     492                annot.setResourceUri((String) target.getProperty("uri", null));
     493            }
     494        }
     495        if (annot.getTargetBaseUri() == null) {
    491496            logger.error("annotation " + annotNode + " has no target node!");
    492497        }
     498        // get fragment from attribute
    493499        annot.setTargetFragment((String) annotNode.getProperty("targetFragment", null));
    494500        String ft = (String) annotNode.getProperty("fragmentType", null);
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/GroupMembersResource.java

    r27 r45  
    5858        result += String.format("<form method=\"post\" action=\"%s\">\n", thisUrl);
    5959        result += "<p>Add new member: <select name=\"add_member\">\n";
    60         for (Actor p : store.getActors("uri", "*", NodeTypes.PERSON)) {
     60        for (Person p : store.getPersons("uri", "*")) {
    6161            result += String.format("<option value=\"%s\">%s</option>\n", p.getIdString(), p.getName());
    6262        }
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/annotations_ui/PersonsResource.java

    r32 r45  
    7373            result = "<html><body>\n<h1>Persons</h1>\n<table>";
    7474            result += "<tr><th>id</th><th>name</th><th>uri</th></tr>";
    75             List<Actor> persons = store.getActors("uri", "*", NodeTypes.PERSON);
    76             for (Actor person : persons) {
     75            List<Person> persons = store.getPersons("uri", "*");
     76            for (Person person : persons) {
    7777                Reference url = this.getReference().clone();
    7878                url.addSegment(person.getId());
Note: See TracChangeset for help on using the changeset viewer.