Skip to content

Commit

Permalink
Merge pull request #44 from djarecka/rm_slots
Browse files Browse the repository at this point in the history
removing slots that are also in the imported schema
  • Loading branch information
djarecka authored Oct 4, 2024
2 parents 4137112 + dbc0547 commit 6a36690
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bkbit/model_converters/sheets_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from linkml_runtime.linkml_model.meta import SchemaDefinition, SlotDefinition
from linkml_runtime.utils.schema_as_dict import schema_as_dict
from linkml_runtime.utils.schemaview import SchemaView
from schemasheets import schemamaker as sm
import pandas as pd

Expand Down Expand Up @@ -132,6 +133,18 @@ def bican_fix(schema: SchemaDefinition) -> SchemaDefinition:
# removing names from the slots
if "name" in schema.slots:
del schema.slots["name"]

# removing slots that are from the imported schemas
slots_from_imports = []
for el in schema.imports:
if Path(f"{el}.yaml").exists():
sv = SchemaView(f'{el}.yaml')
slots_from_imports.extend(sv.schema.slots.keys())
slots_to_remove = list(set(schema.slots) & set(slots_from_imports))

for nm in slots_to_remove:
del schema.slots[nm]

# removing empty subsets that are from imported biolink schema
biolink_subsets = []
for nm, subs in schema.subsets.items():
Expand Down

0 comments on commit 6a36690

Please sign in to comment.