001/**
002 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
003 *   This file is part of the LDP4j Project:
004 *     http://www.ldp4j.org/
005 *
006 *   Center for Open Middleware
007 *     http://www.centeropenmiddleware.com/
008 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
009 *   Copyright (C) 2014-2016 Center for Open Middleware.
010 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
011 *   Licensed under the Apache License, Version 2.0 (the "License");
012 *   you may not use this file except in compliance with the License.
013 *   You may obtain a copy of the License at
014 *
015 *             http://www.apache.org/licenses/LICENSE-2.0
016 *
017 *   Unless required by applicable law or agreed to in writing, software
018 *   distributed under the License is distributed on an "AS IS" BASIS,
019 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
020 *   See the License for the specific language governing permissions and
021 *   limitations under the License.
022 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
023 *   Artifact    : org.ldp4j.framework:ldp4j-application-api:0.2.2
024 *   Bundle      : ldp4j-application-api-0.2.2.jar
025 * #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
026 */
027package org.ldp4j.application.vocabulary;
028
029import java.net.URI;
030
031import javax.xml.namespace.QName;
032
033/**
034 * W3C RDF Vocabulary Description Language 1.0 (RDF Schema) Vocabulary.
035 * <p>
036 * This vocabulary provides an informal representation of the terms as defined
037 * in the RDFS SChema specification. Check the specification for normative
038 * reference.
039 * <p>
040 *
041 * <b>Namespace:</b> {@code http://www.w3.org/2000/01/rdf-schema#} <br>
042 * <b>Prefix:</b> {@code rdfs}
043 *
044 * @version 1.0
045 * @since 1.0.0
046 * @author Miguel Esteban Guti&eacute;rrez
047 * @see <a href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/">http://www.w3.org/TR/2004/REC-rdf-schema-20040210/</a>
048 */
049public final class RDFS extends AbstractImmutableVocabulary<ImmutableTerm> {
050
051  private static final long serialVersionUID = 1083533867342570283L;
052
053  /** The namespace of the vocabulary ({@code http://www.w3.org/2000/01/rdf-schema#}) **/
054  public static final String NAMESPACE = "http://www.w3.org/2000/01/rdf-schema#";
055
056  /** The preferred prefix of the vocabulary ({@code rdfs}) **/
057  public static final String NS_PREFIX = "rdfs";
058
059  /* ---------------------------------------------------------------------- */
060  /* PROPERTIES                                                             */
061  /* ---------------------------------------------------------------------- */
062
063  /**
064   * TYPE
065   * <p>
066   * {@code http://www.w3.org/2000/01/rdf-schema#subClassOf}.
067   * <p>
068   * The subject is a subclass of a class.
069   *
070   * @see <a
071   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_subclassof">rdfs:subClassOf</a>
072   */
073  public static final Term SUB_CLASS_OF;
074
075  /**
076   * FIRST
077   * <p>
078   * {@code http://www.w3.org/2000/01/rdf-schema#subPropertyOf}.
079   * <p>
080   * The subject is a subproperty of a property.
081   *
082   * @see <a
083   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_subpropertyof">rdfs:subPropertyOf</a>
084   */
085  public static final Term SUB_PROPERTY_OF;
086
087  /**
088   * REST
089   * <p>
090   * {@code http://www.w3.org/2000/01/rdf-schema#domain}.
091   * <p>
092   * A domain of the subject property.
093   *
094   * @see <a
095   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_domain">rdfs:domain</a>
096   */
097  public static final Term DOMAIN;
098
099  /**
100   * VALUE
101   * <p>
102   * {@code http://www.w3.org/2000/01/rdf-schema#range}.
103   * <p>
104   * A range of the subject property.
105   *
106   * @see <a
107   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_range">rdfs:range</a>
108   */
109  public static final Term RANGE;
110
111  /**
112   * SUBJECT
113   * <p>
114   * {@code http://www.w3.org/2000/01/rdf-schema#label}.
115   * <p>
116   * A human-readable name for the subject.
117   *
118   * @see <a
119   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_label">rdfs:label</a>
120   */
121  public static final Term LABEL;
122
123  /**
124   * PREDICATE
125   * <p>
126   * {@code http://www.w3.org/2000/01/rdf-schema#comment}.
127   * <p>
128   * A description of the subject resource.
129   *
130   * @see <a
131   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_comment">rdfs:comment</a>
132   */
133  public static final Term COMMENT;
134
135  /**
136   * OBJECT
137   * <p>
138   * {@code http://www.w3.org/2000/01/rdf-schema#member}.
139   * <p>
140   * A member of the subject resource.
141   *
142   * @see <a
143   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_member">rdfs:member</a>
144   */
145  public static final Term MEMBER;
146
147  /**
148   * SEE_ALSO
149   * <p>
150   * {@code http://www.w3.org/2000/01/rdf-schema#seeAlso}.
151   * <p>
152   * Further information about the subject resource.
153   *
154   * @see <a
155   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_seealso">rdfs:seeAlso</a>
156   */
157  public static final Term SEE_ALSO;
158
159  /**
160   * IS_DEFINED_BY
161   * <p>
162   * {@code http://www.w3.org/2000/01/rdf-schema#isDefinedBy}.
163   * <p>
164   * The definition of the subject resource.
165   *
166   * @see <a
167   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_isdefinedby">rdfs:isDefinedBy</a>
168   */
169  public static final Term IS_DEFINED_BY;
170
171  /* ---------------------------------------------------------------------- */
172  /* CLASSES                                                                */
173  /* ---------------------------------------------------------------------- */
174
175  /**
176   * XML_LITERAL
177   * <p>
178   * {@code http://www.w3.org/2000/01/rdf-schema#Resource}.
179   * <p>
180   * The class resource, everything.
181   *
182   * @see <a
183   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_resource">rdfs:Resource</a>
184   */
185  public static final Term RESOURCE;
186
187  /**
188   * PROPERTY
189   * <p>
190   * {@code http://www.w3.org/2000/01/rdf-schema#Literal}.
191   * <p>
192   * The class of literal values, e.g. textual strings and integers.
193   *
194   * @see <a
195   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_literal">rdfs:Literal</a>
196   */
197  public static final Term LITERAL;
198
199  /**
200   * STATEMENT
201   * <p>
202   * {@code http://www.w3.org/2000/01/rdf-schema#Class}.
203   * <p>
204   * The class of classes.
205   *
206   * @see <a
207   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_class">rdfs:Class</a>
208   */
209  public static final Term CLASS;
210
211  /**
212   * BAG
213   * <p>
214   * {@code http://www.w3.org/2000/01/rdf-schema#Datatype}.
215   * <p>
216   * The class of RDF datatypes.
217   *
218   * @see <a
219   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_datatype">rdfs:Datatype</a>
220   */
221  public static final Term DATATYPE;
222
223  /**
224   * SEQ
225   * <p>
226   * {@code http://www.w3.org/2000/01/rdf-schema#Container}.
227   * <p>
228   * The class of RDF containers.
229   *
230   * @see <a
231   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_container">rdfs:Container</a>
232   */
233  public static final Term CONTAINER;
234
235  /**
236   * ALT
237   * <p>
238   * {@code http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty}.
239   * <p>
240   * The class of container membership properties, {@code rdf:_1},
241   * {@code rdf:_2}, ..., all of which are sub-properties of
242   * {@code rdfs:member}.
243   *
244   * @see <a
245   *      href="http://www.w3.org/TR/2004/REC-rdf-schema-20040210/#ch_containermembershipproperty">rdfs:ContainerMembershipProperty</a>
246   */
247  public static final Term CONTAINER_MEMBERSHIP_PROPERTY;
248
249  /** The unique instance of the vocabulary **/
250  private static final RDFS VOCABULARY=new RDFS();
251
252  static {
253    // Initialize properties
254    SUB_CLASS_OF=term("subClassOf");
255    SUB_PROPERTY_OF=term("subPropertyOf");
256    DOMAIN=term("domain");
257    RANGE=term("range");
258    LABEL=term("label");
259    COMMENT=term("comment");
260    MEMBER=term("member");
261    SEE_ALSO=term("seeAlso");
262    IS_DEFINED_BY=term("isDefinedBy");
263    // Initialize classes
264    RESOURCE=term("Resource");
265    LITERAL=term("Literal");
266    CLASS=term("Class");
267    DATATYPE=term("Datatype");
268    CONTAINER=term("Container");
269    CONTAINER_MEMBERSHIP_PROPERTY=term("ContainerMembershipProperty");
270    VOCABULARY.initialize();
271  }
272
273  private RDFS() {
274    super(ImmutableTerm.class,RDFS.NAMESPACE,RDFS.NS_PREFIX);
275  }
276
277  /**
278   * Create a term
279   *
280   * @param localPart
281   *            The local part of the term's URI
282   * @return A {@code LDPTerm} instance that represents the term.
283   */
284  private static Term term(final String localPart) {
285    return new ImmutableTerm(VOCABULARY,localPart);
286  }
287
288  /**
289   * Retrieve the LDP vocabulary instance.
290   * @return Return the unique instance of the vocabulary.
291   */
292  public static RDFS getInstance() {
293    return RDFS.VOCABULARY;
294  }
295
296  /**
297   * Get the terms of the vocabulary
298   *
299   * @return An array with all the terms of the vocabulary.
300   */
301  public static Term[] values() {
302    return getInstance().terms();
303  }
304
305  /**
306   * Find the term that matches the specified name.
307   *
308   * @param term
309   *            A {@code String}-based representation of the term's name.
310   * @return The {@code Term} that matches the specified name.
311   */
312  public static Term valueOf(final String term) {
313    return getInstance().fromName(term);
314  }
315
316  /**
317   * Find the term that matches the specified URI.
318   *
319   * @param term
320   *            A {@code QName}-based representation of the term's URI.
321   * @return The {@code Term} that matches the specified URI.
322   * @see javax.xml.namespace.QName
323   */
324  public static Term valueOf(final QName term) {
325    return getInstance().fromValue(term);
326  }
327
328  /**
329   * Find the term that matches the specified URI.
330   *
331   * @param term
332   *            A {@code URI}-based representation of the term's URI.
333   * @return The {@code LDPTerm} that matches the specified URI.
334   * @see java.net.URI
335   */
336  public static Term valueOf(final URI term) {
337    return getInstance().fromValue(term);
338  }
339
340}