Class KBLoader
- java.lang.Object
-
- openllet.core.KBLoader
-
- All Implemented Interfaces:
openllet.shared.tools.Logging
- Direct Known Subclasses:
KRSSLoader
public abstract class KBLoader extends java.lang.Object implements openllet.shared.tools.LoggingA 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.
- Author:
- Evren Sirin
-
-
Constructor Summary
Constructors Constructor Description KBLoader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclear()Resets the loader and clear any previously loaded ontologies.KnowledgeBasecreateKB(java.lang.String... fileNameList)abstract KnowledgeBasegetKB()Returns the KB instance associated with the loader.java.util.logging.LoggergetLogger()abstract voidload()Load any previously parsed ontologiesvoidparse(java.lang.String... fileNames)Parse one or more files to the internal representation supported by this loader.abstract voidsetIgnoreImports(boolean valueAsBoolean)Instruct loader to respect or ignore imports.java.lang.StringtoString()
-
-
-
Method Detail
-
getLogger
public java.util.logging.Logger getLogger()
- Specified by:
getLoggerin interfaceopenllet.shared.tools.Logging
-
clear
public abstract void clear()
Resets the loader and clear any previously loaded ontologies.
-
createKB
public KnowledgeBase createKB(java.lang.String... fileNameList)
Convenience function toclear,parse,load, andgetKB(). 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.- Parameters:
fileNameList- list of file URIs- Returns:
- KnowledgeBase instance with the given ontologies loaded
- See Also:
FileUtils.getFileURIs(String...)
-
getKB
public abstract KnowledgeBase getKB()
Returns the KB instance associated with the loader. The functionload()should be called beforehand.- Returns:
- KnowledgeBase instance
-
load
public abstract void load()
Load any previously parsed ontologies
-
parse
public void parse(java.lang.String... fileNames)
Parse one or more files to the internal representation supported by this loader. 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.- Parameters:
fileNames- list of file URIs- See Also:
FileUtils.getFileURIs(String...)
-
setIgnoreImports
public abstract void setIgnoreImports(boolean valueAsBoolean)
Instruct loader to respect or ignore imports.- Parameters:
valueAsBoolean-
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-