Skip to content

Commit c47f2d9

Browse files
committed
Fix #233
1 parent 9e07dc3 commit c47f2d9

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

shacl-doc/src/main/java/fr/sparna/rdf/shacl/doc/model/ShapesDocumentationSection.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ public class ShapesDocumentationSection {
2929
*/
3030
private String sectionId;
3131
private String title;
32+
3233
/**
33-
* The subtitle to display, set to the full URI. Can be null
34+
* The subtitle to display, set to the full URI. Can be null, or can point to an empty URL
3435
*/
35-
private String subtitleUri;
36+
private Link subtitleUri;
3637
private String description;
3738

3839
private List<Link> targetClass;
@@ -138,14 +139,6 @@ public void setTitle(String title) {
138139
this.title = title;
139140
}
140141

141-
public String getSubtitleUri() {
142-
return subtitleUri;
143-
}
144-
145-
public void setSubtitleUri(String subtitleUri) {
146-
this.subtitleUri = subtitleUri;
147-
}
148-
149142
public String getDescription() {
150143
return description;
151144
}
@@ -288,5 +281,13 @@ public String getHasValue() {
288281

289282
public void setHasValue(String hasValue) {
290283
this.hasValue = hasValue;
284+
}
285+
286+
public Link getSubtitleUri() {
287+
return subtitleUri;
288+
}
289+
290+
public void setSubtitleUri(Link subtitleUri) {
291+
this.subtitleUri = subtitleUri;
291292
}
292293
}

shacl-doc/src/main/java/fr/sparna/rdf/shacl/doc/read/ShapesDocumentationSectionBuilder.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ public ShapesDocumentationSection build(
4444
currentSection.setNodeShapeUriOrId(nodeShape.getURIOrId());
4545
currentSection.setSectionId(nodeShape.getShortFormOrId());
4646
// if the node shape is itself a class, set its subtitle to the URI
47-
currentSection.setSubtitleUri(nodeShape.getNodeShape().getURI());
47+
if(nodeShape.isAClass()) {
48+
currentSection.setSubtitleUri(new Link(nodeShape.getNodeShape().getURI(), nodeShape.getNodeShape().getURI()));
49+
} else {
50+
currentSection.setSubtitleUri(new Link(null, nodeShape.getNodeShape().getURI()));
51+
}
4852

4953
// title : either skos:prefLabel or rdfs:label or the URI short form
5054
currentSection.setTitle(nodeShape.getDisplayLabel(owlGraph, lang));

shacl-doc/src/main/resources/doc2html.xsl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,14 @@
857857
<xsl:apply-templates select="title" />
858858

859859
<xsl:if test="subtitleUri">
860-
<code class="sp_section_uri"><xsl:value-of select="subtitleUri" /></code>
860+
<xsl:choose>
861+
<xsl:when test="subtitleUri/href">
862+
<code class="sp_section_uri"><a href="{subtitleUri/href}"><xsl:value-of select="subtitleUri/label" /></a></code>
863+
</xsl:when>
864+
<xsl:otherwise>
865+
<code class="sp_section_uri"><xsl:value-of select="subtitleUri/label" /></code>
866+
</xsl:otherwise>
867+
</xsl:choose>
861868
</xsl:if>
862869

863870
</div>

0 commit comments

Comments
 (0)