org.openanzo.glitter.rdf
Class BlankNodeManager

java.lang.Object
  extended by org.openanzo.glitter.rdf.BlankNodeManager

public class BlankNodeManager
extends java.lang.Object

The BlankNodeManager is a factory for creating blank nodes. It allows the creation of a stack of scopes for blank node labels - blank nodes across different scopes can share labels while maintaining their distinct identity.

Author:
lee

Nested Class Summary
 class BlankNodeManager.BlankNode
          Represents a blank node, identified by an index.
 
Constructor Summary
BlankNodeManager(boolean prohibitLabelReuse)
           
BlankNodeManager(boolean prohibitLabelReuse, int initialIndex)
           
 
Method Summary
 void enterLabelScope()
          Push a new label scope onto the stack.
 void exitLabelScope()
          Pop a label scope off of the stack.
 BlankNodeManager.BlankNode getBlankNode()
          A new BlankNodeManager.BlankNode with an auto-generated label.
 BlankNodeManager.BlankNode getBlankNode(java.lang.String label)
          Returns a BlankNodeManager.BlankNode for the given label.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlankNodeManager

public BlankNodeManager(boolean prohibitLabelReuse,
                        int initialIndex)

BlankNodeManager

public BlankNodeManager(boolean prohibitLabelReuse)
Parameters:
prohibitLabelReuse - If true, throws an InvalidBlankNodeLabelException if a blank node is created with a duplicate label to another blank node from a different scope.
Method Detail

enterLabelScope

public void enterLabelScope()
Push a new label scope onto the stack. Should be paired with exitLabelScope().


exitLabelScope

public void exitLabelScope()
Pop a label scope off of the stack. Should pair with a previous call to enterLabelScope().


getBlankNode

public BlankNodeManager.BlankNode getBlankNode(java.lang.String label)
                                        throws InvalidBlankNodeLabelException
Returns a BlankNodeManager.BlankNode for the given label. If there is an existing blank node in this scope with this label, that BlankNodeManager.BlankNode gets returned. Otherwise, a new blank node gets minted for this scope with this label.

Parameters:
label - label of blanknode to convert
Returns:
a BlankNodeManager.BlankNode for the given label
Throws:
InvalidBlankNodeLabelException - If this BlankNodeManager prohibits blank node label reuse and this label occurs in some other scope already.

getBlankNode

public BlankNodeManager.BlankNode getBlankNode()
A new BlankNodeManager.BlankNode with an auto-generated label.

Returns:
A new BlankNodeManager.BlankNode with an auto-generated label.


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.