com.bbn.swede.core
Class OWLCore

java.lang.Object
  extended byPlugin
      extended bycom.bbn.swede.core.OWLCore

public class OWLCore
extends Plugin

Plugin class for the core package. Contains static convenience methods for working with OWL core classes.

Author:
jlerner, tself
See Also:
Serialized Form

Field Summary
static String CONFIG_BUILDER
          Unique identifier for OWL config builder.
static String MARKER_OWL_VALIDATOR
          Unique identifier for validation error markers.
static String MARKER_UNPARSEABLE
          Unique identifier for Invalid XML markers.
static String OWL_NATURE
          Unique identifier of the Semantic Web nature.
static QualifiedName PERSISTENT_SOURCE_URL
          Persistent property identifier for external document source URL.
static QualifiedName PERSISTENT_URI
          Persistent property identifier for document URI.
static String PLUGIN_ID
          Unique identifier of the SWeDE core plug-in.
static String PREFERENCE_LIBRARY_AUTOMATIC_UPDATE
          Preference controlling whether Ontology Libraries are updated automatically or manually.
static String PREFERENCE_LIBRARY_UPDATE_SCHEDULE_FREQUENCY_STR
          Preference controlling the frequency of automatic Ontology Library updates.
static String PREFERENCE_LIBRARY_UPDATE_SCHEDULE_LAST_TIME_STR
          Preference that stores the time of the most recent update to the Ontology Libraries.
static String SYNTAX_BUILDER
          Unique identifier for OWL syntax builder.
 
Constructor Summary
OWLCore()
          Default constructor.
 
Method Summary
static void addJavaNature(IProject project)
          Configures a project as Java project.
static void addOWLNature(IProject project)
          Configures a project as an OWL project by adding the OWL nature and its associated builders.
static String getID()
          Retrieves the plugin's ID from the resource bundle.
static OWLCore getOWLCore()
          Provides access to the one and only instance of OWLCore.
static Plugin getPlugin()
          Provides access to the one and only instance of the plugin class.
static boolean isValidURI(String uri)
          Checks if a string is a valid URI.
static void logError(String sPluginID, String sMessage, Exception e)
          Alerts the user to an error and records it in the Eclipse error log.
static void logWarning(String sPluginID, String sMessage, Exception e)
          Records an error in the Eclipse error log without alerting the user.
static IEditorPart openEditor(IOWLDocument doc)
          Opens an OWL document for editing in the OWL editor.
static void removeJavaNature(IProject project)
          Removes the Java nature and the associated builders from a project.
static void removeOWLNature(IProject project)
          Removes the OWL nature and the associated builders from a project.
static void trace(String id, String msg, boolean error)
          Sends output to all extenders of com.bbn.swede.core.traceWriter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGIN_ID

public static final String PLUGIN_ID
Unique identifier of the SWeDE core plug-in.

See Also:
Constant Field Values

PREFERENCE_LIBRARY_AUTOMATIC_UPDATE

public static final String PREFERENCE_LIBRARY_AUTOMATIC_UPDATE
Preference controlling whether Ontology Libraries are updated automatically or manually. This is a boolean preference.

See Also:
Constant Field Values

PREFERENCE_LIBRARY_UPDATE_SCHEDULE_FREQUENCY_STR

public static final String PREFERENCE_LIBRARY_UPDATE_SCHEDULE_FREQUENCY_STR
Preference controlling the frequency of automatic Ontology Library updates. This is a long preference, indicating the number of milliseconds between updates.

See Also:
Constant Field Values

PREFERENCE_LIBRARY_UPDATE_SCHEDULE_LAST_TIME_STR

public static final String PREFERENCE_LIBRARY_UPDATE_SCHEDULE_LAST_TIME_STR
Preference that stores the time of the most recent update to the Ontology Libraries. This is a long preference, indicating the date of the last update in milliseconds.

See Also:
Constant Field Values

SYNTAX_BUILDER

public static final String SYNTAX_BUILDER
Unique identifier for OWL syntax builder. See com.bbn.swede.core.builders package for implementation.

See Also:
Constant Field Values

CONFIG_BUILDER

public static final String CONFIG_BUILDER
Unique identifier for OWL config builder. See com.bbn.swede.core.builders and com.bbn.swede.core.config for implementation.

See Also:
Constant Field Values

PERSISTENT_URI

public static final QualifiedName PERSISTENT_URI
Persistent property identifier for document URI. This is included solely to support migration of pre-0.9 SWeDE projects, as this information is now stored in the .swprojectinfo file.


PERSISTENT_SOURCE_URL

public static final QualifiedName PERSISTENT_SOURCE_URL
Persistent property identifier for external document source URL. This is included solely to support migration of pre-0.9 SWeDE projects, as this information is now stored in the .swprojectinfo file.


OWL_NATURE

public static final String OWL_NATURE
Unique identifier of the Semantic Web nature.

See Also:
Constant Field Values

MARKER_OWL_VALIDATOR

public static final String MARKER_OWL_VALIDATOR
Unique identifier for validation error markers.

See Also:
Constant Field Values

MARKER_UNPARSEABLE

public static final String MARKER_UNPARSEABLE
Unique identifier for Invalid XML markers.

See Also:
Constant Field Values
Constructor Detail

OWLCore

public OWLCore()
Default constructor.

Method Detail

getPlugin

public static Plugin getPlugin()
Provides access to the one and only instance of the plugin class.

Returns:
The singleton instance.

getOWLCore

public static OWLCore getOWLCore()
Provides access to the one and only instance of OWLCore.

Returns:
The singleton instance.

addOWLNature

public static void addOWLNature(IProject project)
Configures a project as an OWL project by adding the OWL nature and its associated builders.

Parameters:
project - The project

addJavaNature

public static void addJavaNature(IProject project)
Configures a project as Java project. This includes adding the Java nature (and associated builders) as well as creating a classpath entry for the JRE container and creating a source folder. The source folder is configured to ignore OWL documents so as not to create superfulous copies of *.owl files in the output directory when the compiler is run.

Parameters:
project - The project

removeOWLNature

public static void removeOWLNature(IProject project)
                            throws CoreException
Removes the OWL nature and the associated builders from a project. If the project does not have the OWL nature, nothing happens.

Parameters:
project - The project
Throws:
CoreException - if there is a problem accessing the project descriptor to remove the nature.

openEditor

public static IEditorPart openEditor(IOWLDocument doc)
                              throws PartInitException
Opens an OWL document for editing in the OWL editor. If an editor is already open for the specified document, it will be activated. This method will automatically take steps to ensure that the editor is opened from a UI thread without deadlocking the current thread.

Parameters:
doc - The document to open in the editor
Returns:
The editor that was opened or activated. This will always be an instance of OWLEditor, but is returned as an IEditorPart to avoid a circular dependency between the SWeDE Core and SWeDE Editor plug-ins.
Throws:
PartInitException - if an error occurs opening the editor

removeJavaNature

public static void removeJavaNature(IProject project)
                             throws CoreException
Removes the Java nature and the associated builders from a project. If the project does not have the Java nature, nothing happens.

Parameters:
project - The project
Throws:
CoreException - if there is a problem accessing the project descriptor to remove the nature.

getID

public static String getID()
Retrieves the plugin's ID from the resource bundle.

Returns:
The plugin ID.

isValidURI

public static boolean isValidURI(String uri)
Checks if a string is a valid URI.

Parameters:
uri - The URI to check
Returns:
true if uri is valid, false if it is malformed.

trace

public static void trace(String id,
                         String msg,
                         boolean error)
Sends output to all extenders of com.bbn.swede.core.traceWriter.

Parameters:
id - A string to help identify the source of this trace message
msg - The trace message
error - true if msg is an error message, false if it is not.

logWarning

public static void logWarning(String sPluginID,
                              String sMessage,
                              Exception e)
Records an error in the Eclipse error log without alerting the user. This method should be used only for lesser problems that are unlikely to have a noticeable impact on the behavior of SWeDE. Major problems that may render some aspect(s) of SWeDe unusable should be logged as errors so that the user knows there is a potential problem.

Parameters:
sPluginID - The ID of the pluging where the error occured.
sMessage - The message to display as the cause of the error.
e - The exception that caused the error.
See Also:
logError(String, String, Exception)

logError

public static void logError(String sPluginID,
                            String sMessage,
                            Exception e)
Alerts the user to an error and records it in the Eclipse error log. Use of this method should be limited to only severe errors that are likely to cause noticeable problems in SWeDE. Lesser errors that should be safe if they go unnoticed should be logged as warnings.

Parameters:
sPluginID - The ID of the pluging where the error occured.
sMessage - The message to display as the cause of the error.
e - The exception that caused the error.
See Also:
logWarning(String, String, Exception)


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