Skip to content

Commit 70ac4e7

Browse files
authored
Update API reference (#226)
* Merge the API reference page into the additional information section. * Update the API reference panel on the main page. * Add missing functions and classes to API reference. Select methods that are meant to be in the public API, hide methods that are not. * Trick Sphinx Automodule into thinking that some module members have different names and live in different modules. * Update requirements.txt.
1 parent 9acdf4b commit 70ac4e7

File tree

4 files changed

+135
-54
lines changed

4 files changed

+135
-54
lines changed

docs/api_reference.md

Lines changed: 114 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,165 @@
11
# API Reference
22

3-
This document is for developers and/or advanced users of OSP-core, it contains all API details.
3+
This document is for advanced users of SimPhoNy and defines all its public API
4+
details. This means that only when there is a breaking change in any of the
5+
methods listed on this page, the major version number of SimPhoNy
6+
will change accordingly, as prescribed by the
7+
[Semantic Versioning Specification](https://semver.org/spec/v2.0.0.html#spec-item-8).
48

5-
## CUDS
9+
**Do not rely** on the stability of methods not listed on this page.
10+
11+
If the `__init__` method is not listed for a class, you are **not expected
12+
to instantiate such class by yourself**, and thus doing so is unsupported.
13+
14+
## Ontology management
615

716
```{eval-rst}
8-
.. autoclass:: osp.core.cuds.Cuds
9-
:members:
10-
:show-inheritance:
17+
.. autofunction:: simphony_osp.tools.pico.install
18+
19+
.. autofunction:: simphony_osp.tools.pico.uninstall
20+
21+
.. autofunction:: simphony_osp.tools.pico.packages
22+
23+
.. autofunction:: simphony_osp.tools.pico.namespaces
1124
```
1225

13-
## Ontology interface
26+
## Terminological- and assertional knowledge
1427

1528
```{eval-rst}
16-
.. autoclass:: osp.core.ontology.namespace.OntologyNamespace
17-
:members:
18-
:special-members: __getattr__, __getitem__, __contains__, __iter__, __eq__
29+
.. autoclass:: simphony_osp.ontology.OntologyNamespace
30+
:members: from_iri, from_label, from_suffix, get, iri, name
31+
:special-members: __getattr__, __getitem__, __contains__, __iter__, __eq__,
32+
__len__
1933
:show-inheritance:
2034
21-
.. autoclass:: osp.core.ontology.entity.OntologyEntity
22-
:members:
35+
.. autoclass:: simphony_osp.ontology.OntologyEntity
36+
:members: direct_subclasses, direct_superclasses, identifier, iri, is_subclass_of, is_superclass_of, iter_labels, label, label_lang, label_literal, namespace, session, subclasses, superclasses, triples
37+
:special-members: __bool__, __eq__
38+
39+
.. autoclass:: simphony_osp.ontology.OntologyClass
40+
:members: attributes, optional_attributes, axioms
41+
:special-members: __call__
2342
:show-inheritance:
2443
25-
.. autoclass:: osp.core.ontology.oclass.OntologyClass
26-
:members:
44+
.. autoclass:: simphony_osp.ontology.Restriction
45+
:members: quantifier, target, relationship, attribute, rtype
2746
:show-inheritance:
2847
29-
.. autoclass:: osp.core.ontology.oclass_restriction.Restriction
48+
.. autoclass:: simphony_osp.ontology.RESTRICTION_QUANTIFIER
3049
:members:
50+
:undoc-members:
3151
:show-inheritance:
3252
33-
.. autoclass:: osp.core.ontology.oclass_composition.Composition
53+
.. autoclass:: simphony_osp.ontology.RESTRICTION_TYPE
3454
:members:
55+
:undoc-members:
3556
:show-inheritance:
3657
37-
.. autoclass:: osp.core.ontology.relationship.OntologyRelationship
38-
:members:
58+
.. autoclass:: simphony_osp.ontology.Composition
59+
:members: operator, operands
3960
:show-inheritance:
4061
41-
.. autoclass:: osp.core.ontology.attribute.OntologyAttribute
62+
.. autoclass:: simphony_osp.ontology.COMPOSITION_OPERATOR
4263
:members:
64+
:undoc-members:
4365
:show-inheritance:
44-
```
45-
46-
## Sessions
4766
48-
```{eval-rst}
49-
.. autoclass:: osp.core.session.session.Session
50-
:members:
67+
.. autoclass:: simphony_osp.ontology.OntologyRelationship
68+
:members: inverse
5169
:show-inheritance:
5270
53-
.. autoclass:: osp.core.session.core_session.CoreSession
54-
:members:
71+
.. autoclass:: simphony_osp.ontology.OntologyAttribute
72+
:members: datatype
5573
:show-inheritance:
5674
57-
.. autoclass:: osp.core.session.wrapper_session.WrapperSession
58-
:members:
75+
.. autoclass:: simphony_osp.ontology.OntologyAnnotation
5976
:show-inheritance:
6077
61-
.. autoclass:: osp.core.session.sim_wrapper_session.SimWrapperSession
62-
:members:
78+
.. autoclass:: simphony_osp.ontology.OntologyIndividual
79+
:members: classes, is_a, connect, disconnect, get, iter, operations, attributes
80+
:special-members: __getattr__, __setattr__, __getitem__, __setitem__, __delitem__
6381
:show-inheritance:
6482
65-
.. autoclass:: osp.core.session.db.db_wrapper_session.DbWrapperSession
66-
:members:
83+
.. autoclass:: simphony_osp.ontology.RelationshipSet
84+
:members: update, intersection_update, difference_update, symmetric_difference_update, inverse
85+
:inherited-members: individual, predicate, one, any, all, isdisjoint, clear, pop, copy, difference, discard, intersection, issubset, issuperset, add, remove, symmetric_difference, union
86+
:special-members: __iter__, __contains__, __invert__, __len__, __le__, __lt__, __ne__, __gt__, __ge__, __and__, __radd__, __ror__, __rsub__, __rxor__, __or__, __xor__, __iadd__, __isub__, __ior__, __iand__, __ixor__
87+
:exclude-members: iter_low_level, prevent_class_filtering
88+
89+
.. autoclass:: simphony_osp.ontology.AttributeSet
90+
:members: update, intersection_update, difference_update, symmetric_difference_update
91+
:inherited-members: individual, predicate, one, any, all, isdisjoint, clear, pop, copy, difference, discard, intersection, issubset, issuperset, add, remove, symmetric_difference, union
92+
:special-members: __iter__, __contains__, __len__, __le__, __lt__, __ne__, __gt__, __ge__, __and__, __radd__, __ror__, __rsub__, __rxor__, __or__, __xor__, __iadd__, __isub__, __ior__, __iand__, __ixor__
93+
94+
.. autoclass:: simphony_osp.ontology.AnnotationSet
95+
:members: update, intersection_update, difference_update, symmetric_difference_update
96+
:inherited-members: individual, predicate, one, any, all, isdisjoint, clear, pop, copy, difference, discard, intersection, issubset, issuperset, add, remove, symmetric_difference, union
97+
:special-members: __iter__, __contains__, __len__, __le__, __lt__, __ne__, __gt__, __ge__, __and__, __radd__, __ror__, __rsub__, __rxor__, __or__, __xor__, __iadd__, __isub__, __ior__, __iand__, __ixor__
98+
99+
.. autoclass:: simphony_osp.ontology.ResultEmptyError
67100
:show-inheritance:
68101
69-
.. autoclass:: osp.core.session.db.sql_wrapper_session.SqlWrapperSession
70-
:members:
102+
.. autoclass:: simphony_osp.ontology.MultipleResultsError
71103
:show-inheritance:
72104
```
73105

74-
## Registry
106+
## Sessions and wrappers
75107

76108
```{eval-rst}
77-
.. autoclass:: osp.core.session.registry.Registry
78-
:members:
109+
.. autoclass:: simphony_osp.session.Session
110+
:members: commit, compute, close, sparql, identifier, update, from_label, add, delete, clear, get, iter
111+
:inherited-members: locked
112+
:special-members: __init__, __iter__, __contains__, __enter__, __exit__, __len__,
113+
:exclude-members: bind, default-ontology, driver, entity_cache_timestamp, from_identifier, from_identifier_typed, get_default_environment, get_default_session, get_entities, get_identifiers, get_namespace, get_namespace_bind, graph, iter_labels, label_languages, label_predicates, load_parser, lock, unlock, merge, namespaces, ontology, set_default_session, subscribers, unbind, unlock, update, iter_identifiers, default_ontology
114+
115+
.. autoclass:: simphony_osp.session.SessionSet
116+
:members: update, intersection_update, difference_update, symmetric_difference_update
117+
:inherited-members: individual, predicate, one, any, all, isdisjoint, clear, pop, copy, difference, discard, intersection, issubset, issuperset, add, remove, symmetric_difference, union
118+
:special-members: __iter__, __contains__, __len__, __le__, __lt__, __ne__, __gt__, __ge__, __and__, __radd__, __ror__, __rsub__, __rxor__, __or__, __xor__, __iadd__, __isub__, __ior__, __iand__, __ixor__
119+
120+
.. autoclass:: simphony_osp.session.core_session
79121
:show-inheritance:
122+
123+
.. autofunction:: simphony_osp.tools.import_file
124+
125+
.. autofunction:: simphony_osp.tools.export_file
80126
```
81127

82-
## Utilities
128+
### Search
83129

84130
```{eval-rst}
85-
.. automodule:: osp.core.utils
86-
:imported-members:
87-
:members:
131+
.. autofunction:: simphony_osp.tools.search.find
132+
133+
.. autofunction:: simphony_osp.tools.search.find_by_identifier
134+
135+
.. autofunction:: simphony_osp.tools.search.find_by_class
136+
137+
.. autofunction:: simphony_osp.tools.search.find_by_attribute
138+
139+
.. autofunction:: simphony_osp.tools.search.find_relationships
140+
141+
.. autofunction:: simphony_osp.tools.search.sparql
88142
```
89143

90-
### pico
144+
## Visualization
91145

92146
```{eval-rst}
93-
.. automodule:: osp.core.pico
94-
:members: install, uninstall, packages, namespaces
147+
148+
.. autofunction:: simphony_osp.tools::semantic2dot
149+
150+
.. autoclass:: simphony_osp.tools.semantic2dot::Semantic2Dot
151+
:members: render, _repr_mimebundle_
152+
153+
.. autofunction:: simphony_osp.tools.pretty_print
154+
```
155+
156+
## Tools
157+
158+
```{eval-rst}
159+
160+
.. autofunction:: simphony_osp.tools.host
161+
162+
.. autofunction:: simphony_osp.tools.branch
163+
164+
.. autofunction:: simphony_osp.tools.relationships_between
95165
```

docs/conf.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,21 @@
6565
latex_elements = {"figure_align": "H"}
6666

6767
nbsphinx_allow_errors = True
68+
69+
70+
def setup(app):
71+
import simphony_osp.ontology
72+
73+
# Override names and modules of members of "simphony_osp.ontology" in the
74+
# API reference.
75+
for obj in simphony_osp.ontology.__all__:
76+
item = getattr(simphony_osp.ontology, obj)
77+
setattr(item, "__name__", obj)
78+
setattr(item, "__module__", simphony_osp.ontology.__name__)
79+
80+
# Override names and modules of members of "simphony_osp.session" in the
81+
# API reference.
82+
for obj in simphony_osp.session.__all__:
83+
item = getattr(simphony_osp.session, obj)
84+
setattr(item, "__name__", obj)
85+
setattr(item, "__module__", simphony_osp.session.__name__)

docs/index.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ SimPhoNy enables:
5454
5555
Python API of CUDS, the *Session* classes, and other utilities
5656
57-
```{link-button} api_ref.html
57+
```{link-button} api_reference.html
5858
:text: To the API reference
5959
:classes: btn-outline-primary stretched-link
6060
@@ -113,17 +113,10 @@ usage/visualization
113113

114114
```{toctree}
115115
:hidden: true
116-
:caption: API Reference
116+
:caption: Additional Info
117117
:maxdepth: 2
118118
119119
api_reference
120-
```
121-
122-
```{toctree}
123-
:hidden: true
124-
:caption: Additional Information
125-
:maxdepth: 2
126-
127120
contribute
128121
links
129122
license

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
git+https://github.com/simphony/osp-core.git#egg=osp-core
1+
simphony-osp == 4.0.0rc3
22
jinja2 >= 3.0.3, < 4
33
jupyter >= 1.0.0, < 2
44
markupsafe >= 2.1.1, < 3

0 commit comments

Comments
 (0)