com.bbn.swede.core.dom
Interface IOWLAbstractSyntaxTree

All Known Implementing Classes:
OAST

public interface IOWLAbstractSyntaxTree

Interface for OWL abstract syntax trees. This interface provides convenience methods for interacting with the document as a whole and retrieving specific nodes.

Author:
jlerner

Method Summary
 void addOASTChangeListener(IOASTChangeListener ocl)
          Registers a new OASTChangeListener.
 String getBaseURI()
          Returns the base URI for the document represented by this OAST.
 OntModel getJenaModel()
          Returns a Jena model representing the OAST.
 IOWLDocument getNamespace(String uri)
          Finds the IOWLDocument corresponding to a namespace URI.
 OASTNode getNode(int offset)
          Finds the lowest-level node in the tree that contains a given offset.
 OASTNode getNode(String sUri)
          Finds a node that represents a specific URI.
 DocumentRoot getRoot()
          Returns the root node of the OAST.
 boolean hasModel()
          Indicates whether the tree's Jena model has been built.
 boolean isReadOnly()
          Indicates whether the tree represents a read-only document.
 List listNamespaces()
          Lists all namespace URIs in the current project.
 void removeOASTChangeListener(IOASTChangeListener ocl)
          Unregisters an OASTChangeListener.
 void run(IOASTRunnable action)
          Runs the given action as an atomic OWL abstract syntax tree operation.
 

Method Detail

getRoot

public DocumentRoot getRoot()
Returns the root node of the OAST.

Returns:
The root node.

getJenaModel

public OntModel getJenaModel()
Returns a Jena model representing the OAST. If the model does not already exist, it will be built automatically.

Returns:
The Jena model for this OAST

getNode

public OASTNode getNode(int offset)
Finds the lowest-level node in the tree that contains a given offset.

Parameters:
offset - The offset to find
Returns:
The node containing the offset or the document root if no containing node is found

getNode

public OASTNode getNode(String sUri)
Finds a node that represents a specific URI.

Parameters:
sUri - The URI to find
Returns:
The node that corresponds to the URI, or null if no such node is found

getNamespace

public IOWLDocument getNamespace(String uri)
Finds the IOWLDocument corresponding to a namespace URI.

Parameters:
uri - URI of the namespace to locate
Returns:
The IOWLDocument for the specified URI, or null if the project does not contain a document with the specified base URI

getBaseURI

public String getBaseURI()
Returns the base URI for the document represented by this OAST.

Returns:
The document's base URI

listNamespaces

public List listNamespaces()
Lists all namespace URIs in the current project.

Returns:
A java.util.List of all known document URIs

addOASTChangeListener

public void addOASTChangeListener(IOASTChangeListener ocl)
Registers a new OASTChangeListener. Listeners receive notifications before and after nodes are added or removed from the OAST.

Parameters:
ocl - The listener to register

removeOASTChangeListener

public void removeOASTChangeListener(IOASTChangeListener ocl)
Unregisters an OASTChangeListener. It will no longer receive OASTAboutToChange and OASTChange notifications.

Parameters:
ocl - The listener to unregister. If ocl is not registered as an OASTChangeListener, this method does nothing.

run

public void run(IOASTRunnable action)
         throws OASTException
Runs the given action as an atomic OWL abstract syntax tree operation. All OAST modifications that occur within the runnable will be combined into a single event so that listeners are only notified once.

Parameters:
action - The action to perform.
Throws:
OASTException - if this OAST is read-only and action attempts to modify it

hasModel

public boolean hasModel()
Indicates whether the tree's Jena model has been built.

Returns:
true if the tree is maintaining a Jena model, false if it has not been built yet.

isReadOnly

public boolean isReadOnly()
Indicates whether the tree represents a read-only document. A read-only OAST cannot be modified with the OAST API. An OASTException will be thrown by any API method that is called on a read-only OAST.

Returns:
true if the OAST is read-only, false if it can be modified.


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.