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.base;
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.MaintenanceEvent;
27  import eu.ehri.project.models.AccessPoint;
28  import eu.ehri.project.models.UnknownProperty;
29  import eu.ehri.project.models.annotations.Dependent;
30  import eu.ehri.project.models.annotations.Fetch;
31  import eu.ehri.project.models.annotations.Indexed;
32  import eu.ehri.project.models.annotations.Mandatory;
33  
34  /**
35   * An entity that describes another entity.
36   *
37   */
38  public interface Description extends Named, Accessible {
39  
40      /**
41       * Process by which this description was created. Currently supported
42       * values allow for automatic import or manual creation (by a human).
43       */
44      enum CreationProcess {
45          MANUAL, IMPORT
46      }
47  
48      @Mandatory
49      @Adjacency(label = Ontology.DESCRIPTION_FOR_ENTITY)
50      Described getEntity();
51  
52      @Mandatory
53      @Property(Ontology.LANGUAGE_OF_DESCRIPTION)
54      String getLanguageOfDescription();
55  
56      @Indexed
57      @Property(Ontology.IDENTIFIER_KEY)
58      String getDescriptionCode();
59  
60      @Indexed
61      @Property(Ontology.CREATION_PROCESS)
62      CreationProcess getCreationProcess();
63  
64      /**
65       * Get the described entity of a description. This 
66       * method if @Fetch serialized only if the description
67       * is at the top level of the requested subtree.
68       */
69      @Fetch(value = Ontology.DESCRIPTION_FOR_ENTITY, ifLevel =0)
70      @Adjacency(label = Ontology.DESCRIPTION_FOR_ENTITY)
71      Described getDescribedEntity();
72  
73      @Dependent
74      @Fetch(value = Ontology.HAS_MAINTENANCE_EVENT, whenNotLite = true)
75      @Adjacency(label = Ontology.HAS_MAINTENANCE_EVENT, direction=Direction.IN)
76      Iterable<MaintenanceEvent> getMaintenanceEvents();
77  
78      @Adjacency(label = Ontology.HAS_MAINTENANCE_EVENT, direction=Direction.IN)
79      void setMaintenanceEvents(Iterable<MaintenanceEvent> maintenanceEvents);
80  
81      @Adjacency(label = Ontology.HAS_MAINTENANCE_EVENT, direction=Direction.IN)
82      void addMaintenanceEvent(MaintenanceEvent maintenanceEvent);
83  
84      @Dependent
85      @Fetch(value = Ontology.HAS_ACCESS_POINT, whenNotLite = true)
86      @Adjacency(label = Ontology.HAS_ACCESS_POINT)
87      Iterable<AccessPoint> getAccessPoints();
88  
89      @Adjacency(label = Ontology.HAS_ACCESS_POINT)
90      void addAccessPoint(AccessPoint accessPoint);
91  
92      @Dependent
93      @Fetch(value = Ontology.HAS_UNKNOWN_PROPERTY, ifLevel = 1, whenNotLite = true)
94      @Adjacency(label = Ontology.HAS_UNKNOWN_PROPERTY)
95      Iterable<UnknownProperty> getUnknownProperties();
96  }