Skip to content

Commit

Permalink
Merge branch 'master' into flb/owlready0.46
Browse files Browse the repository at this point in the history
  • Loading branch information
francescalb authored Oct 29, 2024
2 parents f4b547d + d3f8e88 commit 19044fb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ontopy/excelparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
if input_ontology:
onto = input_ontology
catalog = {}
# Since we will remove newly created python_name added
# by owlready2 in the triples, we keep track of those
# that come from the input ontology
pyname_triples_to_keep = list(
onto.get_unabbreviated_triples(
predicate="http://www.lesfleursdunormal.fr/static/_downloads/"
"owlready_ontology.owl#python_name"
)
)
else: # Create new ontology
onto, catalog = get_metadata_from_dataframe(
metadata, base_iri, imports=imports
Expand Down Expand Up @@ -457,14 +466,22 @@ def create_ontology_from_pandas( # pylint:disable=too-many-locals,too-many-bran
key: set(value) for key, value in entities_with_errors.items()
}

# Remove triples with predicate 'python_name' added by owlready2i>0.45

# Remove triples with predicate 'python_name' added by owlready2
onto._del_data_triple_spod( # pylint: disable=protected-access
p=onto._abbreviate( # pylint: disable=protected-access
"http://www.lesfleursdunormal.fr/static/_downloads/"
"owlready_ontology.owl#python_name"
)
)

# Add back the triples python name triples that were in the input_ontology.
if input_ontology:
for triple in pyname_triples_to_keep:
onto._add_data_triple_spod( # pylint: disable=protected-access
s=triple[0], p=triple[1], o=triple[2]
)

return onto, catalog, entities_with_errors


Expand Down

0 comments on commit 19044fb

Please sign in to comment.