Closed vChavezB closed 9 months ago
I debugged the app and I am not sure if swr rules are parsed
the XLST output for swr rules looks as this. In this example I added two rules to an ontology.
<div id="swrlrules">
<h2>SWRL rules</h2>
<div id="d4e4498" class="entity">
<h3>Rule #1
<span class="backlink">back to
<a href="#toc">ToC</a>
</span>
</h3>
<p>
<a href="#d4e4288" title="http://datos.bne.es/def/C1001">Work</a>
<sup title="class" class="type-c">c</sup>(?) ->
<a href="#d4e4316" title="http://datos.bne.es/def/C1002">Expression</a>
<sup title="class" class="type-c">c</sup>(?)
</p>
</div>
<div id="d4e4558" class="entity">
<h3>Rule #2
<span class="backlink">back to
<a href="#toc">ToC</a>
</span>
</h3>
<p>
<a href="#d4e4288" title="http://datos.bne.es/def/C1001">Work</a>
<sup title="class" class="type-c">c</sup>(?) ->
<a href="#d4e4316" title="http://datos.bne.es/def/C1002">Expression</a>
<sup title="class" class="type-c">c</sup>(?)
</p>
</div>
</div>
So my guess is that the SWRL html parser is not implemented in widoco due to the fact that I was debugging and the id for the html div is different. I changed the id to swrlrules but the program crashes.
Ok I made a PR #652 perhaps you can check if it looks fine. The rules are now displayed. However as you see the first element is "null".
ok an update now the rules look much better with annotation from rdfs:comment and rdfs:label
this requires changing the xslt of swrl-rules in specific , havent made a PR as I hope this gets merged first :) #653
<xsl:template match="swrl:Imp | rdf:Description[rdf:type[@rdf:resource = 'http://www.w3.org/2003/11/swrl#Imp']]">
<div id="{generate-id()}" class="entity">
<h3>
<xsl:value-of select="concat('Rule #', count(preceding-sibling::swrl:Imp | preceding-sibling::rdf:Description[rdf:type[@rdf:resource = 'http://www.w3.org/2003/11/swrl#Imp']]) + 1, ' ', rdfs:label)" />
<xsl:call-template name="get.backlink.to.top" />
</h3>
<p>
<!-- Add rdfs:comment -->
<xsl:if test="rdfs:comment">
<strong>Comment: </strong>
<xsl:value-of select="rdfs:comment" /><br/><br/>
</xsl:if>
<!-- Continue with the existing content -->
<xsl:apply-templates select="swrl:body" />
<xsl:text> -> </xsl:text>
<xsl:apply-templates select="swrl:head" />
</p>
</div>
</xsl:template>
Thanks a lot. So far, I think no swrl rules were considered, as I did not have a use case for them (I may have simplified them from the XSLT output). I will need to review the PR, since in the develop
branch I was considering other types of rules I had been asked to include (but not SWRL). This is a great addition!
Just pls make sure you send your PRs to the right branch @vChavezB (see https://github.com/dgarijo/Widoco#contribution-guidelines)
I read the code again and the xlst sources. So if I understand correctly the "rules" extraction uses annotations from owl Individuals or which type of rules does it parse.
I did not found a sample ontology that uses this transformation. This would be helpful to know as it was not clear to me. I will update the PR and refine it.
@vChavezB sorry, the rules stuff I added is for very specific owl annotations for a specific project I am doing.
The SWRL module you added recovers the original SWRL annotations, and I think they should be added, but separately. Please just ignore the module I did for annotations of rules and use a new one with the id you gave, as you were doing. Thanks in advance!
This issue should now be closed and will be up in the next release See #654 for more info. Thanks @vChavezB for your work!!
I am trying to generate the SWRL rules I declare in my ontology but they dont apper after I generate the project.
The rules section appears empty with just a the title "4.6 Rules" and a blue rectangle
Do you have an example ontology that is known to be working and I can use to check if its just on my side?
Here is an excerpt of how I declare my SWRL rules (generated with protege)