org.apache.any23.vocab
Class Vocabulary

java.lang.Object
  extended by org.apache.any23.vocab.Vocabulary
Direct Known Subclasses:
CSV, DCTERMS, DOAC, FOAF, GEO, HLISTING, HRECIPE, ICAL, OGP, REVIEW, SCHEMAORG, SINDICE, VCARD, WO, XFN, XHTML

public abstract class Vocabulary
extends Object

Base class for the definition of a vocabulary.

Version:
$Id$
Author:
Michele Mostarda ( michele.mostarda@gmail.com )

Constructor Summary
Vocabulary(String namespace)
          Constructor.
 
Method Summary
protected  org.openrdf.model.URI createClass(String namespace, String resource)
          Creates a resource and register it to the classes map.
protected  org.openrdf.model.URI createProperty(String namespace, String property)
          Creates a property and register it to the properties map.
protected  org.openrdf.model.URI createURI(String uriStr)
          Creates a URI.
 org.openrdf.model.URI getClass(String name)
          Returns a class defined within this vocabulary.
 org.openrdf.model.URI[] getClasses()
           
 String getCommentFor(org.openrdf.model.URI resource)
          Returns the comment for the given resource.
 Map<org.openrdf.model.URI,String> getComments()
          Returns all the defined comments for resources.
 org.openrdf.model.URI getNamespace()
           
 org.openrdf.model.URI[] getProperties()
           
 org.openrdf.model.URI getProperty(String name)
          Returns a property defined within this vocabulary.
 org.openrdf.model.URI getProperty(String name, org.openrdf.model.URI defaultValue)
          Returns a property defined within this vocabulary, if not found the defaultValue will be returned.
 org.openrdf.model.URI getPropertyCamelCase(String property)
          Returns the property URI for the specified property string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Vocabulary

public Vocabulary(String namespace)
Constructor.

Parameters:
namespace - the namespace URI prefix.
Method Detail

getNamespace

public org.openrdf.model.URI getNamespace()
Returns:
the namespace associated to this vocabulary.

getClass

public org.openrdf.model.URI getClass(String name)
Returns a class defined within this vocabulary.

Parameters:
name - class name.
Returns:
the URI associated to such resource.

getProperty

public org.openrdf.model.URI getProperty(String name)
Returns a property defined within this vocabulary.

Parameters:
name - property name.
Returns:
the URI associated to such property.

getProperty

public org.openrdf.model.URI getProperty(String name,
                                         org.openrdf.model.URI defaultValue)
Returns a property defined within this vocabulary, if not found the defaultValue will be returned.

Parameters:
name - property name.
defaultValue - the default value if property name not found.
Returns:
the URI associated to such property.

getPropertyCamelCase

public org.openrdf.model.URI getPropertyCamelCase(String property)
Returns the property URI for the specified property string. If the string contains a list of words separated by blank chars, such words are merged and camel case separated.

Parameters:
property - property name.
Returns:
property URI.

getClasses

public org.openrdf.model.URI[] getClasses()
Returns:
the list of all defined classes.

getProperties

public org.openrdf.model.URI[] getProperties()
Returns:
the list of all defined properties.

getComments

public Map<org.openrdf.model.URI,String> getComments()
Returns all the defined comments for resources.

Returns:
unmodifiable list of comments.

getCommentFor

public String getCommentFor(org.openrdf.model.URI resource)
Returns the comment for the given resource.

Parameters:
resource - input resource to have a comment.
Returns:
the human readable comment associated to the given resource.

createURI

protected org.openrdf.model.URI createURI(String uriStr)
Creates a URI.

Parameters:
uriStr - the URI string
Returns:
the URI instance.

createClass

protected org.openrdf.model.URI createClass(String namespace,
                                            String resource)
Creates a resource and register it to the classes map.

Parameters:
namespace - vocabulary namespace.
resource - name of the resource.
Returns:
the created resource URI.

createProperty

protected org.openrdf.model.URI createProperty(String namespace,
                                               String property)
Creates a property and register it to the properties map.

Parameters:
namespace - vocabulary namespace.
property - name of the property.
Returns:
the created property URI.


Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.