forked from dgarijo/Widoco
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWRL rule ordering and minor href fix
This change orders swrl rules according to their rdfs:label and a minor fix to href in the body and head of the swrl rules.
- Loading branch information
Showing
1 changed file
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,8 @@ Copyright (C) 2023, Victor Chavez <[email protected]> | |
<xsl:template name="get.swrl.toc"> | ||
<ul class="hlist"> | ||
<xsl:apply-templates select="/rdf:RDF/rdf:Description[rdf:type[@rdf:resource='http://www.w3.org/2003/11/swrl#Imp']]" mode="toc"> | ||
<xsl:sort select="rdfs:comment" order="ascending" data-type="text"/> | ||
<xsl:sort select="lower-case(f:getLabel(rdfs:label))" | ||
order="ascending" data-type="text"/> | ||
</xsl:apply-templates> | ||
</ul> | ||
</xsl:template> | ||
|
@@ -132,19 +133,22 @@ Copyright (C) 2023, Victor Chavez <[email protected]> | |
<xsl:text>)</xsl:text> | ||
</xsl:template> | ||
|
||
<!-- Use http://www.essepuntato.it/2011/05/overlapping to test it --> | ||
|
||
<xsl:template match="swrl:BuiltinAtom | rdf:Description[rdf:type[@rdf:resource = 'http://www.w3.org/2003/11/swrl#BuiltinAtom']]"> | ||
<xsl:value-of select="substring-after(swrl:builtin/@rdf:resource,'http://www.w3.org/2003/11/swrlb#')" /> | ||
<xsl:text>(</xsl:text> | ||
<xsl:variable name="builtinHref" select="swrl:builtin/@rdf:resource" /> | ||
<a href="{$builtinHref}" title="{substring-after($builtinHref, '#')}"> | ||
<xsl:value-of select="substring-after($builtinHref, '#')" /> | ||
</a> | ||
<xsl:text>(</xsl:text> | ||
<xsl:for-each select="swrl:arguments/rdf:Description"> | ||
<xsl:value-of select="concat('?',substring-after(@rdf:about,'#'))"/> | ||
<xsl:if test="position() != last()"> | ||
<xsl:text>,</xsl:text> | ||
</xsl:if> | ||
<xsl:value-of select="concat('?', substring-after(@rdf:about, '#'))"/> | ||
<xsl:if test="position() != last()"> | ||
<xsl:text>,</xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
<xsl:text>)</xsl:text> | ||
</xsl:template> | ||
|
||
<xsl:template match="swrl:classPredicate"> | ||
<xsl:apply-templates select="@rdf:resource"> | ||
<xsl:with-param name="type" select="'class'" tunnel="yes" as="xs:string" /> | ||
|
@@ -184,7 +188,10 @@ Copyright (C) 2023, Victor Chavez <[email protected]> | |
<div id="swrlrules"> | ||
<h2>SWRL rules</h2> | ||
<xsl:call-template name="get.swrl.toc"/> | ||
<xsl:apply-templates select="//(swrl:Imp | rdf:Description[rdf:type[@rdf:resource = 'http://www.w3.org/2003/11/swrl#Imp']])" /> | ||
<xsl:apply-templates select="//(swrl:Imp | rdf:Description[rdf:type[@rdf:resource = 'http://www.w3.org/2003/11/swrl#Imp']])" > | ||
<xsl:sort select="lower-case(f:getLabel(rdfs:label))" | ||
order="ascending" data-type="text"/> | ||
</xsl:apply-templates> | ||
</div> | ||
</xsl:if> | ||
</xsl:template> | ||
|
@@ -203,4 +210,4 @@ Copyright (C) 2023, Victor Chavez <[email protected]> | |
</xsl:if> | ||
</span> | ||
</xsl:template> | ||
</xsl:stylesheet> | ||
</xsl:stylesheet> |