This feature allows users to create their own CORE module, thus customizing document add/remove operations and search behavior.
There are several steps to load and use custom CORE module.
Create a class implementing the CoreAPI interface.
This will be the object, providing all functionality for adding, retrieving and removing documents and their features, collection management and search variations.
Example:
Create a class that will initialize and return your CORE module object
This class must implement the CustomCoreImplementation interface. The interface provides two methods:
- init(EntityAPI entityApi, DocumentRepositoryAPI documentRepository, SemanticRepositoryAPI semanticRepository) - initializes your CORE module; the parameters for this method are the full set of related objects that the CORE module may use
- getCoreInstance() - returns the initialized CoreAPI object
All implementing classes must have a constructor without parameters in order to be dynamically loaded using reflection. After the new object is created, the init(...) method is called. Developers can put various code there, as well as in the getCoreInstance() method, which would return the object to serve as CoreAPI.
Example:
Configure KIM to use the custom CoreAPI object
In order to load the custom CoreAPI object, one should:
- pack the custom code as a jar library and add it to KIM classpath (put the .jar file in the <KIM_HOME/lib directory)
- update the corresponding configuration options in <KIM_HOME/config/document.repository.properties>
Parameter com.ontotext.kim.KIMConstants.CORE_INDEX_ADDON should be set to other while parameter com.ontotext.kim.KIMConstants.CUSTOM_CORE_CLASS_NAME should point to the class implementing the CustomCoreImplementation interface.