Skip to content

Commit 0fd935c

Browse files
committed
docs: Add docstrings for classes and methods in ontoenv.pyi file
1 parent 5561be4 commit 0fd935c

File tree

1 file changed

+131
-15
lines changed

1 file changed

+131
-15
lines changed

python/src/ontoenv.pyi

Lines changed: 131 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
from typing import Optional, List, Union
22

33
class Config:
4+
"""
5+
Configuration class for setting up the ontology environment.
6+
7+
Attributes:
8+
search_directories: Optional list of directories to search for ontologies.
9+
require_ontology_names: Flag to require ontology names.
10+
strict: Flag for strict mode.
11+
offline: Flag to operate in offline mode.
12+
resolution_policy: Policy for resolving ontologies.
13+
root: Root directory for the environment.
14+
includes: Optional list of patterns to include.
15+
excludes: Optional list of patterns to exclude.
16+
"""
417
def __init__(
518
self,
619
search_directories: Optional[List[str]] = None,
@@ -11,45 +24,148 @@ class Config:
1124
root: str = ".",
1225
includes: Optional[List[str]] = None,
1326
excludes: Optional[List[str]] = None,
14-
) -> None: ...
27+
) -> None:
28+
"""
29+
Initialize the Config object with the given parameters.
30+
"""
31+
...
1532

1633
class OntoEnv:
34+
"""
35+
Ontology Environment class for managing ontologies.
36+
37+
Attributes:
38+
config: Optional configuration object.
39+
path: Path to the ontology environment.
40+
recreate: Flag to recreate the environment.
41+
read_only: Flag to set the environment as read-only.
42+
"""
1743
def __init__(
1844
self,
1945
config: Optional[Config] = None,
2046
path: Optional[Union[str, Path]] = ".",
2147
recreate: bool = False,
2248
read_only: bool = False,
23-
) -> None: ...
49+
) -> None:
50+
"""
51+
Initialize the OntoEnv object with the given parameters.
52+
"""
53+
...
54+
55+
def update(self) -> None:
56+
"""
57+
Update the ontology environment by reloading all ontologies.
58+
"""
59+
...
60+
61+
def is_read_only(self) -> bool:
62+
"""
63+
Check if the ontology environment is read-only.
64+
65+
Returns:
66+
A boolean indicating if the environment is read-only.
67+
"""
68+
...
69+
70+
def __repr__(self) -> str:
71+
"""
72+
Return a string representation of the OntoEnv object.
73+
"""
74+
...
2475

25-
def update(self) -> None: ...
76+
def import_graph(self, destination_graph, uri: str) -> None:
77+
"""
78+
Import a graph from the given URI into the destination graph.
2679
27-
def is_read_only(self) -> bool: ...
80+
Args:
81+
destination_graph: The graph to import into.
82+
uri: The URI of the graph to import.
83+
"""
84+
...
2885

29-
def __repr__(self) -> str: ...
86+
def list_closure(self, uri: str) -> List[str]:
87+
"""
88+
List the ontologies in the imports closure of the given ontology.
3089
31-
def import_graph(self, destination_graph, uri: str) -> None: ...
90+
Args:
91+
uri: The URI of the ontology.
3292
33-
def list_closure(self, uri: str) -> List[str]: ...
93+
Returns:
94+
A list of ontology names in the closure.
95+
"""
96+
...
3497

3598
def get_closure(
3699
self,
37100
uri: str,
38101
destination_graph: Optional = None,
39102
rewrite_sh_prefixes: bool = False,
40103
remove_owl_imports: bool = False,
41-
) -> None: ...
104+
) -> None:
105+
"""
106+
Merge all graphs in the imports closure of the given ontology into a single graph.
107+
108+
Args:
109+
uri: The URI of the ontology.
110+
destination_graph: Optional graph to add the merged graph to.
111+
rewrite_sh_prefixes: Flag to rewrite SH prefixes.
112+
remove_owl_imports: Flag to remove OWL imports.
113+
"""
114+
...
115+
116+
def dump(self, includes: Optional[str] = None) -> None:
117+
"""
118+
Print the contents of the OntoEnv.
119+
120+
Args:
121+
includes: Optional string to filter the output.
122+
"""
123+
...
124+
125+
def import_dependencies(self, graph) -> None:
126+
"""
127+
Import the dependencies of the given graph into the graph.
128+
129+
Args:
130+
graph: The graph to import dependencies into.
131+
"""
132+
...
133+
134+
def add(self, location) -> None:
135+
"""
136+
Add a new ontology to the OntoEnv.
42137
43-
def dump(self, includes: Optional[str] = None) -> None: ...
138+
Args:
139+
location: The location of the ontology to add.
140+
"""
141+
...
44142

45-
def import_dependencies(self, graph) -> None: ...
143+
def refresh(self) -> None:
144+
"""
145+
Refresh the OntoEnv by re-loading all remote graphs and loading any local graphs which have changed.
146+
"""
147+
...
46148

47-
def add(self, location) -> None: ...
149+
def get_graph(self, uri: str) -> None:
150+
"""
151+
Export the graph with the given URI to an rdflib.Graph.
48152
49-
def refresh(self) -> None: ...
153+
Args:
154+
uri: The URI of the graph to export.
155+
"""
156+
...
50157

51-
def get_graph(self, uri: str) -> None: ...
158+
def get_ontology_names(self) -> List[str]:
159+
"""
160+
Get the names of all ontologies in the OntoEnv.
52161
53-
def get_ontology_names(self) -> List[str]: ...
162+
Returns:
163+
A list of ontology names.
164+
"""
165+
...
54166

55-
def to_rdflib_dataset(self) -> None: ...
167+
def to_rdflib_dataset(self) -> None:
168+
"""
169+
Convert the OntoEnv to an rdflib.Dataset.
170+
"""
171+
...

0 commit comments

Comments
 (0)