/ldh:appfrom LinkedDataHub
Declares LinkedDataHub applications as RDF documents in a dataspace using the ldh CLI. Defines document trees, content blocks, SPARQL-backed views (table, grid, list, map, graph), charts, federated queries, and public access. Use when presenting data in an existing dataspace or packaging an installable app.
Ships in LinkedDataHub. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A LinkedDataHub app is declared, not generated: it is RDF documents in the dataspace, with no code
and no build step. Pages are documents. A page's content is an ordered list of blocks. Lists, tables,
maps and charts are blocks backed by SPARQL queries. The whole app can live in a directory of Turtle
files that ldh push writes into the dataspace, so it is versioned in git and re-installable.
References:
push): https://docs.linkeddatahub.com/reference/command-line-interface/northwind-traders: dashboards,
faceted views, charts; copenhagen: map views)GRAPH ?g { … }. Give each
linked resource its own graph variable, because each resource lives in its own document.<doc#this>, linked with
foaf:primaryTopic, and its properties go there.ldh with
export LDH_BASE='${user_config.ldh_base}' LDH_CERT_FILE='${user_config.cert_file}';, the plugin's
settings (/plugin → ldh → configure); a variable set in one Bash command is gone by the next. ldh reads
the certificate's password from LDH_CERT_PASSWORD, which the user sets in their own environment, such as
the env block of ~/.claude/settings.json. If a setting or the password is missing, ask the user for it:
never read secrets/, search the disk for a certificate or a password, or guess one.ldh that matches the instance. Build it from the same LinkedDataHub checkout or release
as the running image (ldh --version). An instance whose end-user responses carry no
https://w3id.org/atomgraph/linkeddatahub/dataspaces#admin Link (check with ldh get --head --accept text/turtle "$LDH_BASE")
predates the CLI's admin discovery. There, ldh admin commands stop with "advertises no lds:admin link".
An admin base advertises itself as its lds:admin only from 6.2.1 on. Use the image built from the same checkout as the CLI.| Resource | Shape |
|---|---|
| Container (a section other documents live under) | <> a dh:Container ; dct:title "…" |
| Item (a leaf page: a dashboard, a chart page, or a record) | <> a dh:Item ; dct:title "…", plus foaf:primaryTopic <#this> when it describes a thing |
| Rich-text block | <#intro> a ldh:XHTML ; rdf:value """<div xmlns="http://www.w3.org/1999/xhtml">…</div>"""^^rdf:XMLLiteral |
| Embedded resource block | <#b> a ldh:Object ; rdf:value <resource> |
| Block order | <> rdf:_1 <#intro> ; rdf:_2 <#b> on the document |
Only ldh:XHTML and ldh:Object may be rdf:_N values. Views, charts and anything else are
wrapped in an ldh:Object whose rdf:value names them. Bare ones are rejected by validation.
XHTML must be well-formed, in the XHTML namespace, with each tag on one line.
Pick the type by what will live under the page, not by how it looks. A page made only of blocks
(a chart page, a dashboard, an about page) with nothing beneath it is a dh:Item. Make it a
dh:Container only when documents will be created under it, e.g. the target of an import. Both
types take the same blocks.
Built-ins worth knowing: rdf:value ldh:ChildrenView lists the container's children, and the query
ldh:SelectChildren selects them for a view of your own (e.g. a map of the children).
ldh create container writes the children view as the first block; --no-children-view leaves it
out, for a container that embeds its own view of them.
Views render resources; charts render numbers. A view's SELECT returns resources (their rows are
navigable, facetable and linkable). A query with COUNT/SUM/GROUP BY belongs in a chart, never
a view.
@prefix ldh: <https://w3id.org/atomgraph/linkeddatahub#> .
@prefix ac: <https://w3id.org/atomgraph/client#> .
@prefix dh: <https://w3id.org/atomgraph/linkeddatahub/document-hierarchy#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
<> a dh:Container ;
dct:title "Products" ;
rdf:_1 <#intro> ;
rdf:_2 <#products-block> ;
rdf:_3 <#per-category-block> .
<#intro> a ldh:XHTML ;
rdf:value """<div xmlns="http://www.w3.org/1999/xhtml"><p>Everything in the catalogue.</p></div>"""^^rdf:XMLLiteral .
<#products-block> a ldh:Object ;
dct:title "All products" ;
rdf:value <#products-view> .
<#products-view> a ldh:View ;
dct:title "All products" ;
spin:query <#select-products> ;
ac:mode ac:TableMode .
<#select-products> a sp:Select ;
dct:title "Select products" ;
sp:text """PREFIX schema: <https://schema.org/>
SELECT DISTINCT ?product
WHERE { GRAPH ?g { ?product a schema:Product ; schema:name ?name } }
ORDER BY ?name""" .
<#per-category-block> a ldh:Object ;
dct:title "Products per category" ;
rdf:value <#per-category> .
<#per-category> a ldh:ResultSetChart ;
dct:title "Products per category" ;
spin:query <#count-per-category> ;
ldh:chartType ac:BarChart ;
ldh:categoryVarName "categoryName" ;
ldh:seriesVarName "productCount" .
<#count-per-category> a sp:Select ;
dct:title "Count products per category" ;
sp:text """PREFIX schema: <https://schema.org/>
SELECT ?categoryName (COUNT(DISTINCT ?product) AS ?productCount)
WHERE {
GRAPH ?pg { ?product a schema:Product ; schema:category ?category }
GRAPH ?cg { ?category schema:name ?categoryName }
}
GROUP BY ?category ?categoryName
ORDER BY DESC(?productCount)""" .
ac:mode): ac:ListMode, ac:TableMode, ac:GridMode, ac:MapMode (the
resources need geo:lat/geo:long), ac:GraphMode.ldh:chartType): ac:BarChart, ac:LineChart, ac:ScatterChart.
ldh:categoryVarName and ldh:seriesVarName name the query's variables, without ?.
ldh:seriesVarName may repeat (--series-var-name too); the series are drawn in the order the
query's SELECT projects them.<#q> ldh:service <#dbpedia> with <#dbpedia> a sd:Service ; dct:title "DBpedia" ; sd:endpoint <https://dbpedia.org/sparql> ; sd:supportedLanguage sd:SPARQL11Query. Time a remote
query before building on it, and write it against the remote store's own graph layout.?book schema:datePublished ?year for ORDER BY ?year) goes in OPTIONAL, or resources missing
that value silently drop out of the view.ldh push maps a directory onto the document tree:
my-app/
├── root.ttl → PUT to $LDH_BASE (the root document itself)
├── products.ttl → PUT to ${LDH_BASE}products/
├── products/
│ ├── products.csv → uploaded into products/ (unless ignored)
│ └── featured.ttl → PUT to ${LDH_BASE}products/featured/
├── admin/model/ns.ttl → the ontology, installed separately (ldh:dataset), so ignored
└── .ldhignore → gitignore-style: admin/ *.sh *.csv
Relative URIs in each file resolve against its target URL, so write <> and <#…>. A
subdirectory's document name.ttl sits beside it, not inside it. Non-RDF files are uploaded and
addressed as ${LDH_BASE}uploads/{sha1}, and .xml files count as RDF/XML. Ignore CSVs that
ldh import csv uploads itself.
root.ttl replaces the seeded root document, so keep its type: read it first
(ldh get --accept text/turtle "$LDH_BASE") and start root.ttl from that. A push replaces every
document it writes, so a re-push converges. It stops at the first failed request, and stdout lists
what was written before it.
ldh push --dry-run --dir my-app "$LDH_BASE" # parses every file, prints the plan, sends nothing
ldh push --dir my-app "$LDH_BASE"
An installable app is an install.sh that runs, in this order:
ldh admin make-public (only if anonymous visitors should read it). Each run adds another
authorization, so run it once.ldh packages add (ldh:dataset).ldh push --dir "$app_dir" "$LDH_BASE", which creates the containers the imports write into.ldh import csv|rdf per data file (ldh:dataset), then wait for each import to finish.The script is self-contained. It needs ldh and nothing else, so it runs from wherever the app
directory is copied. The demo apps in LinkedDataHub-Apps source a shared lib/ldh-app.sh, which is
internal to that repository. Do not copy that source line, and do not reference any other checkout
by path.
Make the script a Bash script that stops on the first failed command (a bash interpreter line, then
set -euo pipefail), followed by:
# Installs the app with the ldh CLI, which authenticates with the certificate it is configured with.
: "${LDH_BASE:?}"
app_dir="$(cd "$(dirname "$0")" && pwd)"
ldh admin make-public
ldh admin import ontology --file "$app_dir/admin/model/ns.ttl" # ldh:dataset
ldh push --dir "$app_dir" "$LDH_BASE"
# the target document the import is added to; --wait returns once the data is in, and fails if it is not
ldh import csv --title "Books" --query-file "$app_dir/books/books.rq" \
--csv-file "$app_dir/books/books.csv" --wait "${LDH_BASE}books/"
Every command takes the end-user base. The admin commands find the admin app from it, so the script
never derives an admin. URI. Keep admin/, *.sh, *.rq and *.csv in .ldhignore so push
does not upload them.
Finer access control: ldh admin create group, ldh admin add agent, ldh admin create authorization
(https://docs.linkeddatahub.com/reference/administration/acl/). An authorization names documents with
--to, and a subtree with --default <container>, which covers every document below the container.
--to-all-in takes a class, but not a document class (dh:Item, dh:Container, def:Root or one
above them), which the admin refuses: those classes are shared with the admin documents. A document is
typed with those classes and no other (a write that types it otherwise gets 422), so a class grant
reaches uploaded files (nfo:FileDataObject) only; grant documents with --to and --default.
For one-off changes to a live dataspace, the create/add commands each make one request and print
the new URL:
products=$(ldh create container --parent "$LDH_BASE" --title "Products" --slug products)
ldh add select --uri "${products}#select-products" --title "Select products" \
--query-file "$PWD/select-products.rq" "$products"
ldh add view --uri "${products}#products-view" --title "All products" \
--query "${products}#select-products" --mode https://w3id.org/atomgraph/client#TableMode "$products"
ldh add object-block --value "${products}#products-view" --title "All products" "$products"
ldh add xhtml-block --value '<div xmlns="http://www.w3.org/1999/xhtml"><p>…</p></div>' "$products"
ldh add result-set-chart --query <select URI> --chart-type https://w3id.org/atomgraph/client#BarChart \
--category-var-name categoryName --series-var-name productCount --title "…" "$products"
ldh remove block --block "${products}#products-block" "$products" # without --block: removes ALL blocks
Pass --uri so later commands can reference what you added; without it the resource is a blank
node. If the app is meant to be reinstalled, put the change in the directory too, since the next
push overwrites the document.
An object block whose value is an external URI loads it through the Linked Data proxy. When the
dataspace describes that resource itself, in one of its own documents, --graph <document> makes
the block read the description from there (ldh:graph), with no proxy request. Edits to the embedded
resource then write to that document.
ldh get --accept text/turtle <doc> shows the document as stored.${LDH_BASE}sparql)
before trusting the page. A view with no rows is usually a missing GRAPH, or two resources'
patterns sharing one graph variable.When a property or class needs rendering that no mode or block can declare, write a stylesheet as a reusable package: ldh:package.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/datasetModel and load data into a LinkedDataHub dataspace with the ldh CLI — write the namespace ontology (classes, constructors, constraints, property views), import vocabulary packages, and map CSV or RDF into documents with SPARQL CONSTRUCT imports, or build a large CSV, JSON or XML dataset standalone (CSV2RDF, JSON2RDF, Saxon XSLT, then a quad CONSTRUCT) and bulk-load it. Use when the task is to define a domain model or get data into an existing dataspace. For the documents, views and charts that present it use ldh:app; for a new dataspace use ldh:dataspace./dataspaceProvision a new LinkedDataHub dataspace on a self-hosted instance — an end-user app and its admin app on their own subdomain, each backed by its own Fuseki dataset. Use when the task is to add, rename or rewire a dataspace in config/dataspaces.trig, config/system.trig and config/fuseki/config.ttl. Not for adding data or UI to an existing dataspace (use ldh:dataset and ldh:app)./packageWrite a reusable LinkedDataHub package — an ontology plus an XSLT 3 stylesheet whose templates customise rendering in the platform's open modes (property rows, form controls, value cells, tree nodes, a navigation column) — and publish it to a package registry so any dataspace imports it with ldh packages add. Use when a vocabulary needs rendering or editing behaviour that views, modes and blocks cannot declare. For declarative UI use ldh:app; for a dataspace's own model use ldh:dataset.npx claudepluginhub atomgraph/linkeddatahub --plugin ldhOther plugins' skills for the same job