public abstract class KBLoader extends Object
A generic class that allows the creation of Pellet KnowledgeBase instances and load ontologies. The actual parsing and loading operations is implemented by the concrete extensions of this class where each implementation uses a different parser and loader, e.g. Jena or OWLAPI.
Loading to a KnowledgeBase instance is typically a two-phase process. First the ontology is parsed into a representation supported by the loader, e.g. Jena Model or OWLAPI Ontology. Then this object is processed by Pellet and loaded to the KnowledgeBase class.
This class provides fined-grained control over how parsing and loading is done along with a convenience function to do everything at once. Concrete implementations of this class provides access to the ontology object used by the underlying loader.
| Modifier and Type | Field and Description |
|---|---|
protected String |
inputFormat |
static Logger |
log |
| Constructor and Description |
|---|
KBLoader() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
clear()
Resets the loader and clear any previously loaded ontologies.
|
KnowledgeBase |
createKB(String... fileNameList)
|
abstract KnowledgeBase |
getKB()
Returns the KB instance associated with the loader.
|
abstract void |
load()
Load any previously parsed ontologies
|
void |
parse(String... fileNames)
Parse one or more files to the internal representation supported by this
loader.
|
protected abstract void |
parseFile(String fileURI)
Parse a single file to the internal representation supported by this
loader.
|
abstract void |
setIgnoreImports(boolean valueAsBoolean)
Instruct loader to respect or ignore imports.
|
String |
toString() |
public abstract void clear()
public KnowledgeBase createKB(String... fileNameList)
clear, parse, load, and getKB().
Note: this method previously accepted a list of regular expressions instead
of file URIs. This behavior has been changed as of 2.0.0-rc7.fileNameList - list of file URIsFileUtils.getFileURIs(String...)public abstract KnowledgeBase getKB()
load() should be called beforehand.public abstract void load()
public void parse(String... fileNames)
fileNameList - list of file URIsFileUtils.getFileURIs(String...)public abstract void setIgnoreImports(boolean valueAsBoolean)
valueAsBoolean - protected abstract void parseFile(String fileURI)
fileURI - the URI of the file to be loadedCopyright © 2019. All rights reserved.