comparison src/main/java/de/mpiwg/itgroup/annotations/neo4j/AnnotationStore.java @ 36:0fdb05f35139

new node type "resource" for base documents (sans page number).
author casties
date Wed, 26 Sep 2012 11:47:38 +0200
parents 8427930c5f88
children 03e0f7574224
comparison
equal deleted inserted replaced
35:b5018d6027eb 36:0fdb05f35139
38 protected static Logger logger = Logger.getLogger(AnnotationStore.class); 38 protected static Logger logger = Logger.getLogger(AnnotationStore.class);
39 39
40 protected GraphDatabaseService graphDb; 40 protected GraphDatabaseService graphDb;
41 41
42 public static enum NodeTypes { 42 public static enum NodeTypes {
43 ANNOTATION, PERSON, TARGET, GROUP, TAG 43 ANNOTATION, PERSON, TARGET, GROUP, TAG, RESOURCE
44 } 44 }
45 45
46 // types of nodes that should not be automatically deleted. 46 // types of nodes that should not be automatically deleted.
47 public Set<String> permanentNodeTypes = new HashSet<String>(Arrays.asList("PERSON", "GROUP", "TAG")); 47 public Set<String> permanentNodeTypes = new HashSet<String>(Arrays.asList("PERSON", "GROUP", "TAG"));
48 48
49 protected List<Index<Node>> nodeIndexes; 49 protected List<Index<Node>> nodeIndexes;
50 50
51 public static enum RelationTypes implements RelationshipType { 51 public static enum RelationTypes implements RelationshipType {
52 ANNOTATES, CREATED, PERMITS_ADMIN, PERMITS_DELETE, PERMITS_UPDATE, PERMITS_READ, MEMBER_OF, HAS_TAG 52 ANNOTATES, CREATED, PERMITS_ADMIN, PERMITS_DELETE, PERMITS_UPDATE, PERMITS_READ, MEMBER_OF, HAS_TAG, PART_OF
53 } 53 }
54 54
55 public static String ANNOTATION_URI_BASE = "http://entities.mpiwg-berlin.mpg.de/annotations/"; 55 public static String ANNOTATION_URI_BASE = "http://entities.mpiwg-berlin.mpg.de/annotations/";
56 56
57 public AnnotationStore(GraphDatabaseService graphDb) { 57 public AnnotationStore(GraphDatabaseService graphDb) {
62 nodeIndexes.add(NodeTypes.ANNOTATION.ordinal(), graphDb.index().forNodes("annotations")); 62 nodeIndexes.add(NodeTypes.ANNOTATION.ordinal(), graphDb.index().forNodes("annotations"));
63 nodeIndexes.add(NodeTypes.PERSON.ordinal(), graphDb.index().forNodes("persons")); 63 nodeIndexes.add(NodeTypes.PERSON.ordinal(), graphDb.index().forNodes("persons"));
64 nodeIndexes.add(NodeTypes.TARGET.ordinal(), graphDb.index().forNodes("targets")); 64 nodeIndexes.add(NodeTypes.TARGET.ordinal(), graphDb.index().forNodes("targets"));
65 nodeIndexes.add(NodeTypes.GROUP.ordinal(), graphDb.index().forNodes("groups")); 65 nodeIndexes.add(NodeTypes.GROUP.ordinal(), graphDb.index().forNodes("groups"));
66 nodeIndexes.add(NodeTypes.TAG.ordinal(), graphDb.index().forNodes("tags")); 66 nodeIndexes.add(NodeTypes.TAG.ordinal(), graphDb.index().forNodes("tags"));
67 nodeIndexes.add(NodeTypes.RESOURCE.ordinal(), graphDb.index().forNodes("resources"));
67 } 68 }
68 69
69 protected Index<Node> getNodeIndex(NodeTypes type) { 70 protected Index<Node> getNodeIndex(NodeTypes type) {
70 return nodeIndexes.get(type.ordinal()); 71 return nodeIndexes.get(type.ordinal());
71 } 72 }