View Javadoc

1   /*
2    * Copyright 2015 Data Archiving and Networked Services (an institute of
3    * Koninklijke Nederlandse Akademie van Wetenschappen), King's College London,
4    * Georg-August-Universitaet Goettingen Stiftung Oeffentlichen Rechts
5    *
6    * Licensed under the EUPL, Version 1.1 or – as soon they will be approved by
7    * the European Commission - subsequent versions of the EUPL (the "Licence");
8    * You may not use this work except in compliance with the Licence.
9    * You may obtain a copy of the Licence at:
10   *
11   * https://joinup.ec.europa.eu/software/page/eupl
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the Licence is distributed on an "AS IS" basis,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the Licence for the specific language governing
17   * permissions and limitations under the Licence.
18   */
19  
20  package eu.ehri.project.models;
21  
22  import com.tinkerpop.blueprints.Direction;
23  import com.tinkerpop.frames.Adjacency;
24  import com.tinkerpop.frames.Property;
25  import eu.ehri.project.definitions.Ontology;
26  import eu.ehri.project.models.annotations.EntityType;
27  import eu.ehri.project.models.annotations.Fetch;
28  import eu.ehri.project.models.annotations.Mandatory;
29  import eu.ehri.project.models.base.Annotatable;
30  import eu.ehri.project.models.base.Promotable;
31  
32  /**
33   * A frame class representing an annotation.
34   */
35  @EntityType(EntityClass.ANNOTATION)
36  public interface Annotation extends Promotable {
37  
38      /**
39       * Fetch annotations that have been made <i>on this annotation.</i>
40       *
41       * @return an iterable of annotation frames
42       */
43      @Fetch(Ontology.ANNOTATION_ANNOTATES)
44      @Adjacency(label = Ontology.ANNOTATION_ANNOTATES, direction = Direction.IN)
45      Iterable<Annotation> getAnnotations();
46  
47      /**
48       * Fetch the annotator of this annotation.
49       *
50       * @return an annotator frame
51       */
52      @Fetch(value = Ontology.ANNOTATOR_HAS_ANNOTATION, numLevels = 0)
53      @Adjacency(label = Ontology.ANNOTATOR_HAS_ANNOTATION, direction = Direction.IN)
54      UserProfile getAnnotator();
55  
56      /**
57       * Set the annotator of this annotation.
58       *
59       * @param annotator an annotator frame
60       */
61      @Adjacency(label = Ontology.ANNOTATOR_HAS_ANNOTATION, direction = Direction.IN)
62      void setAnnotator(UserProfile annotator);
63  
64      /**
65       * Fetch all targets of this annotation, including sub-parts
66       * of an item.
67       *
68       * @return an iterable of annotatable items
69       */
70      @Fetch(value = Ontology.ANNOTATES_PART, numLevels = 1)
71      @Adjacency(label = Ontology.ANNOTATION_ANNOTATES_PART)
72      Iterable<Annotatable> getTargetParts();
73  
74      /**
75       * Fetch the targets of this annotation.
76       *
77       * @return an iterable of annotatable items
78       */
79      @Fetch(value = Ontology.ANNOTATES, numLevels = 1)
80      @Adjacency(label = Ontology.ANNOTATION_ANNOTATES)
81      Iterable<Annotatable> getTargets();
82  
83      /**
84       * Get the body of this annotation.
85       *
86       * @return the body text
87       */
88      @Mandatory
89      @Property(Ontology.ANNOTATION_NOTES_BODY)
90      String getBody();
91  }