Changeset 48:0e00bf8e27fb in AnnotationManagerN4J
- Timestamp:
- Sep 26, 2012, 4:10:47 PM (12 years ago)
- Branch:
- default
- Location:
- src/main/java/de/mpiwg/itgroup/annotations
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/Annotation.java
r40 r48 29 29 30 30 /** 31 * The base URI of theannotation target.32 */ 33 protected String targetBaseUri;31 * The annotation target. 32 */ 33 protected Target target; 34 34 35 35 /** … … 53 53 54 54 /** 55 * The uri of the resource that is annotated e.g. a book.55 * The Resource that is annotated e.g. a book. 56 56 * The target is part of this resource e.g. a page of a book. 57 57 */ 58 protected String resourceUri;58 protected Resource resource; 59 59 60 60 /** … … 189 189 190 190 /** 191 * @return the target 192 */ 193 public Target getTarget() { 194 return target; 195 } 196 197 /** 198 * @param target the target to set 199 */ 200 public void setTarget(Target target) { 201 this.target = target; 202 } 203 204 /** 191 205 * @return the targetBaseUri 192 206 */ 193 207 public String getTargetBaseUri() { 194 return targetBaseUri; 195 } 196 197 /** 198 * @param targetBaseUri the targetBaseUri to set 199 */ 200 public void setTargetBaseUri(String targetBaseUri) { 201 this.targetBaseUri = targetBaseUri; 208 if (target == null) return null; 209 return target.getUri(); 202 210 } 203 211 … … 231 239 232 240 /** 241 * @return the resource 242 */ 243 public Resource getResource() { 244 return resource; 245 } 246 247 /** 248 * @param resource the resource to set 249 */ 250 public void setResource(Resource resource) { 251 this.resource = resource; 252 } 253 254 /** 233 255 * @return the resourceUri 234 256 */ 235 257 public String getResourceUri() { 236 return resourceUri; 237 } 238 239 /** 240 * @param resourceUri the resourceUri to set 241 */ 242 public void setResourceUri(String resourceUri) { 243 this.resourceUri = resourceUri; 258 if (resource == null) return null; 259 return resource.getUri(); 244 260 } 245 261 -
src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java
r45 r48 488 488 String type = (String) target.getProperty("TYPE"); 489 489 if (type.equals("TARGET")) { 490 annot.setTarget BaseUri((String) target.getProperty("uri", null));490 annot.setTarget(new Target((String) target.getProperty("uri", null))); 491 491 } else if (type.equals("RESOURCE")) { 492 annot.setResource Uri((String) target.getProperty("uri", null));493 } 494 } 495 if (annot.getTarget BaseUri() == null) {492 annot.setResource(new Resource((String) target.getProperty("uri", null))); 493 } 494 } 495 if (annot.getTarget() == null) { 496 496 logger.error("annotation " + annotNode + " has no target node!"); 497 497 } … … 653 653 * the annotation target 654 654 */ 655 String targetBaseUri = annot.getTargetBaseUri();655 Target target = annot.getTarget(); 656 656 Node targetNode = null; 657 if (target BaseUri!= null) {658 targetNode = getOrCreate TargetNode(targetBaseUri, NodeTypes.TARGET);657 if (target != null) { 658 targetNode = getOrCreateUriNode(target.getUri(), NodeTypes.TARGET); 659 659 getOrCreateRelation(annotNode, RelationTypes.ANNOTATES, targetNode); 660 660 } … … 673 673 * the annotation resource 674 674 */ 675 String resourceUri = annot.getResourceUri();676 if (resource Uri!= null) {677 Node resource = getOrCreateTargetNode(resourceUri, NodeTypes.RESOURCE);678 getOrCreateRelation(annotNode, RelationTypes.ANNOTATES, resource );679 getOrCreateRelation(targetNode, RelationTypes.PART_OF, resource );675 Resource resource = annot.getResource(); 676 if (resource != null) { 677 Node resourceNode = getOrCreateUriNode(resource.getUri(), NodeTypes.RESOURCE); 678 getOrCreateRelation(annotNode, RelationTypes.ANNOTATES, resourceNode); 679 getOrCreateRelation(targetNode, RelationTypes.PART_OF, resourceNode); 680 680 } 681 681 … … 892 892 } 893 893 894 protected Node getOrCreate TargetNode(String uri, NodeTypes type) {894 protected Node getOrCreateUriNode(String uri, NodeTypes type) { 895 895 Index<Node> idx = getNodeIndex(type); 896 896 IndexHits<Node> targets = idx.get("uri", uri); -
src/main/java/de/mpiwg/itgroup/annotations/restlet/AnnotatorResourceImpl.java
r40 r48 40 40 import de.mpiwg.itgroup.annotations.NS; 41 41 import de.mpiwg.itgroup.annotations.Person; 42 import de.mpiwg.itgroup.annotations.Resource; 43 import de.mpiwg.itgroup.annotations.Target; 42 44 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; 43 45 … … 442 444 */ 443 445 if (jo.has("uri")) { 444 annot.setTarget BaseUri(jo.getString("uri"));446 annot.setTarget(new Target(jo.getString("uri"))); 445 447 } 446 448 /* … … 448 450 */ 449 451 if (jo.has("resource")) { 450 annot.setResource Uri(jo.getString("resource"));452 annot.setResource(new Resource(jo.getString("resource"))); 451 453 } 452 454 /*
Note: See TracChangeset
for help on using the changeset viewer.