Class SchemaDefinitionConverter
- java.lang.Object
-
- org.incenp.linkml.core.ObjectConverter
-
- org.incenp.linkml.schema.SchemaDefinitionConverter
-
- All Implemented Interfaces:
IConverter
public class SchemaDefinitionConverter extends ObjectConverter
A converter object specifically intended to convertSchemaDefinitionobjects.A special converter is needed because LinkML’s own meta-schema violates the unicity constraint of the
Elementclass with its schema names.The
SchemaDefinitionclass, like all “schema elements” (e.g.SlotDefinition,ClassDefinition, etc.), is a subclass of theElementclass, which is the class that carries, among other slots, the identifier slot (name). This means that schema elements share the same identifier namespace.This sharing of a single identifier namespace is needed, because that’s what ensures that we cannot have, for example, a
ClassDefinitionwith the same name than aSlotDefinition(if this could happen, then we would have no way of knowing whether the range of a slot refers to the class definition or to the type definition).But LinkML’s own meta-schema violates the unicity constraint in several places, seemingly behaving as if the name of a schema was either not an identifier, or at least an identifier that does not live in the same namespace than all the other schema elements. This results in several conflicts where the name of a schema (that is imported by LinkML’s root schema) happens to be the same as the name of another element. For example, the name of the
typesschema conflicts with the name of thetypesslot, and the name of themappingsschema conflicts with the name of themappingsslots.So here, we work around that issue by basically not treating
SchemaDefinitionobjects as global objects. There should be no cases where we might need to query a schema by its name in the cache, so we can behave as if a schema definition was a non-identifiable object (which seems to be what LinkML-Py is doing).
-
-
Field Summary
-
Fields inherited from class org.incenp.linkml.core.ObjectConverter
klass
-
-
Constructor Summary
Constructors Constructor Description SchemaDefinitionConverter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectconvert(Map<String,Object> raw, String id, ConverterContext ctx)Converts a raw map into a new instance of a LinkML object.-
Methods inherited from class org.incenp.linkml.core.ObjectConverter
convert, convert, convertForSlot, convertTo, convertTo, getGlobalIdentifier, getGlobalIdentifierList, getType, normaliseList, serialise, serialise, serialiseForSlot, toIdentifier, toList, toMap
-
-
-
-
Method Detail
-
convert
public Object convert(Map<String,Object> raw, String id, ConverterContext ctx) throws LinkMLRuntimeException
Description copied from class:ObjectConverterConverts a raw map into a new instance of a LinkML object.- Overrides:
convertin classObjectConverter- Parameters:
raw- The raw map to convert.id- The global identifier of the new object. May benullif the object is not a “ globally identifiable” object (it has no identifier slot).ctx- The global converter context.- Returns:
- The newly created object.
- Throws:
LinkMLRuntimeException- If the object cannot be created, or one of its slots cannot be assigned.
-
-