Skip to content

Commit

Permalink
fix(importers): use content_object instead of root_object
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jan 20, 2025
1 parent c8ccac4 commit 4fd90d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apis_ontology/importers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ def create_instance(self):
data["sameas"] = data["sameas"].split("|")
sa = Uri.objects.filter(uri__in=data["sameas"])
if sa.count() == 1:
return sa.first().root_object
return sa.first().content_object
elif sa.count() > 1:
root_set = set([s.root_object for s in sa])
root_set = set([s.content_object for s in sa])
if len(root_set) > 1:
raise IntegrityError(
f"Multiple objects found for sameAs URIs {data['sames']}. "
f"This indicates a data integrity problem as these URIs should be unique."
)
else:
return sa.first().root_object
return sa.first().content_object
modelfields = [field.name for field in self.model._meta.fields]
data_croped = {key: data[key] for key in data if key in modelfields}
subj = self.model.objects.create(**data_croped)
Expand Down

0 comments on commit 4fd90d7

Please sign in to comment.