Class SimpleChangeConverter

java.lang.Object
org.incenp.linkml.core.ObjectConverter
org.incenp.obofoundry.kgcl.SimpleChangeConverter
All Implemented Interfaces:
org.incenp.linkml.core.IConverter

public class SimpleChangeConverter extends org.incenp.linkml.core.ObjectConverter
A custom LinkML converter for SimpleChange objects.

A custom converter is needed here because, even though the new_value and old_value slots of the SimpleChange class are typed as strings, they are sometimes expected to contain CURIEs, when the value that is being affected by the change is itself an IRI (for example, when the change is a PredicateChange).

When that happens, the fact that old_value (resp. new_value) is a CURIE is indicated by the old_value_type (resp. new_value_type) slot, which is set to curie. This is a KGCL-specific mechanism that cannot be handled generically at the level of the LinkML runtime, so we must deal with it here.

An alternative option would be to deal with those values in a post-parsing step, in which we iterate over SimpleChange-typed changes and expand their old_value / new_value slots as needed. But custom converters offer a nice way of ensuring that expansion is done for us during the parsing phase.

  • Field Summary

    Fields inherited from class org.incenp.linkml.core.ObjectConverter

    klass
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    convertTo(Map<String,Object> raw, Object dest, org.incenp.linkml.core.ConverterContext ctx)
     
    serialise(Object object, boolean withIdentifier, org.incenp.linkml.core.ConverterContext ctx)
     

    Methods inherited from class org.incenp.linkml.core.ObjectConverter

    convert, convert, convert, convertForSlot, convertTo, getGlobalIdentifier, getGlobalIdentifierList, getType, normaliseList, serialise, serialiseForSlot, toIdentifier, toList, toMap

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • convertTo

      public void convertTo(Map<String,Object> raw, Object dest, org.incenp.linkml.core.ConverterContext ctx) throws org.incenp.linkml.core.LinkMLRuntimeException
      Overrides:
      convertTo in class org.incenp.linkml.core.ObjectConverter
      Throws:
      org.incenp.linkml.core.LinkMLRuntimeException
    • serialise

      public Map<String,Object> serialise(Object object, boolean withIdentifier, org.incenp.linkml.core.ConverterContext ctx) throws org.incenp.linkml.core.LinkMLRuntimeException
      Overrides:
      serialise in class org.incenp.linkml.core.ObjectConverter
      Throws:
      org.incenp.linkml.core.LinkMLRuntimeException