Skip to content

Commit d1ba4b1

Browse files
committed
Use a property set
1 parent e44be56 commit d1ba4b1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

schema_automator/importers/rdfs_import_engine.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,14 @@ def generate_rdfs_properties(
224224
"""
225225
Converts the RDFS properties in the graph to LinkML SlotDefinitions
226226
"""
227-
props: List[URIRef] = []
227+
# All property IDs
228+
props: set[URIRef] = set()
228229

229230
# Add explicit properties, ie those with a RDF.type mapping
230231
for rdfs_property_metaclass in self._rdfs_metamodel_iri(SlotDefinition.__name__):
231232
for p in g.subjects(RDF.type, rdfs_property_metaclass):
232233
if isinstance(p, URIRef):
233-
props.append(p)
234+
props.add(p)
234235

235236
# Add implicit properties, ie those that are the domain or range of a property
236237
for metap in (
@@ -239,9 +240,9 @@ def generate_rdfs_properties(
239240
):
240241
for p, _, _o in g.triples((None, metap, None)):
241242
if isinstance(p, URIRef):
242-
props.append(p)
243+
props.add(p)
243244

244-
for p in set(props):
245+
for p in props:
245246
self.track_uri(p, g)
246247
sn = self.iri_to_name(p)
247248
#: kwargs for SlotDefinition

0 commit comments

Comments
 (0)