View Javadoc
1   /*
2    * Copyright 2013-2023 Medical Information Systems Research Group (https://medical.zcu.cz),
3    * Department of Computer Science and Engineering, University of West Bohemia.
4    * Address: Univerzitni 8, 306 14 Plzen, Czech Republic.
5    *
6    * This file is part of Sparkle project.
7    *
8    * Sparkle is free software: you can redistribute it and/or modify
9    * it under the terms of the GNU General Public License as published by
10   * the Free Software Foundation, either version 3 of the License.
11   *
12   * Sparkle is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with Sparkle. If not, see <http://www.gnu.org/licenses/>.
19   */
20  package cz.zcu.mre.sparkle.data;
21  
22  import org.apache.jena.vocabulary.*;
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  /**
27   * Vestavene zdroje
28   *
29   * @author Petr Vcelak (vcelak@kiv.zcu.cz)
30   * @author Klara Hlavacova
31   */
32  public class BuiltInVocabulary {
33  
34      public static final String DC_PREFIX = "dc";//$NON-NLS-2$
35      private static final String DC10_PREFIX = "dc10";//$NON-NLS-2$
36      public static final String DC11_PREFIX = "dc11";//$NON-NLS-2$
37      private static final String DCTERMS_PREFIX = "dcterms";//$NON-NLS-2$
38      private static final String DCTYPES_PREFIX = "dctypes";//$NON-NLS-2$
39      private static final String OWL_PREFIX = "owl";//$NON-NLS-2$
40      private static final String OWL2_PREFIX = "owl2";//$NON-NLS-2$
41      private static final String RDF_PREFIX = "rdf";//$NON-NLS-2$
42      private static final String RDFS_PREFIX = "rdfs";//$NON-NLS-2$
43      private static final String RSS_PREFIX = "rss";//$NON-NLS-2$
44      private static final String VCARD_PREFIX = "vcard";//$NON-NLS-2$
45      private static final String XSD_PREFIX = "xsd";//$NON-NLS-2$
46      private static final String SKOS_PREFIX = "skos";//$NON-NLS-2$
47  
48      private final List<BuiltInVocabularyEntry> builtInNamespaces;
49  
50      /**
51       * Naplni seznam informacemi o vestavenych zdrojich
52       */
53      public BuiltInVocabulary() {
54  
55          builtInNamespaces = new ArrayList<>();
56          builtInNamespaces.add(new BuiltInVocabularyEntry(DC.class, DC.getURI(), "", DC_PREFIX));
57          builtInNamespaces.add(new BuiltInVocabularyEntry(DC_10.class, DC_10.getURI(), "", DC10_PREFIX));
58          //  builtInNamespaces.add(new BuiltInVocabularyEntry(DC_11.class, DC_11.getURI(), DC11_PREFIX));
59          builtInNamespaces.add(new BuiltInVocabularyEntry(DCTerms.class, DCTerms.getURI(), "", DCTERMS_PREFIX));
60          builtInNamespaces.add(new BuiltInVocabularyEntry(DCTypes.class, DCTypes.getURI(), "", DCTYPES_PREFIX));
61          builtInNamespaces.add(new BuiltInVocabularyEntry(OWL.class, OWL.getURI(), "", OWL_PREFIX));
62          if (!OWL.getURI().equals(OWL2.getURI())) {
63              builtInNamespaces.add(new BuiltInVocabularyEntry(OWL2.class, OWL2.getURI(), "", OWL2_PREFIX));
64          }
65          builtInNamespaces.add(new BuiltInVocabularyEntry(RDF.class, RDF.getURI(), "", RDF_PREFIX));
66          builtInNamespaces.add(new BuiltInVocabularyEntry(RDFS.class, RDFS.getURI(), "", RDFS_PREFIX));
67          builtInNamespaces
68                  .add(new BuiltInVocabularyEntry(RSS.class, RSS.getURI(),
69                          "http://web.resource.org/rss/1.0/schema.rdf", //$NON-NLS-2$
70                          RSS_PREFIX));
71          builtInNamespaces.add(new BuiltInVocabularyEntry(VCARD.class, VCARD.getURI(), "", VCARD_PREFIX));
72          builtInNamespaces.add(new BuiltInVocabularyEntry(XSD.class, XSD.getURI(), "", XSD_PREFIX));
73          builtInNamespaces.add(new BuiltInVocabularyEntry(SKOS.class, SKOS.getURI(), "", SKOS_PREFIX));
74      }
75  
76      public List<BuiltInVocabularyEntry> getBuiltInNamespaces() {
77          return builtInNamespaces;
78      }
79  
80      /**
81       * Polozka pro seznam {@code builtInNamespaces}
82       */
83      public static class BuiltInVocabularyEntry {
84  
85          private final Class<?> vocabularyClass;
86          private final String uri;
87          private final String alternativeUri;
88          private final String prefix;
89  
90          BuiltInVocabularyEntry(Class<?> vocabularyClass, String uri, String alternativeUri, String prefix) {
91              this.vocabularyClass = vocabularyClass;
92              this.uri = uri;
93              this.alternativeUri = alternativeUri;
94              this.prefix = prefix;
95          }
96  
97          public Class<?> getVocabularyClass() {
98              return vocabularyClass;
99          }
100 
101         public String getPrefix() {
102             return prefix;
103         }
104 
105         public String getUri() {
106             return uri;
107         }
108 
109         public String getAlternativeUri() {
110             return alternativeUri;
111         }
112     }
113 
114 }