document-to-kg-skill
Transforms documents or text into RDF-based Knowledge Graphs using schema.org terms. 4-step workflow: (1) Collect document source, {page_url} as @base, output format (JSON-LD or Turtle by default; others if explicitly stated), and destination folder. (2) Generate RDF via schema.org prompt template using chatPromptComplete. (3) Post-generation review: fix syntax errors, present additional Q&A/defined terms/howtos and entity types for approval, return revised final output if approved. (4) Save approved RDF to designated folder and confirm saved path.
OpenLinkSoftware · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add OpenLinkSoftware/ai-agent-skills --skill document-to-kg-skillAbout this skill
name: document-to-kg-skill title: Document to Knowledge Graph Skill description: > Transforms documents or text into RDF-based Knowledge Graphs using schema.org terms. 4-step workflow: (1) Collect document source, {page_url} as @base, output format (JSON-LD or Turtle by default; others if explicitly stated), and destination folder. (2) Generate RDF via schema.org prompt template using chatPromptComplete. (3) Post-generation review: fix syntax errors, present additional Q&A/defined terms/howtos and entity types for approval, return revised final output if approved. (4) Save approved RDF to designated folder and confirm saved path. version: 1.0.0 type: skill created: 2026-04-06T00:00:00.000Z updated: 2026-04-06T00:00:00.000Z tools:
- OAI.DBA.getSkillResource
- OAI.DBA.chatPromptComplete
Document to Knowledge Graph Skill — Specification (v1.0.0)
MANDATORY PRE-TOOL SEQUENCE — READ BEFORE CALLING ANY TOOL
After getSkillResource loads this skill, the next action must be text only — send the Opening Announcement and wait for the user's reply. Do not call any other tool first.
Skill Identity
| Field | Value |
|---|---|
| Name | document-to-kg-skill |
| Version | 1.0.0 |
| Purpose | Transform documents or text into RDF Knowledge Graphs using schema.org terms. |
| Scope | Four-step pipeline: collect source + page_url + format + destination → generate RDF → post-generation review → save to folder. |
Strict Harness Mode
Use Document-to-KG Harness Mode whenever the user asks to transform a document, URL, pasted text, PDF, thread, article, or source mesh into RDF, JSON-LD, Turtle, a Knowledge Graph, or an RDF-backed HTML/MD artifact set.
Harness mode constrains interpretation to this skill's document-to-RDF contract. Do not drift into a generic summary, article rewrite, standalone HTML page, or manually invented graph.
Harness Contract
When active:
- Collect or derive required inputs — document source, canonical
{page_url}, output RDF format, destination path, and whether HTML/Markdown companions are required. - Use
{page_url}as entity namespace for generated document-local IRIs, neverfile:IRIs when a canonical HTTP/HTTPS URL exists. - Generate RDF first using schema.org and approved vocabularies; RDF is the source of truth for any companion HTML/Markdown.
- Apply authority denotation rules —
schema:SoftwareApplication,schema:Organization,schema:Country, andschema:DefinedTerm/skos:Conceptentities must use DBpedia/Wikidata-centered IRIs as described below, withowl:sameAsfor confirmed cross references. - Inspect collection sources as collections — when the source is a manual, documentation site, sitemap-backed site, MkDocs/Docusaurus/VitePress collection, GitBook, docs portal, or other multi-page source, inspect sitemap/search index/navigation for high-signal child pages before finalizing RDF. Always review child pages about APIs, SPARQL, endpoints, query examples, services, reporting workflows, data models, server/runtime platforms, and integration instructions when present.
- Preserve SPARQL-bearing content — when source content includes SPARQL queries, query examples, endpoint demos, or reporting/query recipes, do not summarize the query body away. Model each material query as a named
schema:SoftwareSourceCoderesource withschema:programmingLanguage "SPARQL",schema:text,schema:codeSampleType,schema:targetpointing to the endpoint/service, andschema:potentialActionpointing to a correctly URL-encoded live query URL when the endpoint accepts GET query parameters. Preserve documented placeholders visibly. - Validate before save — RDF syntax, expanded DBpedia/Wikidata IRIs, no fabricated IRIs, no double-encoded resolver IRIs, no
file:IRIs, and required prefix declarations. - If HTML/Markdown companions are requested, hand off to the
rdf-infographic-skillRDF Infographic Harness Mode and satisfy its full HTML/MD/RDF pairing, resolver, KG Explorer, navigation, attribution, and validation contract. - Fail closed on missing requirements — if a required source, page URL, destination, resolver, or artifact scope is ambiguous and cannot be safely inferred, ask before generating.
This harness is the default for requests such as "generate RDF and associated HTML and MD docs", "redo for this URL", "mesh these sources into RDF/HTML/MD", and "reproduce the HTML infographic from RDF".
Opening Announcement
⛔ Send this text immediately after getSkillResource loads. Do not call any tool before this message is sent and the user has replied.
Document to Knowledge Graph Skill activated. I follow a 4-step workflow:
Step 1 — Collect your document source, page URL, output format, and destination folder Step 2 — Generate RDF using schema.org terms Step 3 — Review: fix syntax, approve additional Q&A / entity types Step 4 — Save the approved RDF to your designated folder
To begin, please provide:
- Document source — paste your text, provide an
http:/https:URL to fetch, or provide afile:URL to read from local disk- Page URL (
{page_url}) — used as@basefor all relative IRIs (defaults to the source URL for HTTP/HTTPS; forfile:URLs you will be asked whether to use it as-is or supply a canonical HTTP URL)- Output format — JSON-LD or Turtle (default choices; any other format accepted if stated)
- Destination folder — where to save the output file
Wait for the user's reply. → NEXT: Step 1.
⛔ PRE-BUILD CHECK: Before producing output, re-read the relevant workflow section above and re-read any checklists or verification gates defined in this skill. Confirm each checklist item before writing output. Build to pass — do not retro-fit. Apply the CLAUDE.md Anti-Drift Protocol: re-read spec section before build, gate-fir
Read the complete source ↗