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.ObjectConverterA custom LinkML converter for SimpleChange objects.A custom converter is needed here because, even though the
new_valueandold_valueslots of theSimpleChangeclass 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 aPredicateChange).When that happens, the fact that
old_value(resp.new_value) is a CURIE is indicated by theold_value_type(resp.new_value_type) slot, which is set tocurie. 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_valueslots as needed. But custom converters offer a nice way of ensuring that expansion is done for us during the parsing phase.
-
-
Constructor Summary
Constructors Constructor Description SimpleChangeConverter(Class<org.incenp.obofoundry.kgcl.model.SimpleChange> type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconvertTo(Map<String,Object> raw, Object dest, org.incenp.linkml.core.ConverterContext ctx)Map<String,Object>serialise(Object object, boolean withIdentifier, org.incenp.linkml.core.ConverterContext ctx)
-
-
-
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:
convertToin classorg.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:
serialisein classorg.incenp.linkml.core.ObjectConverter- Throws:
org.incenp.linkml.core.LinkMLRuntimeException
-
-