-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix SWRL parsing #654
Fix SWRL parsing #654
Conversation
6b4ef70
to
83e6903
Compare
Attached is one of the test ontologies from this repo (turtle) with two rules just to test this PR. |
83e6903
to
23a1539
Compare
@vChavezB thanks! Can you please merge against the |
@@ -1,6 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- | |||
Copyright (c) 2010-2013, Silvio Peroni <[email protected]> | |||
Copyright (C) 2023, Victor Chavez <[email protected]> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add your copyright under the code extension you have added? Otherwise it may look like you claim the copyright for the whole document, which I don't think it's appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok sure, yes it looks misleading. Thanks for the feedback.
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. |
23a1539
to
63c4620
Compare
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? |
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. |
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 |
sure no prob! |
63c4620
to
c805415
Compare
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. |
fc4bdc7
to
8c9838d
Compare
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 |
c07e58f
to
ad1d537
Compare
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> Big graphSmall graph |
ad1d537
to
f29e5aa
Compare
@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. |
Yes, you can do a review now. About the metadata... Im afk so I will post later some feedback about it. |
Hello @dgarijo
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 |
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.
f29e5aa
to
badb45b
Compare
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