com.bigdata.rdf.vocab
Class BaseVocabulary

java.lang.Object
  extended by com.bigdata.rdf.vocab.BaseVocabulary
All Implemented Interfaces:
Vocabulary, Externalizable, Serializable
Direct Known Subclasses:
BSBMVocabulary, LUBMVocabulary, NoVocabulary, RDFSVocabulary

public abstract class BaseVocabulary
extends Object
implements Vocabulary, Externalizable

Base class for Vocabulary implementations.

Version:
$Id: BaseVocabulary.java 5723 2011-11-21 22:10:09Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Nested Class Summary
static class BaseVocabulary.VocabularyVersioningException
          An instance of this class indicates a versioning problem with the declaration classes.
 
Constructor Summary
protected BaseVocabulary()
          De-serialization ctor.
protected BaseVocabulary(String namespace)
          Ctor used by AbstractTripleStore.create().
 
Method Summary
protected  void addDecl(VocabularyDecl decl)
          Add a declared vocabulary.
protected abstract  void addValues()
          Hook for subclasses to provide their VocabularyDecls using addDecl(VocabularyDecl).
 BigdataValue asValue(IV iv)
          Reverse lookup of an IV defined by this vocabulary.
 IV get(Value value)
          The term identifier for the pre-defined Value.
 IConstant<IV> getConstant(Value value)
          Returns the IConstant for the Value.
 String getNamespace()
          The namespace of the owning LexiconRelation.
 void init()
          Invoked by AbstractTripleStore.create() to initialize the Vocabulary.
 void readExternal(ObjectInput in)
          Note: The de-serialized state contains Values but not BigdataValues since the AbstractTripleStore reference is not available and we can not obtain the appropriate BigdataValueFactory instance without it.
 int size()
          The #of defined Values.
 Iterator<BigdataValue> values()
          The Values in an arbitrary order.
 void writeExternal(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseVocabulary

protected BaseVocabulary()
De-serialization ctor.


BaseVocabulary

protected BaseVocabulary(String namespace)
Ctor used by AbstractTripleStore.create().

Parameters:
database - The database.
Method Detail

init

public final void init()
Invoked by AbstractTripleStore.create() to initialize the Vocabulary.

Throws:
IllegalStateException - if init() has already been invoked.

addValues

protected abstract void addValues()
Hook for subclasses to provide their VocabularyDecls using addDecl(VocabularyDecl).


addDecl

protected final void addDecl(VocabularyDecl decl)
Add a declared vocabulary.

Parameters:
decl - The vocabulary declaration.

getNamespace

public final String getNamespace()
Description copied from interface: Vocabulary
The namespace of the owning LexiconRelation.

Specified by:
getNamespace in interface Vocabulary
Returns:

size

public final int size()
Description copied from interface: Vocabulary
The #of defined Values.

Specified by:
size in interface Vocabulary

values

public final Iterator<BigdataValue> values()
Description copied from interface: Vocabulary
The Values in an arbitrary order.

Specified by:
values in interface Vocabulary

asValue

public final BigdataValue asValue(IV iv)
Description copied from interface: Vocabulary
Reverse lookup of an IV defined by this vocabulary.

Specified by:
asValue in interface Vocabulary
Parameters:
iv - The IV.
Returns:
The BigdataValue -or- null if the IV was not defined by the vocabulary.

get

public final IV get(Value value)
Description copied from interface: Vocabulary
The term identifier for the pre-defined Value.

Specified by:
get in interface Vocabulary
Parameters:
value - The value.
Returns:
The IV for that Value -or- null if the Value was not defined by this Vocabulary.

getConstant

public final IConstant<IV> getConstant(Value value)
Description copied from interface: Vocabulary
Returns the IConstant for the Value.

Specified by:
getConstant in interface Vocabulary
Parameters:
value - The value.
Returns:
The IConstant.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Note: The de-serialized state contains Values but not BigdataValues since the AbstractTripleStore reference is not available and we can not obtain the appropriate BigdataValueFactory instance without it. This should not matter since the only access to the Values is via get(Value) and getConstant(Value).

Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.