Class 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.

    • Constructor Detail

      • SimpleChangeConverter

        public SimpleChangeConverter​(Class<org.incenp.obofoundry.kgcl.model.SimpleChange> type)
    • Method Detail

      • 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