diff --git a/ontopy/factpluspluswrapper/sync_factpp.py b/ontopy/factpluspluswrapper/sync_factpp.py index 3ebd6d160..aa3655414 100644 --- a/ontopy/factpluspluswrapper/sync_factpp.py +++ b/ontopy/factpluspluswrapper/sync_factpp.py @@ -1,4 +1,5 @@ -import collections +from collections import defaultdict +from collections.abc import Sequence import rdflib from rdflib import URIRef, RDF, RDFS, OWL @@ -39,7 +40,7 @@ def sync_reasoner_factpp(ontology_or_world=None, infer_property_values=False, world = ontology_or_world elif isinstance(ontology_or_world, Ontology): world = ontology_or_world.world - elif isinstance(ontology_or_world, collections.Sequence): + elif isinstance(ontology_or_world, Sequence): world = ontology_or_world[0].world else: world = owlready2.default_world @@ -70,8 +71,8 @@ def sync_reasoner_factpp(ontology_or_world=None, infer_property_values=False, print('*** Load inferred ontology') # Check all rdfs:subClassOf relations in the inferred graph and add # them to the world if they are missing - new_parents = collections.defaultdict(list) - new_equivs = collections.defaultdict(list) + new_parents = defaultdict(list) + new_equivs = defaultdict(list) entity_2_type = {} for s, p, o in g2.triples((None, None, None)): diff --git a/ontopy/nadict.py b/ontopy/nadict.py index ada46ffc5..b4c5eec34 100644 --- a/ontopy/nadict.py +++ b/ontopy/nadict.py @@ -4,7 +4,7 @@ NA stands for Nested and Attribute. """ -import collections +from collections.abc import Mapping import copy @@ -66,7 +66,7 @@ def __setitem__(self, key, value): else: self._dict[key] = value else: - if isinstance(value, collections.abc.Mapping): + if isinstance(value, Mapping): self._dict[key] = NADict(value) else: self._dict[key] = value