|
40 | 40 | TypeDefinition, |
41 | 41 | TypeDefinitionName, |
42 | 42 | ) |
| 43 | +from linkml_runtime.processing import inlining |
43 | 44 | from linkml_runtime.utils.context_utils import map_import, parse_import_map |
44 | 45 | from linkml_runtime.utils.formatutils import camelcase, is_empty, sfx, underscore |
45 | 46 | from linkml_runtime.utils.namespaces import Namespaces |
@@ -1566,8 +1567,7 @@ def induced_slot( |
1566 | 1567 | v = self.schema.default_range |
1567 | 1568 | if v is not None: |
1568 | 1569 | setattr(induced_slot, metaslot_name, v) |
1569 | | - if slot.inlined_as_list: |
1570 | | - slot.inlined = True |
| 1570 | + slot.inlined, slot.inlined_as_list = inlining.process(induced_slot, self.schema_map, logger) |
1571 | 1571 | if slot.identifier or slot.key: |
1572 | 1572 | slot.required = True |
1573 | 1573 | if mangle_name: |
@@ -1693,18 +1693,7 @@ def is_inlined(self, slot: SlotDefinition, imports: bool = True) -> bool: |
1693 | 1693 | :param imports: |
1694 | 1694 | :return: |
1695 | 1695 | """ |
1696 | | - range = slot.range |
1697 | | - if range in self.all_classes(): |
1698 | | - if slot.inlined or slot.inlined_as_list: |
1699 | | - return True |
1700 | | - |
1701 | | - id_slot = self.get_identifier_slot(range, imports=imports) |
1702 | | - if id_slot is None: |
1703 | | - # must be inlined as has no identifier |
1704 | | - return True |
1705 | | - # not explicitly declared inline and has an identifier: assume is ref, not inlined |
1706 | | - return False |
1707 | | - return False |
| 1696 | + return inlining.is_inlined(slot, self.schema_map, logger) |
1708 | 1697 |
|
1709 | 1698 | def slot_applicable_range_elements(self, slot: SlotDefinition) -> list[ClassDefinitionName]: |
1710 | 1699 | """Retrieve all applicable metamodel elements for a slot range. |
@@ -2060,13 +2049,7 @@ def materialize_derived_schema(self) -> SchemaDefinition: |
2060 | 2049 | if metaslot_val is not None: |
2061 | 2050 | setattr(slot, metaslot, metaslot_val) |
2062 | 2051 | slot_range_pk_slot_name = None |
2063 | | - if isinstance(slot_range_element, ClassDefinition): |
2064 | | - slot_range_pk_slot_name = self.get_identifier_slot(slot_range_element.name, use_key=True) |
2065 | | - if not slot_range_pk_slot_name: |
2066 | | - slot.inlined = True |
2067 | | - slot.inlined_as_list = True |
2068 | | - if slot.inlined_as_list: |
2069 | | - slot.inlined = True |
| 2052 | + slot.inlined, slot.inlined_as_list = inlining.process(slot, self.schema_map, logger) |
2070 | 2053 | if slot.identifier or slot.key: |
2071 | 2054 | slot.required = True |
2072 | 2055 | cls.attributes[slot.name] = slot |
|
0 commit comments