@@ -94,14 +94,13 @@ ORDER BY DESC(?created)
9494 <xsl : template name =" ldh:LeftSidebar" >
9595 <xsl : param name =" base" select =" ldt:base()" as =" xs:anyURI" />
9696
97- <!-- Document tree container -->
97+ <!-- document tree container -->
9898 <div id =" document-tree" >
9999 <h2 class =" nav-header btn" >
100100 <xsl : apply-templates select =" key('resources', 'document-tree', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode =" ac:label" />
101101 </h2 >
102102
103103 <ul class =" well well-small nav nav-list" >
104- <!-- TO-DO: generalize -->
105104 <li >
106105 <button class =" btn btn-small btn-expand-tree" ></button >
107106 <a href =" {$base}" class =" btn-logo btn-container" >
@@ -111,7 +110,7 @@ ORDER BY DESC(?created)
111110 </ul >
112111 </div >
113112
114- <!-- Class list container -->
113+ <!-- class list container -->
115114 <div >
116115 <h2 class =" nav-header btn" >
117116 <xsl : apply-templates select =" key('resources', 'classes', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode =" ac:label" />
@@ -122,7 +121,7 @@ ORDER BY DESC(?created)
122121 </ul >
123122 </div >
124123
125- <!-- Other section -->
124+ <!-- other section -->
126125 <div id =" other-views" >
127126 <h2 class =" nav-header btn" >
128127 <xsl : apply-templates select =" key('resources', 'other', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode =" ac:label" />
@@ -147,21 +146,21 @@ ORDER BY DESC(?created)
147146 <xsl : context-item as =" element()" use =" required" /> <!-- document tree container -->
148147 <xsl : param name =" href" as =" xs:anyURI" />
149148
150- <!-- Strip query params from href to ensure consistent matching -->
149+ <!-- strip query params from href to ensure consistent matching -->
151150 <xsl : variable name =" target-uri" select =" ac:document-uri($href)" as =" xs:anyURI" />
152151
153152 <!-- make the previously active list items inactive -->
154153 <xsl : for-each select =" .//li[contains-token(@class, 'active')]" >
155154 <xsl : sequence select =" ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]" />
156155 </xsl : for-each >
157- <!-- Find li elements whose href (without query params) matches target href (without query params) -->
156+ <!-- find li elements whose href (without query params) matches target href (without query params) -->
158157 <xsl : for-each select =" .//li[a[ac:document-uri(xs:anyURI(@href)) = $target-uri]]" >
159158 <!-- mark the new list item as active -->
160159 <xsl : sequence select =" ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', true() ])[current-date() lt xs:date('2000-01-01')]" />
161160 </xsl : for-each >
162161 </xsl : template >
163162
164- <!-- Update both document-tree and class-list after navigation -->
163+ <!-- update left-sidebar sections -->
165164 <xsl : template name =" ldh:NavigationUpdate" >
166165 <xsl : param name =" href" as =" xs:anyURI" />
167166
@@ -188,7 +187,7 @@ ORDER BY DESC(?created)
188187 <xsl : param name =" container" as =" element()" /> <!-- document-tree element -->
189188 <xsl : param name =" target" as =" xs:anyURI" /> <!-- target document URI (already stripped of query params) -->
190189
191- <!-- Find the root <li> element (first top-level li in the tree) -->
190+ <!-- find the root <li> element (first top-level li in the tree) -->
192191 <xsl : variable name =" root-li" select =" $container/ul/li[1]" as =" element()?" />
193192
194193 <xsl : choose >
@@ -670,7 +669,7 @@ ORDER BY DESC(?created)
670669 <xsl : sequence select =" $context" />
671670 </xsl : function >
672671
673- <!-- Load classes with instances from the SPARQL endpoint -->
672+ <!-- load classes with instances from the SPARQL endpoint -->
674673 <xsl : template name =" ldh:ClassListLoad" >
675674 <xsl : param name =" container" as =" element()" /> <!-- the <ul id="class-list"> -->
676675 <xsl : param name =" endpoint" as =" xs:anyURI" />
@@ -702,7 +701,7 @@ ORDER BY DESC(?created)
702701 on-failure =" ldh:promise-failure#1" />
703702 </xsl : template >
704703
705- <!-- Handle the response from loading classes - extract type URIs and query ns endpoint -->
704+ <!-- handle the response from loading classes - extract type URIs and query ns endpoint -->
706705 <xsl : function name =" ldh:class-list-response" as =" map(*)" ixsl : updating =" yes" >
707706 <xsl : param name =" context" as =" map(*)" />
708707 <xsl : variable name =" response" select =" $context('response')" as =" map(*)" />
@@ -757,7 +756,7 @@ ORDER BY DESC(?created)
757756 <xsl : sequence select =" $context" />
758757 </xsl : function >
759758
760- <!-- Handle the response from describing class types -->
759+ <!-- handle the response from describing class types -->
761760 <xsl : function name =" ldh:class-list-describe-response" as =" map(*)" ixsl : updating =" yes" >
762761 <xsl : param name =" context" as =" map(*)" />
763762 <xsl : variable name =" response" select =" $context('response')" as =" map(*)" />
@@ -810,7 +809,7 @@ ORDER BY DESC(?created)
810809 <xsl : sequence select =" $context" />
811810 </xsl : function >
812811
813- <!-- Render a class as a list item with button -->
812+ <!-- render a class as a list item with button -->
814813 <xsl : template match =" *[@rdf:about]" mode =" bs2:ClassListItem" >
815814 <xsl : param name =" count" as =" xs:integer" />
816815
@@ -829,12 +828,11 @@ ORDER BY DESC(?created)
829828 </li >
830829 </xsl : template >
831830
832- <!-- Opens modal dialog to show instances of a class -->
831+ <!-- opens modal dialog to show instances of a class -->
833832 <xsl : template match =" button[contains-token(@class, 'btn-class')]" mode =" ixsl:onclick" >
834833 <xsl : variable name =" class-uri" select =" xs:anyURI(ixsl:get(., 'dataset.classUri'))" />
835834 <xsl : variable name =" container-id" select =" 'class-instances-container'" as =" xs:string" />
836835
837- <!-- Create modal structure with a block element -->
838836 <xsl : variable name =" modal" as =" element()" >
839837 <div class =" modal modal-constructor fade in" id =" class-instances-modal" >
840838 <div class =" modal-header" >
@@ -879,17 +877,14 @@ ORDER BY DESC(?created)
879877 </div >
880878 </xsl : variable >
881879
882- <!-- Show modal -->
883880 <xsl : call-template name =" ldh:ShowModalForm" >
884881 <xsl : with-param name =" form" select =" $modal" />
885882 </xsl : call-template >
886883
887- <!-- Create cache entry for the block -->
888884 <xsl : if test =" not(ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $container-id || '`'))" >
889885 <ixsl : set-property name =" {'`' || $container-id || '`'}" select =" ldh:new-object()" object =" ixsl:get(ixsl:window(), 'LinkedDataHub.contents')" />
890886 </xsl : if >
891887
892- <!-- Load instances into modal -->
893888 <xsl : call-template name =" ldh:ClassInstancesLoad" >
894889 <xsl : with-param name =" container" select =" id($container-id, ixsl:page())" />
895890 <xsl : with-param name =" class-uri" select =" $class-uri" />
@@ -898,11 +893,12 @@ ORDER BY DESC(?created)
898893 </xsl : call-template >
899894 </xsl : template >
900895
901- <!-- Load instances for a specific class -->
896+ <!-- load instances for a specific class -->
902897 <xsl : template name =" ldh:ClassInstancesLoad" >
903898 <xsl : param name =" container" as =" element()" />
904899 <xsl : param name =" class-uri" as =" xs:anyURI" />
905900 <xsl : param name =" endpoint" as =" xs:anyURI" />
901+ <xsl : param name =" page-size" select =" 20" as =" xs:integer" />
906902 <xsl : param name =" cache" as =" item()" />
907903 <xsl : variable name =" container-id" select =" $container/@id" as =" xs:string" />
908904
@@ -912,6 +908,7 @@ ORDER BY DESC(?created)
912908 <!-- TODO: we need to check if instances are in named graphs - for now use SelectInstancesInGraphs -->
913909 <xsl : variable name =" query-uri" select =" xs:anyURI('&ldh; SelectInstancesInGraphs')" as =" xs:anyURI" />
914910 <xsl : variable name =" select-string" select =" key('resources', $query-uri, document(ac:document-uri('&ldh; ')))/sp:text" as =" xs:string" />
911+ <xsl : variable name =" cache" select =" ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $container-id || '`')" as =" item()" />
915912
916913 <xsl : variable name =" select-json" as =" item()" >
917914 <xsl : variable name =" select-builder" select =" ixsl:call(ixsl:get(ixsl:get(ixsl:window(), 'SPARQLBuilder'), 'SelectBuilder'), 'fromString', [ $select-string ])" />
@@ -925,8 +922,14 @@ ORDER BY DESC(?created)
925922 </xsl : apply-templates >
926923 </xsl : document >
927924 </xsl : variable >
928-
929- <xsl : variable name =" cache" select =" ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $container-id || '`')" as =" item()" />
925+ <xsl : variable name =" select-xml" as =" document-node()" >
926+ <xsl : document >
927+ <xsl : apply-templates select =" $select-xml" mode =" ldh:replace-limit" >
928+ <xsl : with-param name =" limit" select =" $page-size" tunnel =" yes" />
929+ </xsl : apply-templates >
930+ </xsl : document >
931+ </xsl : variable >
932+
930933 <ixsl : set-property name =" select-xml" select =" $select-xml" object =" $cache" />
931934 <ixsl : set-property name =" select-string" select =" $select-string" object =" $cache" />
932935 <ixsl : set-property name =" initial-var-name" select =" 's'" object =" $cache" /> <!-- has to match ldh:SelectInstancesInGraphs -->
@@ -967,12 +970,11 @@ ORDER BY DESC(?created)
967970 <xsl : next-match />
968971 </xsl : template >
969972
970- <!-- Opens modal dialog to show geo resources -->
973+ <!-- opens modal dialog to show geo resources -->
971974 <xsl : template match =" button[contains-token(@class, 'btn-geo')]" mode =" ixsl:onclick" >
972975 <xsl : variable name =" container-id" select =" 'geo-container'" as =" xs:string" />
973976 <xsl : variable name =" select-string" select =" $geo-resources-string" as =" xs:string" />
974977
975- <!-- Create modal structure with a block element -->
976978 <xsl : variable name =" modal" as =" element()" >
977979 <div class =" modal modal-constructor fade in" id =" geo-modal" >
978980 <div class =" modal-header" >
@@ -1010,12 +1012,10 @@ ORDER BY DESC(?created)
10101012 </div >
10111013 </xsl : variable >
10121014
1013- <!-- Show modal -->
10141015 <xsl : call-template name =" ldh:ShowModalForm" >
10151016 <xsl : with-param name =" form" select =" $modal" />
10161017 </xsl : call-template >
10171018
1018- <!-- Create cache entry for the block -->
10191019 <xsl : if test =" not(ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $container-id || '`'))" >
10201020 <ixsl : set-property name =" {'`' || $container-id || '`'}" select =" ldh:new-object()" object =" ixsl:get(ixsl:window(), 'LinkedDataHub.contents')" />
10211021 </xsl : if >
@@ -1024,7 +1024,6 @@ ORDER BY DESC(?created)
10241024 <ixsl : set-property name =" initial-var-name" select =" 'resource'" object =" $cache" /> <!-- has to match $geo-resources-string -->
10251025 <ixsl : set-property name =" endpoint" select =" sd:endpoint()" object =" $cache" />
10261026
1027- <!-- Load geo resources into modal -->
10281027 <xsl : call-template name =" ldh:GeoResourcesLoad" >
10291028 <xsl : with-param name =" container" select =" id($container-id, ixsl:page())" />
10301029 <xsl : with-param name =" endpoint" select =" sd:endpoint()" />
@@ -1050,15 +1049,13 @@ ORDER BY DESC(?created)
10501049 <xsl : variable name =" select-xml" as =" document-node()" >
10511050 <xsl : document >
10521051 <xsl : apply-templates select =" json-to-xml($select-json-string)" mode =" ldh:replace-variables" >
1053- <xsl : with-param name =" var-names" select =" ('resource')" tunnel =" yes" />
1052+ <xsl : with-param name =" var-names" select =" ('resource')" tunnel =" yes" /> <!-- has to match the query projection -->
10541053 </xsl : apply-templates >
10551054 </xsl : document >
10561055 </xsl : variable >
10571056
1058- <!-- store the transformed query XML -->
10591057 <ixsl : set-property name =" select-xml" select =" $select-xml" object =" $cache" />
10601058
1061- <!-- Initialize progress counters: 3 steps (metadata, render-view, result-count) -->
10621059 <xsl : sequence select =" ldh:update-progress-counter($cache, map{'container': $container}, 'init', 3)" />
10631060
10641061 <xsl : variable name =" view-context" as =" map(*)" >
@@ -1081,12 +1078,11 @@ ORDER BY DESC(?created)
10811078 on-failure =" ldh:promise-failure#1" />
10821079 </xsl : template >
10831080
1084- <!-- Opens modal dialog to show latest resources -->
1081+ <!-- opens modal dialog to show latest resources -->
10851082 <xsl : template match =" button[contains-token(@class, 'btn-latest')]" mode =" ixsl:onclick" >
10861083 <xsl : variable name =" container-id" select =" 'latest-container'" as =" xs:string" />
10871084 <xsl : variable name =" select-string" select =" $latest-resources-string" as =" xs:string" />
10881085
1089- <!-- Create modal structure with a block element -->
10901086 <xsl : variable name =" modal" as =" element()" >
10911087 <div class =" modal modal-constructor fade in" id =" latest-modal" >
10921088 <div class =" modal-header" >
@@ -1108,7 +1104,7 @@ ORDER BY DESC(?created)
11081104
11091105 <div id =" {$container-id}" class =" row-fluid" typeof =" &ldh; View" >
11101106 <div class =" main span12" >
1111- <!-- View results will be rendered here -->
1107+ <!-- view results will be rendered here -->
11121108 </div >
11131109 </div >
11141110 </div >
@@ -1124,12 +1120,10 @@ ORDER BY DESC(?created)
11241120 </div >
11251121 </xsl : variable >
11261122
1127- <!-- Show modal -->
11281123 <xsl : call-template name =" ldh:ShowModalForm" >
11291124 <xsl : with-param name =" form" select =" $modal" />
11301125 </xsl : call-template >
11311126
1132- <!-- Create cache entry for the block -->
11331127 <xsl : if test =" not(ixsl:contains(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $container-id || '`'))" >
11341128 <ixsl : set-property name =" {'`' || $container-id || '`'}" select =" ldh:new-object()" object =" ixsl:get(ixsl:window(), 'LinkedDataHub.contents')" />
11351129 </xsl : if >
@@ -1138,10 +1132,8 @@ ORDER BY DESC(?created)
11381132 <ixsl : set-property name =" initial-var-name" select =" 'dated'" object =" $cache" /> <!-- has to match $latest-resources-string -->
11391133 <ixsl : set-property name =" endpoint" select =" sd:endpoint()" object =" $cache" />
11401134
1141- <!-- Initialize progress counters: 3 steps (metadata, render-view, result-count) -->
11421135 <xsl : sequence select =" ldh:update-progress-counter($cache, map{'container': id($container-id, ixsl:page())}, 'init', 3)" />
11431136
1144- <!-- Load latest resources into modal -->
11451137 <xsl : call-template name =" ldh:LatestResourcesLoad" >
11461138 <xsl : with-param name =" container" select =" id($container-id, ixsl:page())" />
11471139 <xsl : with-param name =" endpoint" select =" sd:endpoint()" />
@@ -1150,11 +1142,12 @@ ORDER BY DESC(?created)
11501142 </xsl : call-template >
11511143 </xsl : template >
11521144
1153- <!-- Load latest resources -->
1145+ <!-- load latest resources -->
11541146 <xsl : template name =" ldh:LatestResourcesLoad" >
11551147 <xsl : param name =" container" as =" element()" />
11561148 <xsl : param name =" select-string" as =" xs:string" />
11571149 <xsl : param name =" endpoint" as =" xs:anyURI" />
1150+ <xsl : param name =" page-size" select =" 20" as =" xs:integer" />
11581151 <xsl : param name =" cache" as =" item()" />
11591152
11601153 <ixsl : set-style name =" cursor" select =" 'progress'" object =" ixsl:page()//body" />
@@ -1167,15 +1160,20 @@ ORDER BY DESC(?created)
11671160 <xsl : variable name =" select-xml" as =" document-node()" >
11681161 <xsl : document >
11691162 <xsl : apply-templates select =" json-to-xml($select-json-string)" mode =" ldh:replace-variables" >
1170- <xsl : with-param name =" var-names" select =" ('dated')" tunnel =" yes" />
1163+ <xsl : with-param name =" var-names" select =" ('dated')" tunnel =" yes" /> <!-- has to match the query projection -->
1164+ </xsl : apply-templates >
1165+ </xsl : document >
1166+ </xsl : variable >
1167+ <xsl : variable name =" select-xml" as =" document-node()" >
1168+ <xsl : document >
1169+ <xsl : apply-templates select =" $select-xml" mode =" ldh:replace-limit" >
1170+ <xsl : with-param name =" limit" select =" $page-size" tunnel =" yes" />
11711171 </xsl : apply-templates >
11721172 </xsl : document >
11731173 </xsl : variable >
11741174
1175- <!-- store the transformed query XML -->
11761175 <ixsl : set-property name =" select-xml" select =" $select-xml" object =" $cache" />
11771176
1178- <!-- Initialize progress counters: 3 steps (metadata, render-view, result-count) -->
11791177 <xsl : sequence select =" ldh:update-progress-counter($cache, map{'container': $container}, 'init', 3)" />
11801178
11811179 <xsl : variable name =" view-context" as =" map(*)" >
0 commit comments