@@ -136,6 +136,40 @@ class OntoEnv:
136136 """
137137 ...
138138
139+ def get_dependencies_graph (
140+ self ,
141+ graph : Any ,
142+ destination_graph : Optional [Any ] = None ,
143+ recursion_depth : int = - 1 ,
144+ fetch_missing : bool = False ,
145+ rewrite_sh_prefixes : bool = True ,
146+ remove_owl_imports : bool = True ,
147+ ) -> tuple [Any , List [str ]]:
148+ """
149+ Get the dependency closure of a given graph and return it as a new graph.
150+
151+ This method will look for `owl:imports` statements in the provided `graph`,
152+ then find those ontologies within the `OntoEnv` and compute the full
153+ dependency closure. The triples of all ontologies in the closure are
154+ returned as a new graph. The original graph is not modified.
155+
156+ Args:
157+ graph: The graph to find dependencies for.
158+ destination_graph: If provided, the dependency graph will be added to this
159+ graph instead of creating a new one.
160+ recursion_depth: The maximum depth for recursive import resolution. A
161+ negative value (default) means no limit.
162+ fetch_missing: If True, will fetch ontologies that are not in the environment.
163+ rewrite_sh_prefixes: If True, will rewrite SHACL prefixes to be unique.
164+ remove_owl_imports: If True, will remove `owl:imports` statements from the
165+ returned graph.
166+
167+ Returns:
168+ A tuple containing the graph of dependencies and a list of the URIs of the
169+ imported ontologies.
170+ """
171+ ...
172+
139173 def add (self , location : Any , overwrite : bool = False , fetch_imports : bool = True ) -> str :
140174 """
141175 Add a new ontology to the OntoEnv.
0 commit comments