Changeset 67:875a97f8b8da in AnnotationManagerN4J for src
- Timestamp:
- Feb 21, 2014, 9:19:23 PM (11 years ago)
- Branch:
- default
- Location:
- src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java
r66 r67 63 63 nodeIndexes = new ArrayList<Index<Node>>(5); 64 64 // List.set(enum.ordinal(), val) seems not to work. 65 try ( Transaction tx = graphDb.beginTx() ) 66 { 65 try ( Transaction tx = graphDb.beginTx() ) { 67 66 nodeIndexes.add(NodeTypes.ANNOTATION.ordinal(), graphDb.index().forNodes("annotations")); 68 67 nodeIndexes.add(NodeTypes.PERSON.ordinal(), graphDb.index().forNodes("persons")); … … 121 120 public Node getNodeFromIndex(String key, String value, NodeTypes type) { 122 121 if (key == null || value == null) return null; 123 Node node = getNodeIndex(type).get(key, value).getSingle(); 122 Node node = null; 123 try (Transaction tx = graphDb.beginTx()) { 124 node = getNodeIndex(type).get(key, value).getSingle(); 125 tx.success(); 126 } 124 127 return node; 125 128 } … … 312 315 if (pn == null) return false; 313 316 // optimized version of getGroupsForPersonNode 317 try (Transaction tx = graphDb.beginTx()) { 314 318 Iterable<Relationship> rels = pn.getRelationships(RelationTypes.MEMBER_OF); 315 319 for (Relationship rel : rels) { 316 320 Node gn = rel.getEndNode(); 317 321 if (gn.getProperty("uri", "").equals(group.getUriString()) || gn.getProperty("id", "").equals(group.getId())) { 322 tx.success(); 318 323 return true; 319 324 } 325 } 326 tx.success(); 320 327 } 321 328 return false; … … 475 482 */ 476 483 public Annotation getAnnotationById(String id) { 484 Annotation annot = null; 485 try ( Transaction tx = graphDb.beginTx() ) { 477 486 Node annotNode = getNodeIndex(NodeTypes.ANNOTATION).get("id", id).getSingle(); 478 Annotation annot = createAnnotationFromNode(annotNode); 487 annot = createAnnotationFromNode(annotNode); 488 tx.success(); 489 } 479 490 return annot; 480 491 } … … 488 499 public Annotation createAnnotationFromNode(Node annotNode) { 489 500 Annotation annot = new Annotation(); 501 try ( Transaction tx = graphDb.beginTx() ) { 490 502 annot.setUri((String) annotNode.getProperty("id", null)); 491 503 annot.setBodyText((String) annotNode.getProperty("bodyText", null)); … … 565 577 } 566 578 annot.setTags(tags); 567 579 580 tx.success(); 581 } 568 582 return annot; 569 583 } … … 814 828 Node target = getNodeFromIndex("uri", targetUri, NodeTypes.TARGET); 815 829 if (target != null) { 830 try ( Transaction tx = graphDb.beginTx() ) { 816 831 Iterable<Relationship> relations = target.getRelationships(RelationTypes.ANNOTATES); 817 832 for (Relationship relation : relations) { … … 823 838 logger.error("ANNOTATES relation does not start with ANNOTATION: " + ann); 824 839 } 840 } 841 tx.success(); 825 842 } 826 843 } -
src/main/webapp/annotationBrowser/js/annotation-core.js
r56 r67 18 18 19 19 function createLinkFromURI(uri){ 20 if (uri == null) return ""; 20 21 var docUri = uri.replace(docNamespace,viewerAddress); 21 22 docUri = docUri.replace("?pn","&pn"); … … 24 25 25 26 function getDCdata(path,obj){ 26 27 if (path == null) return; 27 28 var splitted = path.split("?"); 28 29 var docUri=splitted[0];
Note: See TracChangeset
for help on using the changeset viewer.