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.frames.Adjacency;
23  import com.tinkerpop.frames.Property;
24  import eu.ehri.project.definitions.Ontology;
25  import eu.ehri.project.models.annotations.EntityType;
26  import eu.ehri.project.models.annotations.Fetch;
27  import eu.ehri.project.models.annotations.Indexed;
28  import eu.ehri.project.models.annotations.Mandatory;
29  import eu.ehri.project.models.base.Accessible;
30  import eu.ehri.project.models.base.Accessor;
31  import eu.ehri.project.models.base.Annotatable;
32  import eu.ehri.project.models.base.Linkable;
33  import eu.ehri.project.models.base.Promotable;
34  import eu.ehri.project.models.base.Temporal;
35  
36  /**
37   * Links two items together with a given body, with may either be
38   * a text property or some other entity.
39   */
40  @EntityType(EntityClass.LINK)
41  public interface Link extends Promotable, Temporal, Annotatable {
42  
43      @Fetch(value = Ontology.LINK_HAS_LINKER, numLevels = 0)
44      @Adjacency(label = Ontology.LINK_HAS_LINKER)
45      UserProfile getLinker();
46  
47      @Adjacency(label = Ontology.LINK_HAS_LINKER)
48      void setLinker(Accessor accessor);
49  
50      @Fetch(value = Ontology.LINK_HAS_TARGET, ifLevel = 0, numLevels = 1)
51      @Adjacency(label = Ontology.LINK_HAS_TARGET)
52      Iterable<Linkable> getLinkTargets();
53  
54      @Adjacency(label = Ontology.LINK_HAS_TARGET)
55      void addLinkTarget(Linkable entity);
56  
57      @Adjacency(label = Ontology.LINK_HAS_TARGET)
58      void removeLinkTarget(Linkable entity);
59  
60      @Fetch(Ontology.LINK_HAS_BODY)
61      @Adjacency(label = Ontology.LINK_HAS_BODY)
62      Iterable<Accessible> getLinkBodies();
63  
64      @Adjacency(label = Ontology.LINK_HAS_BODY)
65      void addLinkBody(Accessible entity);
66  
67      @Mandatory
68      @Property(Ontology.LINK_HAS_TYPE)
69      String getLinkType();
70  
71      @Indexed
72      @Property(Ontology.LINK_HAS_FIELD)
73      String getLinkField();
74  
75      @Property(Ontology.LINK_HAS_DESCRIPTION)
76      String getDescription();
77  }
78  
79  
80  
81