Class MappingTSVWriterVisitor
java.lang.Object
org.incenp.obofoundry.sssom.slots.SlotVisitorBase<Mapping>
org.incenp.obofoundry.sssom.MappingTSVWriterVisitor
- All Implemented Interfaces:
ISlotVisitor<Mapping>
A visitor to to turn the slots of a
Mapping object into a list of
values that can be written to a TSV or CSV file.
This class is primarily intended to be used by TSVWriter, but it may
be reused whenever mappings need to be serialised into TSV or CSV.
After the slots of a Mapping object have been visited, use the
getValues() methods to obtain a list of string values ready to be
written to a TSV/CSV files. The values will be in the same order as the order
in which the slots have been visited.
-
Constructor Summary
ConstructorsConstructorDescriptionMappingTSVWriterVisitor(PrefixManager prefixManager, List<ExtensionDefinition> extraSlots, boolean isCSV) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the values ready for writing.voidreset()Prepare this object for visiting a newMappingobject.voidVisits a date-typed slot.voidvisit(DoubleSlot<Mapping> slot, Mapping object, Double value) Visits a double-typed slot.voidvisit(EntityReferenceSlot<Mapping> slot, Mapping object, String value) Visits a slot that holds an entity reference.voidVisits a multi-valued slot that holds entity references.voidvisit(ExtensionSlot<Mapping> slot, Mapping object, Map<String, ExtensionValue> extensions) Visits a slot that holds extension values (non-standard metadata).voidVisits a generic slot.voidVisits a multi-valued string-typed slot.
-
Constructor Details
-
MappingTSVWriterVisitor
public MappingTSVWriterVisitor(PrefixManager prefixManager, List<ExtensionDefinition> extraSlots, boolean isCSV) Creates a new instance.- Parameters:
prefixManager- The prefix manager to use to shorten entity references into their CURIE forms.extraSlots- The definitions for the extension slots; ifnull, any extension slot will be ignored.isCSV- Iftrue, the values will be generated so that they can written to a CSV file. The default is to prepare values suitable for writing to a TSV file.
-
-
Method Details
-
getValues
-
reset
public void reset()Prepare this object for visiting a newMappingobject. -
visit
Description copied from interface:ISlotVisitorVisits a generic slot.This method is normally not used as all slots in a SSSOM object have more precise types. But it can be used to implement behaviours that should be common to several slot types.
- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.value- The value of the slot.
-
visit
Description copied from interface:ISlotVisitorVisits a slot that holds an entity reference.- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.value- The value of the slot.
-
visit
Description copied from interface:ISlotVisitorVisits a multi-valued string-typed slot.- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.values- The values of the slot.
-
visit
Description copied from interface:ISlotVisitorVisits a multi-valued slot that holds entity references.- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.values- The values of the slot.
-
visit
Description copied from interface:ISlotVisitorVisits a double-typed slot.- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.value- The value of the slot.
-
visit
Description copied from interface:ISlotVisitorVisits a date-typed slot.- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.value- The value of the slot.
-
visit
public void visit(ExtensionSlot<Mapping> slot, Mapping object, Map<String, ExtensionValue> extensions) Description copied from interface:ISlotVisitorVisits a slot that holds extension values (non-standard metadata).- Specified by:
visitin interfaceISlotVisitor<Mapping>- Overrides:
visitin classSlotVisitorBase<Mapping>- Parameters:
slot- The slot that is being visited.object- The object to which the slot is attached.extensions- The values of the slot.
-