Skip to content

Commit

Permalink
deploy: 0bc49e7
Browse files Browse the repository at this point in the history
  • Loading branch information
Demirrr committed Jul 19, 2024
1 parent 24379a5 commit fd4757b
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 9 deletions.
43 changes: 41 additions & 2 deletions _modules/owlapy/owlapi_adaptor.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,47 @@ <h1>Source code for owlapy.owlapi_adaptor</h1><div class="highlight"><pre>
<span class="c1"># A manchester renderer to render owlapi ce to manchester syntax</span>
<span class="bp">self</span><span class="o">.</span><span class="n">renderer</span> <span class="o">=</span> <span class="n">ManchesterOWLSyntaxOWLObjectRendererImpl</span><span class="p">()</span>

<div class="viewcode-block" id="OWLAPIAdaptor.infer_and_save">
<a class="viewcode-back" href="../../autoapi/owlapy/owlapi_adaptor/index.html#owlapy.owlapi_adaptor.OWLAPIAdaptor.infer_and_save">[docs]</a>
<span class="k">def</span> <span class="nf">infer_and_save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output_path</span><span class="p">:</span><span class="nb">str</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">output_format</span><span class="p">:</span><span class="nb">str</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">inference_types</span><span class="p">:</span><span class="nb">list</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="kn">from</span> <span class="nn">java.io</span> <span class="kn">import</span> <span class="n">File</span><span class="p">,</span> <span class="n">FileOutputStream</span>
<span class="kn">from</span> <span class="nn">java.util</span> <span class="kn">import</span> <span class="n">ArrayList</span>
<span class="kn">from</span> <span class="nn">org.semanticweb.owlapi.util</span> <span class="kn">import</span> <span class="n">InferredSubClassAxiomGenerator</span><span class="p">,</span> <span class="n">InferredClassAssertionAxiomGenerator</span>
<span class="kn">from</span> <span class="nn">org.semanticweb.owlapi.util</span> <span class="kn">import</span> <span class="n">InferredOntologyGenerator</span><span class="p">,</span> <span class="n">InferredEquivalentClassAxiomGenerator</span><span class="p">,</span><span class="n">InferredInverseObjectPropertiesAxiomGenerator</span>
<span class="kn">from</span> <span class="nn">org.semanticweb.owlapi.util</span> <span class="kn">import</span> <span class="n">InferredDisjointClassesAxiomGenerator</span>
<span class="kn">from</span> <span class="nn">org.semanticweb.owlapi.formats</span> <span class="kn">import</span> <span class="n">TurtleDocumentFormat</span><span class="p">,</span> <span class="n">RDFXMLDocumentFormat</span><span class="p">,</span> <span class="n">OWLXMLDocumentFormat</span>

<span class="k">if</span> <span class="n">output_format</span> <span class="o">==</span> <span class="s2">&quot;ttl&quot;</span> <span class="ow">or</span> <span class="n">output_format</span> <span class="o">==</span> <span class="s2">&quot;turtle&quot;</span><span class="p">:</span>
<span class="n">document_format</span> <span class="o">=</span> <span class="n">TurtleDocumentFormat</span><span class="p">()</span>
<span class="k">elif</span> <span class="n">output_format</span> <span class="o">==</span> <span class="s2">&quot;rdf/xml&quot;</span><span class="p">:</span>
<span class="n">document_format</span> <span class="o">=</span> <span class="n">RDFXMLDocumentFormat</span><span class="p">()</span>
<span class="k">elif</span> <span class="n">output_format</span> <span class="o">==</span> <span class="s2">&quot;owl/xml&quot;</span><span class="p">:</span>
<span class="n">document_format</span> <span class="o">=</span> <span class="n">OWLXMLDocumentFormat</span><span class="p">()</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">document_format</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">getOntologyFormat</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">ontology</span><span class="p">)</span>
<span class="n">generators</span> <span class="o">=</span> <span class="n">ArrayList</span><span class="p">()</span>
<span class="n">inference_types_mapping</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;InferredClassAssertionAxiomGenerator&quot;</span><span class="p">:</span> <span class="n">InferredClassAssertionAxiomGenerator</span><span class="p">(),</span>
<span class="s2">&quot;InferredSubClassAxiomGenerator&quot;</span><span class="p">:</span> <span class="n">InferredSubClassAxiomGenerator</span><span class="p">(),</span>
<span class="s2">&quot;InferredDisjointClassesAxiomGenerator&quot;</span><span class="p">:</span><span class="n">InferredDisjointClassesAxiomGenerator</span><span class="p">(),</span>
<span class="s2">&quot;InferredEquivalentClassAxiomGenerator&quot;</span><span class="p">:</span><span class="n">InferredEquivalentClassAxiomGenerator</span><span class="p">(),</span>
<span class="s2">&quot;InferredInverseObjectPropertiesAxiomGenerator&quot;</span><span class="p">:</span><span class="n">InferredInverseObjectPropertiesAxiomGenerator</span><span class="p">(),</span>
<span class="s2">&quot;InferredEquivalentClassAxiomGenerator&quot;</span><span class="p">:</span><span class="n">InferredEquivalentClassAxiomGenerator</span><span class="p">()}</span>
<span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">inference_types</span><span class="p">:</span>
<span class="k">if</span> <span class="n">java_object</span> <span class="o">:=</span> <span class="n">inference_types_mapping</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="kc">None</span><span class="p">):</span>
<span class="n">generators</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">java_object</span><span class="p">)</span>

<span class="n">iog</span> <span class="o">=</span> <span class="n">InferredOntologyGenerator</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reasoner</span><span class="p">,</span> <span class="n">generators</span><span class="p">)</span>
<span class="n">inferredAxiomsOntology</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">createOntology</span><span class="p">()</span>
<span class="n">iog</span><span class="o">.</span><span class="n">fillOntology</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">getOWLDataFactory</span><span class="p">(),</span> <span class="n">inferredAxiomsOntology</span><span class="p">);</span>
<span class="n">inferredOntologyFile</span> <span class="o">=</span> <span class="n">File</span><span class="p">(</span><span class="n">output_path</span><span class="p">)</span>
<span class="n">inferredOntologyFile</span> <span class="o">=</span> <span class="n">inferredOntologyFile</span><span class="o">.</span><span class="n">getAbsoluteFile</span><span class="p">()</span>
<span class="n">outputStream</span> <span class="o">=</span> <span class="n">FileOutputStream</span><span class="p">(</span><span class="n">inferredOntologyFile</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">saveOntology</span><span class="p">(</span><span class="n">inferredAxiomsOntology</span><span class="p">,</span> <span class="n">document_format</span><span class="p">,</span> <span class="n">outputStream</span><span class="p">);</span></div>


<div class="viewcode-block" id="OWLAPIAdaptor.generate_inferred_class_assertion_axioms">
<a class="viewcode-back" href="../../autoapi/owlapy/owlapi_adaptor/index.html#owlapy.owlapi_adaptor.OWLAPIAdaptor.generate_inferred_class_assertion_axioms">[docs]</a>
<span class="k">def</span> <span class="nf">generate_inferred_class_assertion_axioms</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="s2">&quot;temp.ttl&quot;</span><span class="p">,</span> <span class="nb">format</span><span class="p">:</span><span class="nb">str</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="k">def</span> <span class="nf">generate_inferred_class_assertion_axioms</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output</span><span class="o">=</span><span class="s2">&quot;temp.ttl&quot;</span><span class="p">,</span> <span class="n">output_format</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Generates inferred class assertion axioms for the ontology managed by this instance&#39;s reasoner and saves them to a file.</span>

Expand All @@ -224,7 +262,7 @@ <h1>Source code for owlapy.owlapi_adaptor</h1><div class="highlight"><pre>
<span class="sd"> output : str, optional</span>
<span class="sd"> The name of the file where the inferred axioms will be saved. Default is &quot;temp.ttl&quot;.</span>

<span class="sd"> format : str, optional</span>
<span class="sd"> output_format : str, optional</span>
<span class="sd"> The format in which to save the inferred axioms. Supported formats are:</span>
<span class="sd"> - &quot;ttl&quot; or &quot;turtle&quot; for Turtle format</span>
<span class="sd"> - &quot;rdf/xml&quot; for RDF/XML format</span>
Expand Down Expand Up @@ -263,6 +301,7 @@ <h1>Source code for owlapy.owlapi_adaptor</h1><div class="highlight"><pre>

<span class="c1"># generators.add(InferredSubClassAxiomGenerator())</span>
<span class="n">generators</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">InferredClassAssertionAxiomGenerator</span><span class="p">())</span>

<span class="n">iog</span> <span class="o">=</span> <span class="n">InferredOntologyGenerator</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">reasoner</span><span class="p">,</span> <span class="n">generators</span><span class="p">)</span>
<span class="n">inferredAxiomsOntology</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">createOntology</span><span class="p">()</span>
<span class="n">iog</span><span class="o">.</span><span class="n">fillOntology</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">manager</span><span class="o">.</span><span class="n">getOWLDataFactory</span><span class="p">(),</span> <span class="n">inferredAxiomsOntology</span><span class="p">);</span>
Expand Down
7 changes: 5 additions & 2 deletions _sources/autoapi/owlapy/owlapi_adaptor/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ Module Contents



.. py:method:: generate_inferred_class_assertion_axioms(output='temp.ttl', format: str = None)
.. py:method:: infer_and_save(output_path: str = None, output_format: str = None, inference_types: list[str] = None)
.. py:method:: generate_inferred_class_assertion_axioms(output='temp.ttl', output_format: str = None)
Generates inferred class assertion axioms for the ontology managed by this instance's reasoner and saves them to a file.

Expand All @@ -71,7 +74,7 @@ Module Contents
output : str, optional
The name of the file where the inferred axioms will be saved. Default is "temp.ttl".

format : str, optional
output_format : str, optional
The format in which to save the inferred axioms. Supported formats are:
- "ttl" or "turtle" for Turtle format
- "rdf/xml" for RDF/XML format
Expand Down
10 changes: 8 additions & 2 deletions autoapi/owlapy/owlapi_adaptor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.parser"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.parser</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.renderer"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.renderer</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.stopJVM"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.stopJVM()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.infer_and_save"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.infer_and_save()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.generate_inferred_class_assertion_axioms"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.generate_inferred_class_assertion_axioms()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.convert_to_owlapi"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.convert_to_owlapi()</span></code></a></li>
<li class="toctree-l6"><a class="reference internal" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.convert_from_owlapi"><code class="docutils literal notranslate"><span class="pre">OWLAPIAdaptor.convert_from_owlapi()</span></code></a></li>
Expand Down Expand Up @@ -215,9 +216,14 @@ <h2>Module Contents<a class="headerlink" href="#module-contents" title="Link to
<dd><p>Detaches the thread from Java packages and shuts down the java virtual machine hosted by jpype.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="owlapy.owlapi_adaptor.OWLAPIAdaptor.infer_and_save">
<span class="sig-name descname"><span class="pre">infer_and_save</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inference_types</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/owlapy/owlapi_adaptor.html#OWLAPIAdaptor.infer_and_save"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.infer_and_save" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="owlapy.owlapi_adaptor.OWLAPIAdaptor.generate_inferred_class_assertion_axioms">
<span class="sig-name descname"><span class="pre">generate_inferred_class_assertion_axioms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'temp.ttl'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/owlapy/owlapi_adaptor.html#OWLAPIAdaptor.generate_inferred_class_assertion_axioms"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.generate_inferred_class_assertion_axioms" title="Link to this definition"></a></dt>
<span class="sig-name descname"><span class="pre">generate_inferred_class_assertion_axioms</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'temp.ttl'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_format</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/owlapy/owlapi_adaptor.html#OWLAPIAdaptor.generate_inferred_class_assertion_axioms"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#owlapy.owlapi_adaptor.OWLAPIAdaptor.generate_inferred_class_assertion_axioms" title="Link to this definition"></a></dt>
<dd><p>Generates inferred class assertion axioms for the ontology managed by this instance’s reasoner and saves them to a file.</p>
<p>This function uses the OWL API to generate inferred class assertion axioms based on the ontology and reasoner
associated with this instance. The inferred axioms are saved to the specified output file in the desired format.</p>
Expand All @@ -226,7 +232,7 @@ <h3>Parameters:<a class="headerlink" href="#parameters" title="Link to this head
<dl class="simple">
<dt>output<span class="classifier">str, optional</span></dt><dd><p>The name of the file where the inferred axioms will be saved. Default is “temp.ttl”.</p>
</dd>
<dt>format<span class="classifier">str, optional</span></dt><dd><p>The format in which to save the inferred axioms. Supported formats are:
<dt>output_format<span class="classifier">str, optional</span></dt><dd><p>The format in which to save the inferred axioms. Supported formats are:
- “ttl” or “turtle” for Turtle format
- “rdf/xml” for RDF/XML format
- “owl/xml” for OWL/XML format
Expand Down
Loading

0 comments on commit fd4757b

Please sign in to comment.