@@ -199,7 +199,9 @@ def handle_node(node):
199199
200200 return rdf_graph
201201
202- def import_ontology (self , config : ImportConfig ):
202+ def import_ontology (
203+ self , config : ImportConfig
204+ ) -> Dict [str , List [model .OswBaseModel ]]:
203205 """Imports an ontology into OSW
204206
205207 Parameters
@@ -209,7 +211,8 @@ def import_ontology(self, config: ImportConfig):
209211
210212 Returns
211213 -------
212- None
214+ Dict[str, model.OswBaseModel]: a dictionary of the imported ontologies
215+ in the form of <prefix>: [<OswBaseModel>] pairs
213216 """
214217
215218 # overwrite the default document loader to load relative context from the wiki
@@ -335,13 +338,13 @@ def node_sort(n):
335338 # )
336339 # )
337340
338- if not self .import_config .dry_run :
339- self ._store_ontologies (
340- OntologyImporter .StoreOntologiesParam (
341- ontologies = self .import_config .ontologies ,
342- entities = self ._entities ,
343- )
341+ return self ._store_ontologies (
342+ OntologyImporter .StoreOntologiesParam (
343+ ontologies = self .import_config .ontologies ,
344+ entities = self ._entities ,
345+ dryrun = self .import_config .dry_run ,
344346 )
347+ )
345348
346349 def _sanitize_graph (self ) -> None :
347350 ps = self .parser_settings
@@ -774,7 +777,9 @@ class StoreOntologiesParam(model.OswBaseModel):
774777 ontologies : Optional [List [model .OwlOntology ]]
775778 dryrun : Optional [bool ] = False
776779
777- def _store_ontologies (self , param : StoreOntologiesParam = None ):
780+ def _store_ontologies (
781+ self , param : StoreOntologiesParam = None
782+ ) -> Dict [str , List [model .OswBaseModel ]]:
778783 entities = self ._entities
779784 dry_run = self .import_config .dry_run
780785 ontologies = self .import_config .ontologies
@@ -819,3 +824,4 @@ def _store_ontologies(self, param: StoreOntologiesParam = None):
819824 ontology = onto , entities = prefix_dict [prefix ]
820825 )
821826 )
827+ return prefix_dict
0 commit comments