Skip to content

Commit

Permalink
Updated documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Feb 23, 2024
1 parent f5e5d87 commit 8f7d068
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions _modules/apis_core/utils/rdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ <h1>Source code for apis_core.utils.rdf</h1><div class="highlight"><pre>
<span class="n">matching_definition</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">definition</span> <span class="ow">in</span> <span class="n">configs</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="k">if</span> <span class="n">definition</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;filter_sparql&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">bool</span><span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">definition</span><span class="p">[</span><span class="s2">&quot;filter_sparql&quot;</span><span class="p">])):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Found </span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2"> to match the Uri&quot;</span><span class="p">)</span>
<span class="n">matching_definition</span> <span class="o">=</span> <span class="n">definition</span>
<span class="n">matching_definition</span><span class="p">[</span><span class="s2">&quot;filename&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="k">break</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">bool</span><span class="p">(</span><span class="n">graph</span><span class="o">.</span><span class="n">query</span><span class="p">(</span><span class="n">definition</span><span class="p">[</span><span class="s2">&quot;filter_sparql&quot;</span><span class="p">])):</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Found </span><span class="si">%s</span><span class="s2"> to match the Uri&quot;</span><span class="p">,</span> <span class="n">key</span><span class="p">)</span>
<span class="n">matching_definition</span> <span class="o">=</span> <span class="n">definition</span>
<span class="n">matching_definition</span><span class="p">[</span><span class="s2">&quot;filename&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span>
<span class="k">break</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">e</span><span class="p">:</span>
<span class="n">logger</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s2">&quot;filter_sparql in </span><span class="si">%s</span><span class="s2"> led to: </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">e</span><span class="p">)</span>
<span class="n">model_attributes</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">()</span>
<span class="k">if</span> <span class="n">matching_definition</span><span class="p">:</span>
<span class="n">attributes</span> <span class="o">=</span> <span class="n">matching_definition</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;attributes&quot;</span><span class="p">,</span> <span class="p">[])</span>
Expand All @@ -145,7 +148,7 @@ <h1>Source code for apis_core.utils.rdf</h1><div class="highlight"><pre>
<span class="n">model_attributes</span><span class="p">[</span><span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)]</span> <span class="o">=</span> <span class="nb">str</span><span class="p">(</span><span class="n">value</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">AttributeError</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;No matching definition found for </span><span class="si">{</span><span class="n">uri</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">definition</span><span class="p">,</span> <span class="n">model_attributes</span></div>
<span class="k">return</span> <span class="n">matching_definition</span><span class="p">,</span> <span class="n">model_attributes</span></div>

</pre></div>

Expand Down

0 comments on commit 8f7d068

Please sign in to comment.