com.bbn.swede.core.resources
Class SWResourceManager

java.lang.Object
  extended bycom.bbn.swede.core.resources.SWResourceManager

public final class SWResourceManager
extends Object

Factory class for creating semantic web resources.

Author:
tself

Method Summary
static IOWLExternalDocument addExternalDocument(String sUri, String sLocalName, IFolder folder)
          Retrieves a document from the web and adds it to the workspace and OWL model.
static boolean containsOWL(IFolder folder)
          Recursively checks a folder and its subfolders for OWL documents.
static IOWLDocument create(IFile file, String sourceURL)
          Attempts to create an external OWL File element based on the provided Eclipse file resource and source URL.
static IOWLLibrary create(ILibraryDescriptor ild)
          Creates an OWL library element based on a given ILibraryDescriptor.
static OWLDocumentInfo createDocumentInfo(IOWLDocument doc)
          Creates a document info object for an OWL document.
static OWLElementInfo createElementInfo(IOWLElement elem)
          Creates an element info object for an OWL element.
static OWLElementInfo createElementInfo(IOWLFolder folder)
          Creates an element info object for an OWL folder.
static OWLElementInfo createElementInfo(IOWLLibrary owlLibrary)
          Creates an element info for an OWL library element.
static OWLElementInfo createElementInfo(IOWLProject project)
          Creates an element info object for an OWL project.
static IOWLClass createOWLClass(Resource res)
          Creates an OWL Class element based on a Jena resource.
static IOWLProperty createOWLProperty(Property prop)
          Creates an OWL Property element based on a Jena property.
static IOWLElement[] findChildrenOfType(IOWLElement elem, Class c)
          Searches an element's descendants for instances of a Java type.
static IOWLModel getModel()
          Provides access to the OWL model representing the entire Eclipse workspace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static IOWLLibrary create(ILibraryDescriptor ild)
Creates an OWL library element based on a given ILibraryDescriptor.

Parameters:
ild - The library descriptor
Returns:
An IOWLLibrary if successful, or null if not.

createElementInfo

public static OWLElementInfo createElementInfo(IOWLLibrary owlLibrary)
Creates an element info for an OWL library element.

Parameters:
owlLibrary - The OWL library
Returns:
An element info for owlLibrary

create

public static IOWLDocument create(IFile file,
                                  String sourceURL)
Attempts to create an external OWL File element based on the provided Eclipse file resource and source URL. If the resource provided is not an OWL document, this method will return null.

Parameters:
file - Eclipse file resource to serve as the basis for the OWL file
sourceURL - The URL the external document was imported from
Returns:
A newly created IOWLDocument, or null if the IFile provided is not an OWL document

createOWLClass

public static IOWLClass createOWLClass(Resource res)
Creates an OWL Class element based on a Jena resource.

Parameters:
res - The Jena resource to serve as the basis for the OWL class.
Returns:
The created OWL class element.

createOWLProperty

public static IOWLProperty createOWLProperty(Property prop)
Creates an OWL Property element based on a Jena property.

Parameters:
prop - The Jena property to serve as the basis for the OWL property.
Returns:
The created OWL property element.

getModel

public static IOWLModel getModel()
Provides access to the OWL model representing the entire Eclipse workspace.

Returns:
The singleton instance of IOWLModel.

addExternalDocument

public static IOWLExternalDocument addExternalDocument(String sUri,
                                                       String sLocalName,
                                                       IFolder folder)
                                                throws IOException,
                                                       CoreException
Retrieves a document from the web and adds it to the workspace and OWL model. The resulting local copy will be flagged as read-only and will retain the URL it was imported from as metadata.

Parameters:
sUri - The URI to download the document from
sLocalName - The filename to use for the local copy
folder - The folder to place the local copy in
Returns:
A newly constructed IOWLExternalDocument representing the downloaded file, or null if external document creation fails.
Throws:
IOException - if an input stream cannot be opened for sUri.
CoreException - if creation of the local copy fails

containsOWL

public static boolean containsOWL(IFolder folder)
Recursively checks a folder and its subfolders for OWL documents.

Parameters:
folder - The folder to check
Returns:
true if folder or one of its subfolders contains one or more OWL documents, false if not.

createDocumentInfo

public static OWLDocumentInfo createDocumentInfo(IOWLDocument doc)
Creates a document info object for an OWL document.

Parameters:
doc - The OWL document
Returns:
The newly constructed OWLDocumentInfo

createElementInfo

public static OWLElementInfo createElementInfo(IOWLElement elem)
Creates an element info object for an OWL element. If the element is an OWL document, a document info will be created instead.

Parameters:
elem - The OWL element
Returns:
The newly constructed OWLElementInfo

createElementInfo

public static OWLElementInfo createElementInfo(IOWLFolder folder)
Creates an element info object for an OWL folder. Folder element infos contain all the OWL folders and OWL documents that appear directly under the folder in the OWL model.

Parameters:
folder - The folder
Returns:
The newly constructed element info

createElementInfo

public static OWLElementInfo createElementInfo(IOWLProject project)
Creates an element info object for an OWL project. Project element infos contain all the OWL folders and OWL documents that appear directly under the project in the OWL model. OWL elements further down in the model will appear in their parent elements' info object.

Parameters:
project - The project
Returns:
The newly constructed element info

findChildrenOfType

public static IOWLElement[] findChildrenOfType(IOWLElement elem,
                                               Class c)
Searches an element's descendants for instances of a Java type.

Parameters:
elem - The element to search
c - The type to search for
Returns:
An array containing all OWL elements of type c below elem. This may be an empty array.


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