atomgraph/linkeddatahub/dataset
Claude Code and agent skill by atomgraph/linkeddatahub
- community
Checking that the SKILL.md file is still in the repository.
Model 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.
Install
npx vskill@latest install atomgraph/linkeddatahub/datasetSKILL.md
Model and load data into a LinkedDataHub dataspace
A dataspace's data is a set of documents, each a named graph whose name is the document URL. A resource is described in the document about it: the document https://host/products/42/ describes https://host/products/42/#this and names it with foaf:primaryTopic. Its model is the namespace ontology served at ${LDH_BASE}ns#. The ontology drives the create/edit forms (constructors), the validation (constraints) and the related-resource panels (property views).
References:
- HTTP API for agents: https://github.com/AtomGraph/LinkedDataHub/blob/master/AGENTS.md
- CLI: https://docs.linkeddatahub.com/reference/command-line-interface/
- Ontologies: https://docs.linkeddatahub.com/reference/administration/ontologies/
- Imports: https://docs.linkeddatahub.com/reference/imports/ (
csv/andrdf/beneath it) - Worked example: https://github.com/AtomGraph/LinkedDataHub-Apps/tree/master/demo/northwind-traders
(admin/model/ns.ttl, and a *.rq mapping beside every *.csv)
Ground rules shared with the other ldh skills
- The default graph is empty. Every SPARQL pattern goes inside
GRAPH ?g { … }. A query
without one returns no rows, which looks like missing data but is not.
- One document per resource, so joins cross graphs. Give each linked resource its own graph
variable: GRAPH ?o { ?order schema:customer ?c } GRAPH ?cg { ?c schema:name ?name }.
- Writes go to document URLs (
PUT/POST/PATCH);/sparqlis read-only. Use standard SPARQL 1.1. - Setup:
export LDH_BASE=https://<dataspace>/ LDH_CERT_FILE=<owner keystore.p12> LDH_CERT_PASSWORD=….
The password is the deployment's, never a guess. Commands that create a document print its URL as the only stdout line; exit 1 is an HTTP failure, including a redirect (its Location is on stderr).
- Use an `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.
1. Reuse vocabulary before inventing it
Model with established vocabularies (schema.org, FOAF, Dublin Core, SKOS, …) and declare their classes in the namespace ontology. Mint terms under ${LDH_BASE}ns# only for what none of them covers.
Check the package registry first, since a package can bring a whole vocabulary with its constructors, views and rendering:
It takes effect on the next request, with no restart. A vocabulary the dataspace has not imported is simply absent from the UI's property typeahead and forms.
2. Write the namespace ontology
Keep it as a file, admin/model/ns.ttl, with @prefix : <#> resolving against ${LDH_BASE}ns:
$thisin a constructor is the new instance;$aboutin a view query is the resource whose page
shows it. ldh:view attaches a view to a property for forward links, ldh:inverseView for backlinks.
- A property view shows only on the types the property declares. An
ldh:inverseViewappears on
pages whose resource has a type in the property's rdfs:range. An ldh:view appears on those with a type in its rdfs:domain. Declare the range or domain in ns.ttl, even for a reused term like schema:author, since the dataspace does not import schema.org. Without it the view never appears. Its query can be correct and still never be run, so check the page itself, not only the query.
- Constraints run on every write, imports included. A violating write answers
422, and an import
attaches its violations to the import document. Do not add a constraint the data cannot satisfy.
- View queries
SELECTresources (one variable, the resource) and do not aggregate. Aggregates
belong in charts (ldh:app).
Install it
The ontology lives in the admin app's document ontologies/namespace/, and the dataspace serves it at ${LDH_BASE}ns. Install the file with one command, given the end-user base (LDH_BASE):
ldh finds the admin app and the ontology IRI (${LDH_BASE}ns#) from the base's Link headers, lds:admin and lds:ontology. It parses the file against that IRI, so @prefix : <#> names the end-user namespace. Then it replaces the document, keeping the document's own description and the ontology's header, and clears the ontology cache. It prints the document's URL. A re-run converges, and a class or property removed from the file is gone. Triples about the ontology IRI itself (its label, its owl:imports) accumulate instead, because the header carries the platform's own owl:imports <https://w3id.org/atomgraph/linkeddatahub/default#> and must keep it. To read from stdin, use --file - with -t text/turtle.
Then check it: ldh get --accept text/turtle "${LDH_BASE}ns" shows the new terms.
For a single change to a live ontology, ldh patch that document with a SPARQL update. Get its URL from the output above, or from lds:admin in ${LDH_BASE}context. Then run ldh admin clear ontology --ontology "${LDH_BASE}ns#". A PATCH body must not contain the GRAPH keyword, because it runs inside the document's graph. A plain INSERT { … } WHERE {} is the safe shape. ldh admin add class|constructor|restriction|property-constraint exist for one-off additions. But admin add constructor only creates the query resource: linking it with spin:constructor is a separate patch.
ldh admin commands take the end-user base and follow its lds:admin link to the admin app, so never derive the admin URI yourself.
3. Import the data
Every import is a SPARQL CONSTRUCT mapping that turns the input into documents. Each document is a GRAPH block in the template, named with a URL you mint under an existing container. The server derives each document's parent from its URL and types it dh:Item unless the mapping types it dh:Container. So create the target containers first, by ldh create container or by pushing the document tree (ldh:app).
CSV
Each row becomes a resource whose cells are xsd:string literals on <#column-name> predicates. Map one row to one document:
$baseis the dataspace base URI. The query's ownBASEis the uploaded file's URI, so do not
set one.
- Mint URLs from natural keys with
encode_for_uri. A foreign key becomes a link by minting the same
URL the other mapping mints (here categories/{id}/#this), so the import order does not matter.
- Cast with
BIND(xsd:decimal,xsd:date,xsd:floatforgeo:lat/geo:long). Wrap
optional cells in OPTIONAL. An unbound variable silently drops its triple.
--query-file and --csv-file take absolute paths. --delimiter defaults to ,.
RDF
Pass --graph or --query-file, not both.
Imports run in the background
The command returns once the import exists, before the data does. It prints the URI of the import, an ldh:CSVImport or ldh:RDFImport resource in the target document. Add --wait to return only once the import has ended: it prints the triple count to stderr, and exits 1 with the error if the import failed or did not end within --timeout seconds (default 1200).
Without --wait, the import is done when it carries prov:endedAtTime. Its outcome points back at it with prov:wasGeneratedBy: a void:Dataset with void:triples on success, an entity with the message in dct:description on failure.
Then confirm the data landed with a GRAPH query against the dataspace's SPARQL endpoint, the sd:endpoint Link header of any response (conventionally ${LDH_BASE}sparql):
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/ldh/skills/dataset/SKILL.md
Popularity
- Repository stars
- 630
- Repository forks
- 148
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/atomgraph/linkeddatahub/dataset)