com.bbn.swede.core.resources
Class OWLModel

java.lang.Object
  extended bycom.bbn.swede.core.resources.OWLElement
      extended bycom.bbn.swede.core.resources.OWLModel
All Implemented Interfaces:
IOWLElement, IOWLModel

public class OWLModel
extends OWLElement
implements IOWLModel

Implementation for the OWL model element. Creates and manages the OWL element hierarchy based on the current Eclipse workspace. Only projects with the OWL nature and OWL documents within those projects are included in this hierarchy.

Author:
jlerner

Field Summary
protected static OWLModel _model
          The singleton instance of the model.
protected  IWorkspaceRoot _workspaceRoot
          A reference to the root of the Eclipse workspace, purely for convenience.
 
Fields inherited from class com.bbn.swede.core.resources.OWLElement
_elemParent, _info, _resource, _sElementName
 
Constructor Summary
protected OWLModel()
          Creates an OWL model.
 
Method Summary
 IOWLElement add(IOWLElement e)
          Adds any IOWLElement (except IOWLProject) to the model.
 boolean addLibrary(IOWLProject project, String libraryNameToAdd)
          Tells the model to associate the globally available Ontology Library with a Semantic Web project.
 void build()
          Builds the OWL model.
 boolean contains(IResource resource)
          Indicates whether the OWL model contains an IOWLElement based on the given resource.
 IOWLElement getCorrespondingElement(IResource resource)
          Locates the OWL Element corresponding to a particular Eclipse resource.
 IOWLExternalDocument getImportedDocument(IOWLProject proj, String uri)
          Finds the IOWLExternalDocument within a project with the given URI.
 IOWLExternalDocument[] getImportedDocuments(IOWLProject proj)
          Returns all IOWLExternalDocuments within a project.
(package private) static OWLModel getModel()
          Returns the one and only instance of OWLModel.
 IOWLProject getOWLProject(String sProjectName)
          Searches the OWL model for a project.
 IOWLProject[] getOWLProjects()
          Retrieves all the OWL projects in the model.
 IWorkspace getWorkspace()
          Retrieves the Eclipose workspace the OWL model is based on.
 IOWLFolder makeOWLFolder(IFolder folder)
          Creates an OWL folder based on an Eclipse folder resource.
 boolean removeLibrary(IOWLProject project, String libraryNameToRemove)
          Tells the model to disassociate a globally available Ontology Library from a specific Semantic Web project.
 
Methods inherited from class com.bbn.swede.core.resources.OWLElement
accept, getAdapter, getCorrespondingResource, getElementInfo, getElementName, getLocalURI, getParent, getPath, getResource, getURI, isReadOnly, setElementName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.swede.core.IOWLElement
accept, getCorrespondingResource, getElementInfo, getElementName, getLocalURI, getParent, getPath, getResource, getURI, isReadOnly, setParent
 

Field Detail

_model

protected static OWLModel _model
The singleton instance of the model.


_workspaceRoot

protected IWorkspaceRoot _workspaceRoot
A reference to the root of the Eclipse workspace, purely for convenience.

Constructor Detail

OWLModel

protected OWLModel()
Creates an OWL model.

Method Detail

getModel

static OWLModel getModel()
Returns the one and only instance of OWLModel.

Returns:
The singleton instance

getOWLProject

public IOWLProject getOWLProject(String sProjectName)
Searches the OWL model for a project.

Specified by:
getOWLProject in interface IOWLModel
Parameters:
sProjectName - The name of the project to locate
Returns:
The OWL project named sProjectName, or null if the model does not contain a project by that name.

getOWLProjects

public IOWLProject[] getOWLProjects()
Retrieves all the OWL projects in the model.

Specified by:
getOWLProjects in interface IOWLModel
Returns:
An array of all OWL projects in the model.

getImportedDocuments

public IOWLExternalDocument[] getImportedDocuments(IOWLProject proj)
Returns all IOWLExternalDocuments within a project.

Specified by:
getImportedDocuments in interface IOWLModel
Parameters:
proj - Project to search
Returns:
IOWLExternalDocument[] array of OWLExternalDocuments

getImportedDocument

public IOWLExternalDocument getImportedDocument(IOWLProject proj,
                                                String uri)
Finds the IOWLExternalDocument within a project with the given URI.

Specified by:
getImportedDocument in interface IOWLModel
Parameters:
proj - IOWLProject to search
uri - URI String of specific URI
Returns:
IOWLExternalDocument requested OWLExternalDocument

getWorkspace

public IWorkspace getWorkspace()
Retrieves the Eclipose workspace the OWL model is based on.

Specified by:
getWorkspace in interface IOWLModel
Returns:
The workspace

contains

public boolean contains(IResource resource)
Description copied from interface: IOWLModel
Indicates whether the OWL model contains an IOWLElement based on the given resource.

Specified by:
contains in interface IOWLModel
Overrides:
contains in class OWLElement

build

public void build()
Builds the OWL model. Only the first level of the model (i.e. the projects) is determined, as further levels of detail are not needed until element info is requested for a project.

Specified by:
build in interface IOWLModel

addLibrary

public boolean addLibrary(IOWLProject project,
                          String libraryNameToAdd)
Description copied from interface: IOWLModel

Tells the model to associate the globally available Ontology Library with a Semantic Web project.

If the name is not that of an available library, no change will occur to the project's library registry, and the method will return false. Otherwise, the library will be added, and the method will return true.

Specified by:
addLibrary in interface IOWLModel
Parameters:
project - The project
libraryNameToAdd - The name of the library to add
Returns:
true if the library is added successfully, false if there is no library matching the specified name.

removeLibrary

public boolean removeLibrary(IOWLProject project,
                             String libraryNameToRemove)
Description copied from interface: IOWLModel

Tells the model to disassociate a globally available Ontology Library from a specific Semantic Web project.

If the name is not included in the project's registry, no change will occur, and the method will return false. Otherwise, the library will be removed, and the method will return true.

Specified by:
removeLibrary in interface IOWLModel
Parameters:
project - The project
libraryNameToRemove - The name of the library to remove
Returns:
true if the library reference is removed successfully, false if there was no reference to remove.

getCorrespondingElement

public IOWLElement getCorrespondingElement(IResource resource)
Description copied from interface: IOWLElement
Locates the OWL Element corresponding to a particular Eclipse resource.

Specified by:
getCorrespondingElement in interface IOWLElement
Overrides:
getCorrespondingElement in class OWLElement

add

public IOWLElement add(IOWLElement e)
Adds any IOWLElement (except IOWLProject) to the model.

Specified by:
add in interface IOWLModel
Parameters:
e - IOWLElement object
Returns:
IOWLElement representing the object added

makeOWLFolder

public IOWLFolder makeOWLFolder(IFolder folder)
Description copied from interface: IOWLModel
Creates an OWL folder based on an Eclipse folder resource. If the folder does not contain any OWL elements, no OWL folder will be created.

Specified by:
makeOWLFolder in interface IOWLModel
Parameters:
folder - The folder to integrate into the OWL model
Returns:
An IOWLFolder representing the folder resource. This may be one that already existed in the model, or null if folder contains now OWL elements.


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