@@ -38,7 +38,7 @@ def download(_ontology: str, _url: str) -> None:
38
38
urllib .request .urlretrieve (_url , output_file )
39
39
print (f"Finish Downloading { _ontology } " )
40
40
41
- def _build_url (_ontology : str ):
41
+ def _build_url (_ontology : str ) -> str :
42
42
onto_ref_data = ontology_info [_ontology ]
43
43
return f"{ onto_ref_data ['source' ]} /{ onto_ref_data ['version' ]} /{ ontology .lower ()} .{ onto_ref_data ['filetype' ]} "
44
44
@@ -77,9 +77,10 @@ def _decompress(infile: str, tofile: str) -> None:
77
77
def _load_ontology_object (onto_file : str ) -> owlready2 .entity .ThingClass :
78
78
"""
79
79
Read ontology data from file and write into a python object
80
-
80
+
81
81
:param onto_file: filepath to ontology file
82
- :return:
82
+
83
+ :return: owlready2.entity.ThingClass: Ontology Term Object, with metadata parsed from ontology file
83
84
"""
84
85
world = owlready2 .World ()
85
86
onto = world .get_ontology (onto_file )
@@ -110,14 +111,14 @@ def _get_ancestors(onto_class: owlready2.entity.ThingClass, onto_name: str) -> L
110
111
return ancestors
111
112
112
113
113
- def _extract_ontology_term_metadata (onto : owlready2 .entity .ThingClass ) -> dict :
114
+ def _extract_ontology_term_metadata (onto : owlready2 .entity .ThingClass ) -> Dict [ str , Any ] :
114
115
"""
115
116
Extract relevant metadata from ontology object and save into a dictionary following our JSON Schema
116
117
117
118
:param: onto: Ontology Object to Process
118
- :return: Dict[str, str ] map of ontology term IDs to pertinent metadata from ontology files
119
+ :return: Dict[str, Any ] map of ontology term IDs to pertinent metadata from ontology files
119
120
"""
120
- term_dict = dict ()
121
+ term_dict : Dict [ str , Any ] = dict ()
121
122
for onto_term in onto .classes ():
122
123
term_id = onto_term .name .replace ("_" , ":" )
123
124
0 commit comments