Skip to content

Commit 091a1c5

Browse files
authored
Fixed action URL in navbar form (#213)
* Fixed action URL in navbar form * Refactored container children view Now it's attached to the class via `ldh:template` rather than being part of the constructor
1 parent 7a94f08 commit 091a1c5

3 files changed

Lines changed: 17 additions & 25 deletions

File tree

src/main/resources/com/atomgraph/linkeddatahub/ldh.ttl

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@
9191
rdfs:label "Series variable name" ;
9292
rdfs:isDefinedBy : .
9393

94+
:template a owl:ObjectProperty ;
95+
rdfs:domain rdfs:Class ;
96+
rdfs:label "Class-level content block" ;
97+
rdfs:isDefinedBy : .
98+
9499
# CLASSES
95100

96101
# constructor
@@ -473,6 +478,11 @@ ORDER BY ?title
473478
""" ;
474479
rdfs:isDefinedBy : .
475480

481+
:ChildrenView a :View ;
482+
rdfs:label "Children view" ;
483+
spin:query :SelectChildren ;
484+
rdfs:isDefinedBy : .
485+
476486
# CLIENT TERMS. TO-DO: move to a separate Web-Client ontology?
477487

478488
ac:Chart a rdfs:Class, owl:Class ;
@@ -566,31 +576,14 @@ dh:Item spin:constructor :TitleConstructor, :DescriptionConstructor, :PrimaryTop
566576
WHERE {}""" ;
567577
rdfs:isDefinedBy : .
568578

569-
:ChildrenViewContructor a :Constructor ;
570-
rdfs:label "Container content constructor" ;
571-
sp:text """
572-
PREFIX ldh: <https://w3id.org/atomgraph/linkeddatahub#>
573-
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
574-
PREFIX spin: <http://spinrdf.org/spin#>
575-
576-
CONSTRUCT {
577-
$this rdf:_1 [ a ldh:Object ;
578-
rdf:value [
579-
a ldh:View ;
580-
spin:query ldh:SelectChildren
581-
]
582-
] .
583-
}
584-
WHERE {}""" ;
585-
rdfs:isDefinedBy : .
586-
587579
:MissingContainer a :MissingPropertyValue ;
588580
rdfs:label "Missing container" ;
589581
rdfs:comment "Requires items to have a parent container" ;
590582
sp:arg1 sioc:has_container ;
591583
rdfs:isDefinedBy : .
592584

593-
dh:Container spin:constructor :TitleConstructor, :DescriptionConstructor, :PrimaryTopicConstructor, :ChildrenViewContructor .
585+
dh:Container spin:constructor :TitleConstructor, :DescriptionConstructor, :PrimaryTopicConstructor ;
586+
:template :ChildrenView .
594587

595588
:MissingParent a :MissingPropertyValue ;
596589
rdfs:label "Missing parent" ;

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/layout.xsl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ LIMIT 100
549549

550550
<!-- check if agent has access to the user endpoint by executing a dummy query ASK {} -->
551551
<xsl:template match="rdf:RDF[doc-available(resolve-uri('sparql?query=ASK%20%7B%7D', $ldt:base))] | srx:sparql[doc-available(resolve-uri('sparql?query=ASK%20%7B%7D', $ldt:base))]" mode="bs2:SearchBar" priority="1">
552-
<form action="" method="get" class="navbar-form pull-left" accept-charset="UTF-8" title="{ac:label(key('resources', 'search-title', document('translations.rdf')))}">
552+
<form action="{ac:absolute-path($ldh:requestUri)}" method="get" class="navbar-form pull-left" accept-charset="UTF-8" title="{ac:label(key('resources', 'search-title', document('translations.rdf')))}">
553553
<div class="input-append">
554554
<select id="search-service" name="service">
555555
<option value="">
@@ -805,7 +805,7 @@ LIMIT 100
805805
<xsl:param name="typeof" select="key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:type/@rdf:resource/xs:anyURI(.)" as="xs:anyURI*"/>
806806
<xsl:param name="doc-types" select="key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:type/@rdf:resource[ . = ('&def;Root', '&dh;Container', '&dh;Item')]" as="xs:anyURI*"/>
807807
<!-- take care not to load unnecessary documents over HTTP when $doc-types is empty -->
808-
<xsl:param name="block-values" select="if (exists($doc-types)) then (if (doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then (ldh:query-result(map{}, resolve-uri('ns', $ldt:base), $template-query || ' VALUES $Type { ' || string-join(for $type in $doc-types return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'content']/srx:uri/xs:anyURI(.)) else ()) else ()" as="xs:anyURI*"/>
808+
<xsl:param name="block-values" select="if (exists($doc-types)) then (if (doc-available(resolve-uri('ns?query=ASK%20%7B%7D', $ldt:base))) then (ldh:query-result(map{}, resolve-uri('ns', $ldt:base), $template-query || ' VALUES $Type { ' || string-join(for $type in $doc-types return '&lt;' || $type || '&gt;', ' ') || ' }')//srx:binding[@name = 'block']/srx:uri/xs:anyURI(.)) else ()) else ()" as="xs:anyURI*"/>
809809
<xsl:param name="has-content" select="key('resources', key('resources', ac:absolute-path(ldh:base-uri(.)))/rdf:*[starts-with(local-name(), '_')]/@rdf:resource) or exists($block-values)" as="xs:boolean"/>
810810

811811
<div>
@@ -829,7 +829,7 @@ LIMIT 100
829829
</xsl:apply-templates>
830830

831831
<xsl:choose>
832-
<!-- error responses always rendered in bs2:Block mode, no matter what $ac:mode specifies -->
832+
<!-- error responses always rendered in bs2:Row mode, no matter what $ac:mode specifies -->
833833
<xsl:when test="key('resources-by-type', '&http;Response') and not(key('resources-by-type', '&spin;ConstraintViolation')) and not(key('resources-by-type', '&sh;ValidationResult'))">
834834
<xsl:apply-templates select="." mode="bs2:Row">
835835
<xsl:with-param name="template-query" select="$template-query" tunnel="yes"/>
@@ -838,13 +838,13 @@ LIMIT 100
838838
</xsl:when>
839839
<!-- check if the current document has content or its class has content -->
840840
<xsl:when test="(empty($ac:mode) and $has-content) or $ac:mode = '&ldh;ContentMode'">
841-
<xsl:apply-templates select="." mode="ldh:ContentList"/>
842-
843841
<xsl:for-each select="$block-values">
844842
<xsl:if test="doc-available(ac:document-uri(.))">
845843
<xsl:apply-templates select="key('resources', ., document(ac:document-uri(.)))" mode="bs2:Row"/>
846844
</xsl:if>
847845
</xsl:for-each>
846+
847+
<xsl:apply-templates select="." mode="ldh:ContentList"/>
848848
</xsl:when>
849849
<xsl:when test="$ac:mode = '&ac;MapMode'">
850850
<xsl:apply-templates select="." mode="bs2:Map">

src/main/webapp/static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/resource.xsl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,6 @@ extension-element-prefixes="ixsl"
916916
</xsl:perform-sort>
917917
</xsl:variable>
918918

919-
<xsl:variable name="this" select="@rdf:about" as="xs:anyURI"/>
920919
<xsl:for-each select="$predicates[@rdf:resource]"> <!-- do not iterate $predicates/@rdf:resource sequence as it will be sorted differently -->
921920
<xsl:apply-templates select="key('resources', @rdf:resource)" mode="bs2:Row"/>
922921
</xsl:for-each>

0 commit comments

Comments
 (0)