Skip to content

Commit

Permalink
Merge pull request #252 from linkml/domain-of-dups
Browse files Browse the repository at this point in the history
avoid duplicate class names in `domain_of` slot
  • Loading branch information
sujaypatil96 authored Mar 2, 2023
2 parents 168072b + 8ff4bdc commit c0eded8
Show file tree
Hide file tree
Showing 2 changed files with 464 additions and 364 deletions.
7 changes: 4 additions & 3 deletions linkml_runtime/utils/schemaview.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,8 @@ def induced_slot(self, slot_name: SLOT_NAME, class_name: CLASS_NAME = None, impo
induced_slot.alias = underscore(slot_name)
for c in self.all_classes().values():
if induced_slot.name in c.slots or induced_slot.name in c.attributes:
induced_slot.domain_of.append(c.name)
if c.name not in induced_slot.domain_of:
induced_slot.domain_of.append(c.name)
return deepcopy(induced_slot)

@lru_cache()
Expand Down Expand Up @@ -1592,7 +1593,7 @@ def delete_type(self, type_name: TypeDefinitionName) -> None:
:param type_name: type to be deleted
:return:
"""
del self.schema.typees[type_name]
del self.schema.types[type_name]
self.set_modified()

def delete_subset(self, subset_name: SubsetDefinitionName) -> None:
Expand Down Expand Up @@ -1723,4 +1724,4 @@ def materialize_derived_schema(self) -> SchemaDefinition:
derived_schema.subsets[subset.name] = subset
for enum in [deepcopy(e) for e in self.all_enums().values()]:
derived_schema.enums[enum.name] = enum
return derived_schema
return derived_schema
Loading

0 comments on commit c0eded8

Please sign in to comment.