Skip to content

Commit

Permalink
Merge branch 'rf-retry-handler' of github.com:AtomGraph/LinkedDataHub…
Browse files Browse the repository at this point in the history
… into rf-retry-handler
  • Loading branch information
namedgraph committed Jan 6, 2025
2 parents a4a7e8b + 4f8d966 commit 0488d13
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 93 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>com.atomgraph</groupId>
<artifactId>linkeddatahub</artifactId>
<version>5.0.4-SNAPSHOT</version>
<version>5.0.5-SNAPSHOT</version>
<packaging>${packaging.type}</packaging>

<name>AtomGraph LinkedDataHub</name>
Expand Down
4 changes: 0 additions & 4 deletions scripts/add-object-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ if [ -z "$base" ] ; then
print_usage
exit 1
fi
if [ -z "$title" ] ; then
print_usage
exit 1
fi
if [ -z "$value" ] ; then
print_usage
exit 1
Expand Down
20 changes: 0 additions & 20 deletions scripts/add-view-block.sh → scripts/add-view.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ do
shift # past argument
shift # past value
;;
--proxy)
proxy="$2"
shift # past argument
shift # past value
;;
-b|--base)
base="$2"
shift # past argument
Expand Down Expand Up @@ -96,20 +91,6 @@ if [ -z "$query" ] ; then
exit 1
fi

target="$1"

ntriples=$(./get.sh \
-f "$cert_pem_file" \
-p "$cert_password" \
--proxy "$proxy" \
--accept 'application/n-triples' \
"$target")

# extract the numbers from the sequence properties
sequence_number=$(echo "$ntriples" | grep "<${target}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#_" | cut -d " " -f 2 | cut -d'#' -f 2 | cut -d '_' -f 2 | cut -d '>' -f 1 | sort -nr | head -n1)
sequence_number=$((sequence_number + 1)) # increase the counter
sequence_property="http://www.w3.org/1999/02/22-rdf-syntax-ns#_${sequence_number}"

args+=("-f")
args+=("$cert_pem_file")
args+=("-p")
Expand All @@ -127,7 +108,6 @@ fi
turtle+="@prefix ldh: <https://w3id.org/atomgraph/linkeddatahub#> .\n"
turtle+="@prefix dct: <http://purl.org/dc/terms/> .\n"
turtle+="@prefix spin: <http://spinrdf.org/spin#> .\n"
turtle+="<${target}> <${sequence_property}> ${subject} .\n"
turtle+="${subject} a ldh:View .\n"
turtle+="${subject} spin:query <${query}> .\n"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ WHERE
{ { ?class a owl:Class }
UNION
{ ?class a rdfs:Class }
?class rdfs:isDefinedBy $this
?class rdfs:isDefinedBy $about
}
}
""" .
Expand Down Expand Up @@ -234,7 +234,7 @@ PREFIX acl: <http://www.w3.org/ns/auth/acl#>
SELECT DISTINCT ?agent
WHERE
{ GRAPH ?authGraph
{ $this acl:agent ?agent }
{ $about acl:agent ?agent }
}
""" ;
rdfs:isDefinedBy : .
Expand Down
7 changes: 5 additions & 2 deletions src/main/resources/com/atomgraph/linkeddatahub/ldh.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,11 @@ dh:Item spin:constructor :TitleConstructor, :DescriptionConstructor, :PrimaryTop
PREFIX spin: <http://spinrdf.org/spin#>
CONSTRUCT {
$this rdf:_1 [ a ldh:View ;
spin:query ldh:SelectChildren
$this rdf:_1 [ a ldh:Object ;
rdf:value [
a ldh:View ;
spin:query ldh:SelectChildren
]
] .
}
WHERE {}""" ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ exclude-result-prefixes="#all"

<!-- render block -->

<!-- match resources that are not LDH system resources -->
<xsl:template match="*[@typeof[not(. = ('&ldh;Object', '&ldh;View', '&ldh;GraphChart', '&ldh;ResultSetChart'))]]" mode="ldh:RenderRow" priority="1">
<xsl:apply-templates mode="#current"/>

<!-- hide the progress bar -->
<xsl:for-each select="ancestor::div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:template>

<xsl:template match="*" mode="ldh:RenderRow">
<xsl:apply-templates mode="#current"/>
</xsl:template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ exclude-result-prefixes="#all"
</xsl:template>

<!-- render chart block -->
<xsl:template match="*[@about][@typeof = ('&ldh;ResultSetChart', '&ldh;GraphChart')][descendant::*[@property = '&spin;query'][@resource]][descendant::*[@property = '&ldh;chartType'][@resource]]" mode="ldh:RenderRow" priority="1">
<xsl:template match="*[@typeof = ('&ldh;ResultSetChart', '&ldh;GraphChart')][descendant::*[@property = '&spin;query'][@resource]][descendant::*[@property = '&ldh;chartType'][@resource]]" mode="ldh:RenderRow" priority="2"> <!-- prioritize above block.xsl -->
<xsl:param name="block" select="ancestor-or-self::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:param name="about" select="$block/@about" as="xs:anyURI"/>
<xsl:param name="container" select="." as="element()"/>
Expand All @@ -218,7 +218,7 @@ exclude-result-prefixes="#all"
<xsl:param name="chart-type-id" select="'chart-type'" as="xs:string"/>
<xsl:param name="category-id" select="'category'" as="xs:string"/>
<xsl:param name="series-id" select="'series'" as="xs:string"/>
<xsl:param name="form-actions" as="element()">
<xsl:param name="form-actions" as="element()?">
<div class="form-actions">
<button class="btn btn-primary btn-save-chart" type="button">
<xsl:apply-templates select="key('resources', 'save', document(resolve-uri('static/com/atomgraph/linkeddatahub/xsl/bootstrap/2.3.2/translations.rdf', $ac:contextUri)))" mode="ldh:logo">
Expand Down Expand Up @@ -365,9 +365,10 @@ exclude-result-prefixes="#all"
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string"/>
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id)" as="xs:anyURI"/>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()?"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string?"/>
<!-- if there is no block, the chart is rendering the current document -->
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else (if ($block-id) then xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id) else ac:absolute-path(ldh:base-uri(.)))" as="xs:anyURI"/>
<xsl:variable name="chart-canvas-id" select="ancestor::fieldset/following-sibling::div/@id" as="xs:string"/>
<xsl:variable name="results" select="if (ixsl:contains(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results')) then ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results') else root(ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'content'))" as="document-node()"/>

Expand Down Expand Up @@ -400,9 +401,10 @@ exclude-result-prefixes="#all"
</xsl:for-each>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string"/>
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id)" as="xs:anyURI"/>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()?"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string?"/>
<!-- if there is no block, the chart is rendering the current document -->
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else (if ($block-id) then xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id) else ac:absolute-path(ldh:base-uri(.)))" as="xs:anyURI"/>
<xsl:variable name="chart-canvas-id" select="ancestor::fieldset/following-sibling::div/@id" as="xs:string"/>
<xsl:variable name="results" select="if (ixsl:contains(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results')) then ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results') else root(ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'content'))" as="document-node()"/>

Expand Down Expand Up @@ -433,9 +435,10 @@ exclude-result-prefixes="#all"
<xsl:sequence select="ixsl:get(ixsl:call(ixsl:get($select, 'selectedOptions'), 'item', [ . ]), 'value')"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string"/>
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id)" as="xs:anyURI"/>
<xsl:variable name="block" select="ancestor::div[contains-token(@class, 'block')][1]" as="element()?"/>
<xsl:variable name="block-id" select="$block/@id" as="xs:string?"/>
<!-- if there is no block, the chart is rendering the current document -->
<xsl:variable name="block-uri" select="if ($block/@about) then $block/@about else (if ($block-id) then xs:anyURI(ac:absolute-path(ldh:base-uri(.)) || '#' || $block-id) else ac:absolute-path(ldh:base-uri(.)))" as="xs:anyURI"/>
<xsl:variable name="chart-canvas-id" select="ancestor::fieldset/following-sibling::div/@id" as="xs:string"/>
<xsl:variable name="results" select="if (ixsl:contains(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results')) then ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'results') else root(ixsl:get(ixsl:get(ixsl:get(ixsl:window(), 'LinkedDataHub.contents'), '`' || $block-uri || '`'), 'content'))" as="document-node()"/>

Expand Down Expand Up @@ -619,6 +622,7 @@ exclude-result-prefixes="#all"
<xsl:call-template name="onChartSPARQLResultsLoad">
<xsl:with-param name="endpoint" select="$endpoint"/>
<xsl:with-param name="results-uri" select="$results-uri"/>
<xsl:with-param name="block" select="$block"/>
<xsl:with-param name="container" select="$container"/>
<xsl:with-param name="chart-canvas-id" select="$canvas-id"/>
<xsl:with-param name="block-uri" select="$block/@about"/>
Expand Down Expand Up @@ -657,6 +661,7 @@ exclude-result-prefixes="#all"

<xsl:template name="onChartSPARQLResultsLoad">
<xsl:context-item as="map(*)" use="required"/>
<xsl:param name="block" as="element()"/>
<xsl:param name="container" as="element()"/>
<xsl:param name="results-uri" as="xs:anyURI"/>
<xsl:param name="block-uri" select="$results-uri" as="xs:anyURI"/>
Expand Down Expand Up @@ -710,8 +715,15 @@ $series: <xsl:value-of select="$series"/>
<xsl:with-param name="series" select="$series"/>
</xsl:call-template>

<xsl:for-each select="$container//div[@class = 'progress-bar']">
<!-- <xsl:for-each select="$container//div[@class = 'progress-bar']">
<ixsl:set-style name="display" select="'none'" object="."/>
</xsl:for-each>-->

<!-- hide the progress bar - either of this block (if it contains a progress bar) or of the parent block -->
<xsl:for-each select="($block//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')], $block/ancestor::div[contains-token(@class, 'block')]//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')])[1]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:for-each>
</xsl:when>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ exclude-result-prefixes="#all"

<xsl:for-each select="$block//div[contains-token(@class, 'bar')]">
<!-- update progress bar -->
<ixsl:set-style name="width" select="'75%'" object="."/>
<ixsl:set-style name="width" select="'50%'" object="."/>
</xsl:for-each>

<!-- don't use ldh:base-uri(.) because its value comes from the last HTML document load -->
Expand Down Expand Up @@ -172,17 +172,15 @@ exclude-result-prefixes="#all"
<xsl:with-param name="mode" select="$mode"/>
<xsl:with-param name="show-edit-button" select="$show-edit-button" tunnel="yes"/>
<xsl:with-param name="object-metadata" select="$object-metadata" tunnel="yes"/>
<xsl:with-param name="show-row-block-controls" select="false()"/> <!-- blocks nested within ldh:Object do not show their own progress bars -->
</xsl:apply-templates>
</xsl:variable>

<xsl:message>
ldh:LoadBlockObjectMetadata $resource: <xsl:value-of select="serialize($resource)"/>
ldh:LoadBlockObjectMetadata $row: <xsl:value-of select="serialize($row)"/>
</xsl:message>
<xsl:message>
ldh:LoadBlockObjectMetadata $resource: <xsl:value-of select="serialize($resource)"/>
ldh:LoadBlockObjectMetadata $row: <xsl:value-of select="serialize($row)"/>
</xsl:message>

<!-- hide the row with the block controls -->
<ixsl:set-style name="z-index" select="'-1'" object="key('elements-by-class', 'row-block-controls', $block)"/>

<xsl:for-each select="$container">
<xsl:result-document href="?." method="ixsl:replace-content">
<!-- wrap the row -->
Expand All @@ -193,18 +191,21 @@ exclude-result-prefixes="#all"

<xsl:apply-templates mode="ldh:RenderRow"/> <!-- recurse down the block hierarchy -->
</xsl:for-each>

<!-- hide the row with the block controls -->
<!-- <ixsl:set-style name="z-index" select="'-1'" object="key('elements-by-class', 'row-block-controls', $block)"/>-->

<!-- hide the progress bar -->
<xsl:for-each select="$block/div[contains-token(@class, 'span12')]">
<!-- <xsl:for-each select="$block/div[contains-token(@class, 'span12')]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>
</xsl:for-each>-->
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="ixsl:call(ixsl:window(), 'alert', [ ?message ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

</xsl:stylesheet>
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ exclude-result-prefixes="#all"
</xsl:result-document>
</xsl:for-each>

<!-- hide the progress bar - either of this block (if it contains a progress bar) or of the parent block -->
<xsl:for-each select="($block//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')], $block/ancestor::div[contains-token(@class, 'block')]//div[contains-token(@class, 'span12')][contains-token(@class, 'progress')][contains-token(@class, 'active')])[1]">
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'progress-striped', false() ])[current-date() lt xs:date('2000-01-01')]"/>
<xsl:sequence select="ixsl:call(ixsl:get(., 'classList'), 'toggle', [ 'active', false() ])[current-date() lt xs:date('2000-01-01')]"/>
</xsl:for-each>

<xsl:apply-templates mode="#current"/>
</xsl:template>

Expand Down
Loading

0 comments on commit 0488d13

Please sign in to comment.