Skip to content

Commit 5d38e09

Browse files
namedgraphclaude
andcommitted
Add broken link checker and fix 8 broken relative links in docs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ce24ae8 commit 5d38e09

File tree

9 files changed

+71
-7
lines changed

9 files changed

+71
-7
lines changed

.github/workflows/check-docs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check Docs
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
check-docs:
10+
name: Check documentation
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: RDF syntax check
18+
uses: AtomGraph/RDF-syntax-check@v1.0.5
19+
20+
- name: Check links
21+
run: ./check-links.sh

check-links.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
5+
EXIT_CODE=0
6+
7+
resolve_url() {
8+
python3 -c "
9+
import urllib.parse, sys
10+
base = 'http://x/' + sys.argv[1]
11+
result = urllib.parse.urljoin(base, sys.argv[2])
12+
print(result[len('http://x/'):])
13+
" "$1" "$2"
14+
}
15+
16+
while IFS= read -r -d '' ttl_file; do
17+
rel="${ttl_file#"$REPO_DIR"/}"
18+
url_path="${rel%.ttl}/"
19+
20+
while IFS= read -r url; do
21+
[[ "$url" =~ ^https?:// ]] && continue
22+
[[ "$url" =~ ^# ]] && continue
23+
[[ "$url" =~ (^|/)uploads/ ]] && continue
24+
[[ -z "$url" ]] && continue
25+
26+
path="${url%%#*}"
27+
[[ -z "$path" ]] && continue
28+
[[ "$path" =~ \.[a-zA-Z]+$ ]] && continue # skip links to files (e.g. .xsl)
29+
30+
resolved="$(resolve_url "$url_path" "$path")"
31+
target_file="$REPO_DIR/${resolved%/}.ttl"
32+
33+
if [[ ! -f "$target_file" ]]; then
34+
echo "BROKEN: $rel$url (resolves to ${resolved%/}.ttl)"
35+
EXIT_CODE=1
36+
fi
37+
done < <(grep -oE '(href|src|data)="[^"]*"' "$ttl_file" | sed 's/^[^"]*"//;s/"$//' || true)
38+
done < <(find "$REPO_DIR" -name "*.ttl" -print0)
39+
40+
exit "$EXIT_CODE"

docs/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,8 @@ install:
2525
validate:
2626
./validate-documents.sh
2727

28+
check-links:
29+
../check-links.sh
30+
2831
ttl-to-html:
2932
./ttl-to-html.sh

docs/reference/administration/acl.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
<h2 id="user-accounts">User accounts</h2>
6262
<p>User account is a subclass of the <a href="http://rdfs.org/sioc/spec/#term_UserAccount"><code>sioc:UserAccount</code></a>
6363
class. An account is the actual instance that performs actions on the application
64-
(<a href="../reference/data-model/documents/#manage">manages documents</a>, <a href="../../user-guide/import-data/import-csv-data/">imports data</a> etc.). An
64+
(<a href="../../data-model/documents/#manage">manages documents</a>, <a href="../../../user-guide/import-data/import-csv-data/">imports data</a> etc.). An
6565
account always belongs to an <a href="#agents">agent</a>.</p>
6666
</div>
6767
-->

docs/reference/administration/packages.ttl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<dt><code>ns.ttl</code> — Package ontology</dt>
3535
<dd>An RDF ontology file that imports the external vocabulary using <code>owl:imports</code> and attaches blocks to properties using <code>ldh:view</code> (forward relationships) or <code>ldh:inverseView</code> (inverse relationships). Blocks are typically <code>ldh:View</code> resources with SPARQL queries that render related data for property values.</dd>
3636
<dt><code>layout.xsl</code> — XSLT stylesheet</dt>
37-
<dd>XSLT transformation file with templates that override default rendering using system modes like <code>bs2:*</code> (Bootstrap 2.3.2 components) and <code>xhtml:*</code> (XHTML elements). See <a href="../stylesheets/" target="_blank">Stylesheets reference</a> for details on XSLT customization.</dd>
37+
<dd>XSLT transformation file with templates that override default rendering using system modes like <code>bs2:*</code> (Bootstrap 2.3.2 components) and <code>xhtml:*</code> (XHTML elements). See <a href="../../stylesheets/" target="_blank">Stylesheets reference</a> for details on XSLT customization.</dd>
3838
</dl>
3939
<p>Package files are organized in the LinkedDataHub-Apps repository:</p>
4040
<pre>packages/
@@ -191,7 +191,7 @@ schema:knows ldh:view :PersonKnows .
191191
ORDER BY ?person
192192
\"\"\" .</pre>
193193
<h3 id="write-stylesheet">Write XSLT stylesheet</h3>
194-
<p>Create <code>layout.xsl</code> with XSLT templates using system modes like <code>bs2:*</code> and <code>xhtml:*</code>. See the <a href="../stylesheets/" target="_blank">Stylesheets reference</a> for template customization patterns.</p>
194+
<p>Create <code>layout.xsl</code> with XSLT templates using system modes like <code>bs2:*</code> and <code>xhtml:*</code>. See the <a href="../../stylesheets/" target="_blank">Stylesheets reference</a> for template customization patterns.</p>
195195
<pre>&lt;xsl:template match="schema:knows" mode="bs2:PropertyList"/&gt;</pre>
196196
<h3 id="publish-metadata">Publish package metadata</h3>
197197
<p>Publish package metadata as Linked Data at your package URI:</p>

docs/user-guide/create-data/create-content.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<dt>XHTML</dt>
2020
<dd>A fragment of XHTML that is embedded onto the page</dd>
2121
<dt>Object</dt>
22-
<dd>RDF URI resources that get transcluded into the page. <a href="../../../reference/user-interface/resources/#built-in-classes">Built-in resource</a> examples:
22+
<dd>RDF URI resources that get transcluded into the page. <a href="../../../reference/data-model/resources/#built-in-classes">Built-in resource</a> examples:
2323
<dl>
2424
<dt>Linked Data resource</dt>
2525
<dd>Any URI that resolves to RDF data</dd>

docs/user-guide/import-data/import-csv-data.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
</dl>
6666
</li>
6767
<li>Once all the fields have been filled in click <span class="btn btn-primary btn-save">Save</span>. You can find this saved under
68-
<dfn>Queries</dfn> container in <a href="../../user-interface/#left-nav">left navigation</a>.</li>
68+
<dfn>Queries</dfn> container in <a href="../../../reference/user-interface/#left-nav">left navigation</a>.</li>
6969
<li>Click on the <span class="btn btn-primary create-action">Create <span class="caret"></span></span> dropdown button at the top left-hand corner and select <dfn>CSV Import</dfn>.
7070
This will open a new form.</li>
7171
<li>Fill out <dfn>Item</dfn> fields</li>

docs/user-guide/import-data/import-rdf-data.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</dl>
137137
</li>
138138
<li>Once all the fields have been filled in click <span class="btn btn-primary btn-save">Save</span>. You can find this saved under
139-
<dfn>Queries</dfn> container in <a href="../../user-interface/#left-nav">left navigation</a>.</li>
139+
<dfn>Queries</dfn> container in <a href="../../../reference/user-interface/#left-nav">left navigation</a>.</li>
140140
<li>Click on the <span class="btn btn-primary create-action">Create <span class="caret"></span></span> dropdown button at the top left-hand corner and select <dfn>RDF Import</dfn>.
141141
This will open a new form.</li>
142142
<li>Fill out <dfn>Item</dfn> fields</li>

docs/user-guide/query-data.ttl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
rdf:value """<div xmlns="http://www.w3.org/1999/xhtml">
1313
<p class="lead">This guide describes how the application dataset can be queried using SPARQL.</p>
1414
<p>The <a href="../../reference/dataspace/#end-user-apps">end-user application</a> dataset can be queried using SPARQL 1.1
15-
endpoint, which is available via link in the <a href="../../user-interface/#nav-bar">navigation bar</a>.</p>
15+
endpoint, which is available via link in the <a href="../../reference/user-interface/#nav-bar">navigation bar</a>.</p>
1616
<p>All forms of SPARQL queries are allowed; SPARQL updates are <em>not</em> allowed. A result limit might apply.</p>
1717
<p>For <code>DESCRIBE</code> and <code>CONSTRUCT</code> results, it is possible to switch the
1818
<a href="../../reference/user-interface/#layout-modes">layout mode</a> using a button above to the results.</p>

0 commit comments

Comments
 (0)