opencitations / oc_ocdm

Object mapping library for manipulating RDF graphs that are compliant with the OpenCitations datamodel.
https://opencitations.net/
ISC License
3 stars 2 forks source link

New method transitive_closure() #7

Open iosonopersia opened 3 years ago

iosonopersia commented 3 years ago

A new method named transitive_closure() could be added to class AbstractSet.

This new method should loop over every AbstractEntity contained in the set and looking for referenced entities which are not contained in that same set. Missing entities should be then imported from the right RDF file (by using find_paths from support.py) or from a triplestore. This process should be repeated until no further entity is missing, failing in case a transitive closure of the set cannot be made.

Particular attention should be put on avoiding infinite loops.

An additional method could be then added, named is_transitively_closed() which establishes whether the set has no missing entities or not.