com.hp.hpl.jena.daml.common
Class DAMLLoader

java.lang.Object
  |
  +--com.hp.hpl.jena.daml.common.DAMLLoader

public class DAMLLoader
extends java.lang.Object

Loads DAML ontologies from either input readers or named files. The declarations in the DAML source are loaded into a DAMLModel object. Will also process embedded Ontology elements, to load imported ontologies. This behaviour can be controlled, by using setLoadImportedOntologies(boolean) to turn the loading of imports on or off overall, or by using

Version:
CVS info: $Id: DAMLLoader.java,v 1.5 2002/02/22 17:04:11 ian_dickinson Exp $
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static java.lang.String FILE_URI_PREFIX
          Prefix for a URI to a file
static long STATUS_INPUT_UNAVAILABLE
          Status flag: input source is not available (e.g.
static long STATUS_IO_ERROR
          Status flag: an I/O error occurred - details will be in log file.
static long STATUS_MISC_ERROR
          Status flag: a misc error occurred - report a bug to the maintainer!
static long STATUS_OK
          Status flag: OK
static long STATUS_SYNTAX_ERROR
          Status flag: a syntax error occurred in the DAML file- details will be in log file.
 
Method Summary
 void addImportBlock(java.lang.String uri)
          Add the given URI to the list of ontology urls that will not be loaded if encountered in an imports statement in the loaded ontology.
 DAMLModel getDAMLModel()
          Answer the DAML model that this loader is using to store the loaded definitions.
 java.util.Iterator getImportBlockList()
          Answer an iterator over the set of URI strings that will not be loaded if encountered in an import statement, even if autoloading of ontologies (see getLoadImportedOntologies()) is on.
 boolean getLoadImportedOntologies()
          Answer true if the loader is to process imported ontologies (except for the ones on the don't load list).
 long getStatus()
          Answer the status of the last operation.
 boolean getUseImportBlocking()
          Answer true if well-known URI's will be blocked from being autoloaded.
 boolean isBlockedImport(java.lang.String uri)
          Answer true if a given URI is blocked from being imported: that is, it is assumed to be well-known and will not be automatically imported.
 boolean isLoadedOntology(java.lang.String uri)
          Answer true if the ontology identified by the given URI has been loaded.
 void removeImportBlock(java.lang.String uri)
          Remove the given URI from the list of ontology urls that will not be loaded if encountered in an imports statement in the loaded ontology.
 void resetStatus()
          Clear the status flags.
 void setLoadImportedOntologies(boolean loadImports)
          Set the flag to control whether imported ontologies are to be loaded.
 void setUseImportBlocking(boolean useBlocking)
          Set the flag to control whether certain well-known imports are blocked from being automatically loaded if they encountered in an imports statement.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_URI_PREFIX

public static final java.lang.String FILE_URI_PREFIX
Prefix for a URI to a file

STATUS_OK

public static final long STATUS_OK
Status flag: OK

STATUS_INPUT_UNAVAILABLE

public static final long STATUS_INPUT_UNAVAILABLE
Status flag: input source is not available (e.g. a file cannot be opened)

STATUS_IO_ERROR

public static final long STATUS_IO_ERROR
Status flag: an I/O error occurred - details will be in log file.

STATUS_SYNTAX_ERROR

public static final long STATUS_SYNTAX_ERROR
Status flag: a syntax error occurred in the DAML file- details will be in log file.

STATUS_MISC_ERROR

public static final long STATUS_MISC_ERROR
Status flag: a misc error occurred - report a bug to the maintainer!
Method Detail

getDAMLModel

public DAMLModel getDAMLModel()
Answer the DAML model that this loader is using to store the loaded definitions.
Returns:
A reference to a knowledge store.

getImportBlockList

public java.util.Iterator getImportBlockList()
Answer an iterator over the set of URI strings that will not be loaded if encountered in an import statement, even if autoloading of ontologies (see getLoadImportedOntologies()) is on.
Returns:
iterator over the set of blocked imports, as URI strings.

isBlockedImport

public boolean isBlockedImport(java.lang.String uri)
Answer true if a given URI is blocked from being imported: that is, it is assumed to be well-known and will not be automatically imported. Will answer false if import blocking is switched off altogether (see setUseImportBlocking(boolean)).
Parameters:
uri - The uri to be tested
Returns:
true if the URI should not be loaded.

addImportBlock

public void addImportBlock(java.lang.String uri)
Add the given URI to the list of ontology urls that will not be loaded if encountered in an imports statement in the loaded ontology.
Parameters:
uri - The URI of the ontology to block from autoloading, as a String.

removeImportBlock

public void removeImportBlock(java.lang.String uri)
Remove the given URI from the list of ontology urls that will not be loaded if encountered in an imports statement in the loaded ontology. Has no effect if the URI is not in the list.
Parameters:
uri - The URI of the ontology to no longer block from autoloading, as a String.

getLoadImportedOntologies

public boolean getLoadImportedOntologies()
Answer true if the loader is to process imported ontologies (except for the ones on the don't load list). Default true.
Returns:
True if imported ontologies should be loaded as they are encountered.

setLoadImportedOntologies

public void setLoadImportedOntologies(boolean loadImports)
Set the flag to control whether imported ontologies are to be loaded. Default true.
Parameters:
loadImports - If true, ontologies that are included in this one, via the <imports> element are loaded as they are discovered.

setUseImportBlocking

public void setUseImportBlocking(boolean useBlocking)
Set the flag to control whether certain well-known imports are blocked from being automatically loaded if they encountered in an imports statement. Note that automatic loading of all imports can be switched of with setLoadImportedOntologies(boolean).
Parameters:
useBlocking - If true, well-known URI's will be blocked from being autoloaded, even if autoloading is on

getUseImportBlocking

public boolean getUseImportBlocking()
Answer true if well-known URI's will be blocked from being autoloaded.
Returns:
True if imports are blocked.
See Also:
setUseImportBlocking(boolean)

isLoadedOntology

public boolean isLoadedOntology(java.lang.String uri)
Answer true if the ontology identified by the given URI has been loaded.
Parameters:
uri - The URI of the ontology
Returns:
true if the ontology has already been loaded by the knowledge store.

getStatus

public long getStatus()
Answer the status of the last operation. Returns a set of status flags (or'ed together) from all operations since the last resetStatus().
Returns:
The current status, as a set of flags or'ed together into a long.

resetStatus

public void resetStatus()
Clear the status flags. Resets the status to STATUS_OK. Note that status is cleared automatically at the start of a read.


Copyright © 2001 Hewlett-Packard. All Rights Reserved.