Closed vChavezB closed 6 months ago
The only bug I notice is that it seems that the TOC and numbering starting at 3. Cross reference does not match number-wise.
Attached is one of the test ontologies from this repo (turtle) with two rules just to test this PR.
@vChavezB thanks! Can you please merge against the develop
branch?
The numbering is generated dynamically based on the anchors you have. Maybe you are introducing a new anchor?
@vChavezB thanks! Can you please merge against the
develop
branch? The numbering is generated dynamically based on the anchors you have. Maybe you are introducing a new anchor?
I think I fixed this bug. Still trying to show the SWRL rules as its own section, it does not appear in the TOC but only in the overview and the contents.
Will update the PR.
Changed to develop. TOC and section numbering is correct but the section SWRL Rules in TOC is missing. Do you have any suggestions on what it could be?
It appears just as
Without the section number also at the TOC as mentioned in my previous comment.
I'll have to have a look. Probably a missing id or class.
Thanks for your quick response btw! I am a little overwhelmed this week, but I'd like to add all these changes before the holidays.
Maybe you are introducing a new anchor?
Is this what you mean by anchor ? This is what I did
Reason is that SWRL rules do not have an IRI, this is how they look serialized as xml rdf
<rdf:Description rdf:about="http://datos.bne.es/vocab/a">
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description>
<swrla:isRuleEnabled rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</swrla:isRuleEnabled>
<rdfs:comment>comment s2</rdfs:comment>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://datos.bne.es/def/C1001"/>
<swrl:argument1 rdf:resource="http://datos.bne.es/vocab/a"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://datos.bne.es/def/C1002"/>
<swrl:argument1 rdf:resource="http://datos.bne.es/vocab/a"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
<rdf:Description>
<swrla:isRuleEnabled rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</swrla:isRuleEnabled>
<rdfs:comment>comment s1</rdfs:comment>
<rdfs:label>S1</rdfs:label>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
<swrl:body>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://datos.bne.es/def/C1001"/>
<swrl:argument1 rdf:resource="http://datos.bne.es/vocab/a"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:body>
<swrl:head>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
<rdf:first>
<rdf:Description>
<rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
<swrl:classPredicate rdf:resource="http://datos.bne.es/def/C1002"/>
<swrl:argument1 rdf:resource="http://datos.bne.es/vocab/a"/>
</rdf:Description>
</rdf:first>
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</rdf:Description>
</swrl:head>
</rdf:Description>
and the xslt html transformation
<div id="swrlrules">
<h2>SWRL rules</h2>
<ul class="hlist"></ul>
<div id="d4e4498" class="entity">
<h3>Rule #1
<span class="backlink">back to
<a href="#toc">ToC</a>
</span>
</h3>
<p>
<strong>Comment: </strong>comment s2
<br />
<br />
<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="d4e4554" class="entity">
<h3>Rule #2
<span class="backlink">back to
<a href="#toc">ToC</a>
</span>
</h3>
<p>
<strong>Comment: </strong>comment s1
<br />
<br />
<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>
It looks like you are not at fault, I need to review this a little bit in detail @vChavezB. I just need a little time
Thanks for your quick response btw! I am a little overwhelmed this week, but I'd like to add all these changes before the holidays.
sure no prob!
Sorry, but the tests don't pass. Are you sure you pass them locally? Which version of Java are you using?
Let me check why they didnt pass. Btw i found the bug I think it has to do with h2 tag replacement in the LodeParser
I think there was a missing import. Also solved the hyperlink of swrl rule sections. I did not use the language properties and at the moment replace it directly see
I was experimenting with the project AOWLN, a Protégé plugin to generate images from SWRL rules. I modified it to be used independent of protege to try to integrate it with widoco and named it aowln-sa.
I wanted to integrate it in widoco but due to dependency conflicts (owl-api 4.5.25) and my limted experience with java I am using it separately by generating the images and then modifying the cross-ref-xx.html section. However sometimes if the SWRL graph is small then the ratio of images looks different. Do you have any suggestions on how to achieve a more proportionate ratio ? I am not that good at css,html and javascript for websites. This is my css and this is an example of how I attach the images to the cross-ref-xx.hml page.
<div class="grid-container">
<div class="swrl-container">Body
<img src="swrlrules/rule_R3_AOs_are_transitive_from_device_profile-body.png" style="width: 350px; display: inline-block;" title="SWRL Body">
</div>
<div class="swrl-container">Head<img src="swrlrules/rule_R3_AOs_are_transitive_from_device_profile-head.png" style="width: 350px; display: inline-block;" title="SWRL Head">
</div>
</div>
After some chat gpt and debugging I have made a javascript to scale the swrl images so they have the same ratio.
This is not part of the PR but just wanted to give some ideas on how this might look integrated into Widoco :)
@vChavezB thanks for your edits. I guess that if you want to add images for rules, we can introduce a metadata property for annotating them in the ontology, so you don't need to add them manually. Something like widoco:hasRuleImage, or something like that. I am bringing this up in case this helps things. Are you done with your edits? I see that you are still committing to this PR.
Yes, you can do a review now.
About the metadata... Im afk so I will post later some feedback about it.
Hello @dgarijo
we can introduce a metadata property for annotating them in the ontology
Would you annotate this for each rule? If yes, I do not know if this would work for my use case (i.e. Protege). In protege you can define SWRL rules over the SWRL Tab. As far as I know you can add a name (rdfs:label) and a comment (rdfs:comment). You would need to manually add the widoco:hasRuleImage
annotation in the serialized representation of the ontology outside of Protege.
Thanks, I opened a new issue #662 to follow up on this. Merging this PR (about time!)
Addes support for correct xslt transformation for TOC and SWRL display. The transformation checks if rdfs:label is defined if not the rules are generically number as they appear in the XML serialization of the ontology.
Fixes #651
TOC
Contents