Skip to content

Commit

Permalink
deploy: c1eab4b
Browse files Browse the repository at this point in the history
  • Loading branch information
Demirrr committed Sep 16, 2024
1 parent a2c8684 commit bd5c856
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 24 deletions.
47 changes: 35 additions & 12 deletions _modules/owlapy/owl_ontology.html
Original file line number Diff line number Diff line change
Expand Up @@ -929,13 +929,40 @@ <h1>Source code for owlapy.owl_ontology</h1><div class="highlight"><pre>
<span class="k">yield</span> <span class="n">OWLObjectProperty</span><span class="p">(</span><span class="n">IRI</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">op</span><span class="o">.</span><span class="n">iri</span><span class="p">))</span></div>


<div class="viewcode-block" id="Ontology.properties_in_signature">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.properties_in_signature">[docs]</a>
<span class="k">def</span> <span class="nf">properties_in_signature</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">OWLProperty</span><span class="p">]:</span>
<span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">object_properties_in_signature</span><span class="p">()</span>
<span class="k">yield from</span> <span class="bp">self</span><span class="o">.</span><span class="n">data_properties_in_signature</span><span class="p">()</span></div>


<div class="viewcode-block" id="Ontology.individuals_in_signature">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.individuals_in_signature">[docs]</a>
<span class="k">def</span> <span class="nf">individuals_in_signature</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">OWLNamedIndividual</span><span class="p">]:</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_onto</span><span class="o">.</span><span class="n">individuals</span><span class="p">():</span>
<span class="k">yield</span> <span class="n">OWLNamedIndividual</span><span class="p">(</span><span class="n">IRI</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">i</span><span class="o">.</span><span class="n">iri</span><span class="p">))</span></div>


<div class="viewcode-block" id="Ontology.tbox_axioms">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.tbox_axioms">[docs]</a>
<span class="k">def</span> <span class="nf">tbox_axioms</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">Iterable</span><span class="p">:</span>
<span class="c1"># @TODO: CD: Return all information between owl classes, e.g. subclass or disjoint</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">&quot;will be implemented in future&quot;</span><span class="p">)</span></div>

<div class="viewcode-block" id="Ontology.abox_axioms_between_individuals">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.abox_axioms_between_individuals">[docs]</a>
<span class="k">def</span> <span class="nf">abox_axioms_between_individuals</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">Iterable</span><span class="p">:</span>
<span class="c1"># @TODO: CD: Return all information between owl_individuals, i.e., triples with object properties</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">&quot;will be implemented in future&quot;</span><span class="p">)</span></div>

<div class="viewcode-block" id="Ontology.abox_axioms_between_individuals_and_classes">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.abox_axioms_between_individuals_and_classes">[docs]</a>
<span class="k">def</span> <span class="nf">abox_axioms_between_individuals_and_classes</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">Iterable</span><span class="p">:</span>
<span class="c1"># @TODO: CD: Return all type information about individuals, i.e., individual type Class</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">&quot;will be implemented in future&quot;</span><span class="p">)</span></div>


<span class="c1"># @TODO:CD:Unsure it is working</span>
<div class="viewcode-block" id="Ontology.equivalent_classes_axioms">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.equivalent_classes_axioms">[docs]</a>
<span class="k">def</span> <span class="nf">equivalent_classes_axioms</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">c</span><span class="p">:</span> <span class="n">OWLClass</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">OWLEquivalentClassesAxiom</span><span class="p">]:</span>
Expand All @@ -944,7 +971,7 @@ <h1>Source code for owlapy.owl_ontology</h1><div class="highlight"><pre>
<span class="k">for</span> <span class="n">ec_x</span> <span class="ow">in</span> <span class="n">c_x</span><span class="o">.</span><span class="n">equivalent_to</span><span class="p">:</span>
<span class="k">yield</span> <span class="n">OWLEquivalentClassesAxiom</span><span class="p">([</span><span class="n">c</span><span class="p">,</span> <span class="n">_parse_concept_to_owlapy</span><span class="p">(</span><span class="n">ec_x</span><span class="p">)])</span></div>


<span class="c1"># @TODO:CD:Unsure it is working</span>
<div class="viewcode-block" id="Ontology.general_class_axioms">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.general_class_axioms">[docs]</a>
<span class="k">def</span> <span class="nf">general_class_axioms</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Iterable</span><span class="p">[</span><span class="n">OWLClassAxiom</span><span class="p">]:</span>
Expand Down Expand Up @@ -1065,17 +1092,13 @@ <h1>Source code for owlapy.owl_ontology</h1><div class="highlight"><pre>

<div class="viewcode-block" id="Ontology.save">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology/index.html#owlapy.owl_ontology.Ontology.save">[docs]</a>
<span class="k">def</span> <span class="nf">save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">document_iri</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">IRI</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="n">ont_x</span><span class="p">:</span> <span class="n">owlready2</span><span class="o">.</span><span class="n">namespace</span><span class="o">.</span><span class="n">Ontology</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_world</span><span class="o">.</span><span class="n">get_ontology</span><span class="p">(</span>
<span class="bp">self</span><span class="o">.</span><span class="n">get_ontology_id</span><span class="p">()</span><span class="o">.</span><span class="n">get_ontology_iri</span><span class="p">()</span><span class="o">.</span><span class="n">as_str</span><span class="p">()</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">document_iri</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">document_iri</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_iri</span>
<span class="k">if</span> <span class="n">document_iri</span><span class="o">.</span><span class="n">get_namespace</span><span class="p">()</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s1">&#39;file:/&#39;</span><span class="p">):</span>
<span class="n">filename</span> <span class="o">=</span> <span class="n">document_iri</span><span class="o">.</span><span class="n">as_str</span><span class="p">()[</span><span class="nb">len</span><span class="p">(</span><span class="s1">&#39;file:/&#39;</span><span class="p">):]</span>
<span class="n">ont_x</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">file</span><span class="o">=</span><span class="n">filename</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">NotImplementedError</span><span class="p">(</span><span class="s2">&quot;Couldn&#39;t save because the namespace of current ontology&#39;s IRI does not start with **file:/**&quot;</span><span class="p">)</span></div>
<span class="k">def</span> <span class="nf">save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span><span class="n">IRI</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">rdf_format</span> <span class="o">=</span> <span class="s2">&quot;rdfxml&quot;</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">IRI</span><span class="p">):</span>
<span class="n">path</span><span class="o">=</span><span class="n">path</span><span class="o">.</span><span class="n">as_str</span><span class="p">()</span>
<span class="n">ont_x</span><span class="p">:</span><span class="n">owlready2</span><span class="o">.</span><span class="n">namespace</span><span class="o">.</span><span class="n">Ontology</span>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="nb">str</span><span class="p">),</span> <span class="sa">f</span><span class="s2">&quot;path must be string. Currently it is </span><span class="si">{</span><span class="nb">type</span><span class="p">(</span><span class="n">path</span><span class="p">)</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="n">ont_x</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_world</span><span class="o">.</span><span class="n">get_ontology</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_ontology_id</span><span class="p">()</span><span class="o">.</span><span class="n">get_ontology_iri</span><span class="p">()</span><span class="o">.</span><span class="n">as_str</span><span class="p">())</span>
<span class="n">ont_x</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">file</span><span class="o">=</span><span class="n">path</span><span class="p">,</span><span class="nb">format</span><span class="o">=</span><span class="n">rdf_format</span><span class="p">)</span></div>


<div class="viewcode-block" id="Ontology.get_original_iri">
Expand Down
11 changes: 6 additions & 5 deletions _modules/owlapy/owl_ontology_manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ <h1>Source code for owlapy.owl_ontology_manager</h1><div class="highlight"><pre>

<div class="viewcode-block" id="OntologyManager.load_ontology">
<a class="viewcode-back" href="../../autoapi/owlapy/owl_ontology_manager/index.html#owlapy.owl_ontology_manager.OntologyManager.load_ontology">[docs]</a>
<span class="k">def</span> <span class="nf">load_ontology</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iri</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">IRI</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Ontology</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">iri</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">iri</span> <span class="o">=</span> <span class="n">IRI</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">iri</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">load_ontology</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path</span><span class="p">:</span> <span class="n">Union</span><span class="p">[</span><span class="n">IRI</span><span class="p">,</span> <span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Ontology</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">path_iri</span> <span class="o">=</span> <span class="n">IRI</span><span class="o">.</span><span class="n">create</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">iri</span><span class="p">,</span> <span class="n">IRI</span><span class="p">),</span> <span class="s2">&quot;iri either must be string or an instance of IRI Class&quot;</span>
<span class="k">return</span> <span class="n">Ontology</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iri</span><span class="p">,</span> <span class="n">load</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>
<span class="k">assert</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">IRI</span><span class="p">),</span> <span class="s2">&quot;iri either must be string or an instance of IRI Class&quot;</span>
<span class="n">path_iri</span><span class="o">=</span><span class="n">path</span>
<span class="k">return</span> <span class="n">Ontology</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path_iri</span><span class="p">,</span> <span class="n">load</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span></div>


<div class="viewcode-block" id="OntologyManager.apply_change">
Expand Down
20 changes: 19 additions & 1 deletion _sources/autoapi/owlapy/owl_ontology/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Module Contents



.. py:method:: properties_in_signature() -> Iterable[owlapy.owl_property.OWLProperty]
.. py:method:: individuals_in_signature() -> Iterable[owlapy.owl_individual.OWLNamedIndividual]
A convenience method that obtains the individuals that are in the signature of this object.
Expand All @@ -139,6 +142,21 @@ Module Contents



.. py:method:: tbox_axioms() -> Iterable
:abstractmethod:



.. py:method:: abox_axioms_between_individuals() -> Iterable
:abstractmethod:



.. py:method:: abox_axioms_between_individuals_and_classes() -> Iterable
:abstractmethod:



.. py:method:: equivalent_classes_axioms(c: owlapy.class_expression.OWLClass) -> Iterable[owlapy.owl_axiom.OWLEquivalentClassesAxiom]
Gets all of the equivalent axioms in this ontology that contain the specified class as an operand.
Expand Down Expand Up @@ -232,7 +250,7 @@ Module Contents



.. py:method:: save(document_iri: Optional[owlapy.iri.IRI] = None)
.. py:method:: save(path: Union[str, owlapy.iri.IRI] = None, rdf_format='rdfxml')
Saves this ontology, using its IRI to determine where/how the ontology should be
saved.
Expand Down
2 changes: 1 addition & 1 deletion _sources/autoapi/owlapy/owl_ontology_manager/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Module Contents



.. py:method:: load_ontology(iri: Union[owlapy.iri.IRI, str] = None) -> owlapy.owl_ontology.Ontology
.. py:method:: load_ontology(path: Union[owlapy.iri.IRI, str] = None) -> owlapy.owl_ontology.Ontology
Loads an ontology that is assumed to have the specified ontology IRI as its IRI or version IRI. The ontology
IRI will be mapped to an ontology document IRI.
Expand Down
Loading

0 comments on commit bd5c856

Please sign in to comment.