Class Slot<T>
java.lang.Object
org.incenp.obofoundry.sssom.slots.Slot<T>
- Type Parameters:
T- The type of SSSOM object (e.g. Mapping, MappingSet, etc.).
- Direct Known Subclasses:
CurieMapSlot,DateSlot,DoubleSlot,EntityTypeSlot,ExtensionDefinitionSlot,ExtensionSlot,MappingCardinalitySlot,PredicateModifierSlot,StringSlot,VersionSlot
Represents a metadata slot on a SSSOM object.
-
Method Summary
Modifier and TypeMethodDescription<V> Vaccept(ISimpleSlotVisitor<T, V> visitor, T target, Object value) Accepts a simple visitor.voidaccept(ISlotVisitor<T> visitor, T target, Object value) Accepts a visitor.Gets the earliest version of the SSSOM specification this slot is compatible with.getName()Gets the name of the slot as it appears in the SSSOM specification (e.g.,mapping_justification,subject_id, etc.).Class<?> getType()Gets the underlying Java type for the slot.getURI()Gets the URI of the slot.Gets the value of the slot for a given object.booleanIndicates whether the slot is intended to hold an entity reference.booleanIndicates whether the slot is a "propagatable slot".booleanisURI()Indicates whether the slot is expected to contain a URI.voidSets the value of the slot for a given object.voidTries setting the value of the slot for a given object, using a string as input.
-
Method Details
-
getName
Gets the name of the slot as it appears in the SSSOM specification (e.g.,mapping_justification,subject_id, etc.).- Returns:
- The slot name as per the SSSOM specification, independently of the implementation.
-
getURI
Gets the URI of the slot.For most slots, this is simply the slot’s name appended to the SSSOM IRI prefix (e.g.
https://w3id.org/sssom/subject_label), but some slots use a URI borrowed from another specification instead (for example, the URI for thecreator_idishttp://purl.org/dc/terms/creator).- Returns:
- The URI associated with the slot.
-
isEntityReference
public boolean isEntityReference()Indicates whether the slot is intended to hold an entity reference. Entity references are represented as strings but need to be treated differently.- Returns:
trueis the slot is intended to hold an entity reference, otherwisefalse.
-
isPropagatable
public boolean isPropagatable()Indicates whether the slot is a "propagatable slot".- Returns:
trueif the slot can be propagated, otherwisefalse.
-
isURI
public boolean isURI()Indicates whether the slot is expected to contain a URI.- Returns:
trueif the slot is defined as having a URI range, otherwisefalse.
-
getCompliantVersion
Gets the earliest version of the SSSOM specification this slot is compatible with. This is the version in which the slot was first introduced.- Returns:
- The earliest compatible SSSOM version.
-
getType
Gets the underlying Java type for the slot.- Returns:
- The Java data type used to store the slot's data.
-
accept
Accepts a visitor.- Parameters:
visitor- The visitor to accept.target- The object this slot is attached to.value- The value of the slot.
-
accept
Accepts a simple visitor. A “simple” visitor is one that does not distinguish between the different types of slots, i.e. the same method is used to visit all slots.- Type Parameters:
V- The type of object returned by the visitor.- Parameters:
visitor- The visitor to accept.target- The object this slot is attached to.value- The value of the slot.- Returns:
- The valued returned by the visitor.
-
getValue
Gets the value of the slot for a given object.- Parameters:
object- The object (e.g. a mapping or a mapping set) from which to retrieve the value.- Returns:
- The value of the slot in that object.
-
setValue
Sets the value of the slot for a given object.- Parameters:
object- The object (e.g. a mapping or a mapping set) for which the slot should be set.value- The value to assign to the slot on the given object.
-
setValue
Tries setting the value of the slot for a given object, using a string as input.This method only works for String-typed slots, but classes for other slot types can override it to allow parsing a string into another type of value.
- Parameters:
object- The object (e.g. a mapping or a mapping set) for which the slot should be set.value- The value to assign to the slot on the given object.- Throws:
UnsupportedOperationException- When this method is called on a slot that is not string-typed.
-