Package org.incenp.obofoundry.kgcl
Class SimpleLabelResolver
java.lang.Object
org.incenp.obofoundry.kgcl.SimpleLabelResolver
- All Implemented Interfaces:
ILabelResolver
- Direct Known Subclasses:
OntologyBasedLabelResolver
A basic implementation of the
ILabelResolver interface.
This implementation is backed up by a simple dictionary mapping labels to
their corresponding identifiers. When a new ID is requested (with
getNewId(String)), it mints a temporary ID suitable for use with the
AutoIDAllocator class.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SimpleLabelResolver
public SimpleLabelResolver()
-
-
Method Details
-
resolve
Description copied from interface:ILabelResolverFinds the identifier corresponding to the given label.- Specified by:
resolvein interfaceILabelResolver- Parameters:
label- The label to resolve.- Returns:
- The identifier of the entity with the given label, or
nullif the label could not be resolved.
-
getNewId
Description copied from interface:ILabelResolverMints a new identifier for the given label.This method is used when a KGCL “create” instruction does not include an identifier for the node to be created (e.g.,
create class 'my new class'). It shall return a new identifier for the node to be created.Any subsequent call to
ILabelResolver.resolve(String)with the same label shall return the same identifier.- Specified by:
getNewIdin interfaceILabelResolver- Parameters:
label- The label for which an identifier is requested.- Returns:
- The newly minted identifier.
-
add
Description copied from interface:ILabelResolverRegisters a new label-to-identifier mapping.- Specified by:
addin interfaceILabelResolver- Parameters:
label- The label to register.identifier- Its corresponding identifier.
-