org.ldp4j.application.vocabulary.RDF Maven / Gradle / Ivy
/**
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* This file is part of the LDP4j Project:
* http://www.ldp4j.org/
*
* Center for Open Middleware
* http://www.centeropenmiddleware.com/
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* Copyright (C) 2014-2016 Center for Open Middleware.
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
* Artifact : org.ldp4j.framework:ldp4j-application-api:0.2.1
* Bundle : ldp4j-application-api-0.2.1.jar
* #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
*/
package org.ldp4j.application.vocabulary;
import java.net.URI;
import javax.xml.namespace.QName;
/**
* W3C Resource Description Framework (RDF) Vocabulary.
*
* This vocabulary provides an informal representation of the terms as defined
* in the RDF specification. Check the specification for normative
* reference.
*
*
* Namespace: {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#}
* Prefix: {@code rdf}
*
* @version 1.0
* @since 1.0.0
* @author Miguel Esteban Gutiérrez
* @see http://www.w3.org/TR/2004/REC-rdf-schema-20040210/
*/
public final class RDF extends AbstractImmutableVocabulary {
private static final long serialVersionUID = -1616871929205422837L;
/** The namespace of the vocabulary ({@code http://www.w3.org/1999/02/22-rdf-syntax-ns#}) **/
public static final String NAMESPACE = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
/** The preferred prefix of the vocabulary ({@code rdf}) **/
public static final String NS_PREFIX = "rdf";
/* ---------------------------------------------------------------------- */
/* PROPERTIES */
/* ---------------------------------------------------------------------- */
/**
* TYPE
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#type}.
*
* The subject is an instance of a class.
*
* @see rdf:type
*/
public static final Term TYPE;
/**
* FIRST
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#first}.
*
* The first item in the subject RDF list.
*
* @see rdf:first
*/
public static final Term FIRST;
/**
* REST
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#rest}.
*
* The rest of the subject RDF list after the first item.
*
* @see rdf:rest
*/
public static final Term REST;
/**
* VALUE
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#value}.
*
* The definition of the subject resource.
*
* @see rdf:value
*/
public static final Term VALUE;
/**
* SUBJECT
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#subject}.
*
* The subject of the subject RDF statement.
*
* @see rdf:subject
*/
public static final Term SUBJECT;
/**
* PREDICATE
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate}.
*
* The predicate of the subject RDF statement.
*
* @see rdf:predicate
*/
public static final Term PREDICATE;
/**
* OBJECT
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#object}.
*
* The object of the subject RDF statement.
*
* @see rdf:object
*/
public static final Term OBJECT;
/* ---------------------------------------------------------------------- */
/* CLASSES */
/* ---------------------------------------------------------------------- */
/**
* XML_LITERAL
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral}.
*
* The class of XML literal values.
*
* @see rdf:XMLLiteral
*/
public static final Term XML_LITERAL;
/**
* PROPERTY
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#Property}.
*
* The class of RDF properties.
*
* @see rdf:Property
*/
public static final Term PROPERTY;
/**
* STATEMENT
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement}.
*
* The class of RDF statements.
*
* @see rdf:Statement
*/
public static final Term STATEMENT;
/**
* BAG
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag}.
*
* The class of unordered containers.
*
* @see rdf:Bag
*/
public static final Term BAG;
/**
* SEQ
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq}.
*
* The class of ordered containers.
*
* @see rdf:Seq
*/
public static final Term SEQ;
/**
* ALT
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt}.
*
* The class of containers of alternatives.
*
* @see rdf:Alt
*/
public static final Term ALT;
/**
* LIST
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#List}.
*
* The class of RDF Lists.
*
* @see rdf:List
*/
public static final Term LIST;
/* ---------------------------------------------------------------------- */
/* INDIVIDUALS */
/* ---------------------------------------------------------------------- */
/**
* NIL
*
* {@code http://www.w3.org/1999/02/22-rdf-syntax-ns#nil}.
*
* The class of RDF Lists.
*
* @see rdf:nil
*/
public static final Term NIL;
/** The unique instance of the vocabulary **/
private static final RDF VOCABULARY=new RDF();
static {
// Initialize properties
TYPE=term("type");
FIRST=term("first");
REST=term("rest");
VALUE=term("value");
SUBJECT=term("subject");
PREDICATE=term("predicate");
OBJECT=term("object");
// Initialize classes
XML_LITERAL=term("XMLLiteral");
PROPERTY=term("Property");
STATEMENT=term("Statement");
BAG=term("Bag");
SEQ=term("Seq");
ALT=term("Alt");
LIST=term("List");
// Initialize individuals
NIL=term("nil");
VOCABULARY.initialize();
}
private RDF() {
super(ImmutableTerm.class,RDF.NAMESPACE,RDF.NS_PREFIX);
}
/**
* Create a term
*
* @param localPart
* The local part of the term's URI
* @return A {@code LDPTerm} instance that represents the term.
*/
private static Term term(String localPart) {
return new ImmutableTerm(VOCABULARY,localPart);
}
/**
* Retrieve the LDP vocabulary instance.
* @return Return the unique instance of the vocabulary.
*/
public static RDF getInstance() {
return RDF.VOCABULARY;
}
/**
* Get the terms of the vocabulary
*
* @return An array with all the terms of the vocabulary.
*/
public static Term[] values() {
return getInstance().terms();
}
/**
* Find the term that matches the specified name.
*
* @param term
* A {@code String}-based representation of the term's name.
* @return The {@code Term} that matches the specified name.
*/
public static Term valueOf(String term) {
return getInstance().fromName(term);
}
/**
* Find the term that matches the specified URI.
*
* @param term
* A {@code QName}-based representation of the term's URI.
* @return The {@code Term} that matches the specified URI.
* @see javax.xml.namespace.QName
*/
public static Term valueOf(QName term) {
return getInstance().fromValue(term);
}
/**
* Find the term that matches the specified URI.
*
* @param term
* A {@code URI}-based representation of the term's URI.
* @return The {@code LDPTerm} that matches the specified URI.
* @see java.net.URI
*/
public static Term valueOf(URI term) {
return getInstance().fromValue(term);
}
}