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.importers.cvoc;
21  
22  import com.google.common.collect.ImmutableMap;
23  import com.google.common.collect.Lists;
24  import eu.ehri.project.definitions.SkosMultilingual;
25  import org.apache.jena.vocabulary.RDFS;
26  
27  import java.net.URI;
28  import java.util.List;
29  import java.util.Map;
30  
31  /**
32   */ // Borrowed from https://github.com/simonjupp/java-skos-api
33  public enum SkosRDFVocabulary {
34      LABEL_RELATED("labelRelated"),
35      MEMBER("member"),
36      MEMBER_LIST("memberList"),
37      MAPPING_RELATION("mappingRelation"),
38      BROAD_MATCH("broadMatch"),
39      NARROW_MATCH("narrowMatch"),
40      RELATED_MATCH("relatedMatch"),
41      EXACT_MATCH("exactMatch"),
42      BROADER("broader"),
43      NARROWER("narrower"),
44      BROADER_TRANS("broaderTransitive"),
45      NARROWER_TRANS("narrowerTransitive"),
46      RELATED("related"),
47      HAS_TOP_CONCEPT("hasTopConcept"),
48      SEMANTIC_RELATION("semanticRelation"),
49      CONCEPT("Concept"),
50      LABEL_RELATION("LabelRelation"),
51      SEE_LABEL_RELATION("seeLabelRelation"),
52      COLLECTION("Collection"),
53      CONCEPT_SCHEME("ConceptScheme"),
54      TOP_CONCEPT_OF("topConceptOf"),
55      IN_SCHEME("inScheme"),
56      CLOSE_MATCH("closeMatch"),
57      DOCUMENT("Document"),
58      IMAGE("Image"),
59      ORDERED_COLLECTION("OrderedCollection"),
60      COLLECTABLE_PROPERTY("CollectableProperty"),
61      RESOURCE("Resource"),
62      PREF_LABEL("prefLabel"),
63      ALT_LABEL("altLabel"),
64      COMMENT("comment"),
65      EXAMPLE("example"),
66      NOTE("note"),
67      NOTATION("notation"),
68      SCOPE_NOTE("scopeNote"),
69      HIDDEN_LABEL("hiddenLabel"),
70      EDITORIAL_NOTE("editorialNote"),
71      HISTORY_NOTE("historyNote"),
72      DEFINITION("definition"),
73      CHANGE_NOTE("changeNote");
74  
75      public static final String DEFAULT_BASE_URI = "http://data.ehri-project.eu#";
76      public static final String NAMESPACE_URI = "http://www.w3.org/2004/02/skos/core#";
77  
78      public static final Map<String, String> NAMESPACES = ImmutableMap.<String, String>builder()
79              .put("skos", "http://www.w3.org/2004/02/skos/core#")
80              .put("dc", "http://purl.org/dc/elements/1.1/name")
81              .put("rdfs", "http://www.w3.org/2000/01/rdf-schema#")
82              .put("foaf", "http://xmlns.com/foaf/0.1/")
83              .put("sem", "http://semanticweb.cs.vu.nl/2009/11/sem/")
84              .put("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#")
85              .put("owl", "http://www.w3.org/2002/07/owl#")
86              .build();
87  
88      // Language-agnostic properties.
89      public static final Map<String, URI> GENERAL_PROPS = ImmutableMap.<String, URI>builder()
90              .put("latitude", URI.create("http://www.w3.org/2003/01/geo/wgs84_pos#lat"))
91              .put("longitude", URI.create("http://www.w3.org/2003/01/geo/wgs84_pos#long"))
92              .put("latitude/longitude", URI.create("http://www.w3.org/2003/01/geo/wgs84_pos#lat_long"))
93              .put("url", URI.create("http://xmlns.com/foaf/0.1/isPrimaryTopicOf"))
94              .put("date", URI.create("http://semanticweb.cs.vu.nl/2009/11/sem/hasTime"))
95              .put("person", URI.create("http://semanticweb.cs.vu.nl/2009/11/sem/hasActor"))
96              .put("place", URI.create("http://semanticweb.cs.vu.nl/2009/11/sem/hasPlace"))
97              .put("seeAlso", URI.create(RDFS.seeAlso.getURI()))
98              .build();
99  
100     // Properties that end up as undeterminedRelation nodes.
101     public static final Map<String, URI> RELATION_PROPS = ImmutableMap.<String, URI>builder()
102             .put("owl:sameAs", URI.create("http://www.w3.org/2002/07/owl#sameAs"))
103             .put("skos:exactMatch", URI.create("http://www.w3.org/2004/02/skos/core#exactMatch"))
104             .put("skos:closeMatch", URI.create("http://www.w3.org/2004/02/skos/core#closeMatch"))
105             .put("skos:broadMatch", URI.create("http://www.w3.org/2004/02/skos/core#broadMatch"))
106             .put("skos:relatedMatch", URI.create("http://www.w3.org/2004/02/skos/core#relatedMatch"))
107             .put("sem:person", URI.create("http://semanticweb.cs.vu.nl/2009/11/sem/hasActor"))
108             .put("sem:place", URI.create("http://semanticweb.cs.vu.nl/2009/11/sem/hasPlace"))
109             .build();
110 
111     public static final Map<String, List<URI>> LANGUAGE_PROPS = ImmutableMap.<String, List<URI>>builder()
112             .put(SkosMultilingual.altLabel.name(), Lists.newArrayList(ALT_LABEL.getURI()))
113             .put(SkosMultilingual.hiddenLabel.name(), Lists.newArrayList(HIDDEN_LABEL.getURI()))
114             .put(SkosMultilingual.definition.name(), Lists.newArrayList(DEFINITION.getURI()))
115             .put(SkosMultilingual.scopeNote.name(), Lists.newArrayList(SCOPE_NOTE.getURI(),
116                     URI.create("http://www.w3.org/2000/01/rdf-schema#comment")))
117             .put(SkosMultilingual.note.name(), Lists.newArrayList(NOTE.getURI()))
118             .put(SkosMultilingual.editorialNote.name(), Lists.newArrayList(EDITORIAL_NOTE.getURI()))
119             .build();
120 
121     private final URI uri;
122 
123     SkosRDFVocabulary(String localName) {
124         this.uri = URI.create(NAMESPACE_URI + localName);
125     }
126 
127     public URI getURI() {
128         return uri;
129     }
130 }