Skip to content

Vault-LD

Vault-LD leverages YAML-LD notation in Markdown frontmatter blocks to implement LLMWiki pattern. It was one of the inspirations for sparqld. Thanks The Knowledge Graph Guys for implementing it!

Let's compare these two tools.

flowchart TB inputs["<div style='text-align:left;font-family:monospace;white-space:nowrap;width:270px'><span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/folder.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Directory'/></span> wiki-link/<br/>├── <span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/language-markdown.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Markdown'/></span> alpha-centauri.md<br/>├── <span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/code-json.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='JSON-LD'/></span> context.jsonld<br/>└── <span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/language-markdown.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Markdown'/></span> proxima-centauri.md</div>"] exporter["<div style='white-space:nowrap;width:850px'><code style='font-size:16px'>python scripts/vault_to_rdf.py &quot;$examples/wiki-link&quot; --out-dir build/wiki-link</code></div>"] outputs["<div style='text-align:left;font-family:monospace;white-space:nowrap;width:270px'><span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/folder.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Directory'/></span> build/wiki-link/<br/>├── <span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/file-code.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Turtle'/></span> data.ttl<br/>└── <span style='display:inline-block;width:1em;height:1em;vertical-align:middle'><img src='../icons/file-code.svg' style='width:1em!important;max-width:1em!important;height:1em!important;display:inline-block;vertical-align:middle' alt='Turtle'/></span> schema.ttl</div>"] store[(Triple store)] inputs --> exporter --> outputs outputs -->|Import| store store -->|SPARQL query| results[Query Results]

Vault-LD

sparqld

Workflow

Installation

Prepare a repository script

The reference exporter is a repository script with Python dependencies. The exporter has no package on PyPI. Clone its checkout & install those dependencies before running it.

Install with Cargo

Install the published package with Cargo, as shown in Starting in CLI.

Reproducing examples on this page

Start at your sparqld checkout root with Python 3 & Git installed. The commands clone The-Knowledge-Graph-Guys/vault-ld into a sibling directory, select the tested revision & install its dependencies. If that checkout already exists, skip the clone command.

Prepare the exporter prepare-exporter.sh

sparqld_root="$PWD"
examples="$sparqld_root/docs/project/decisions/implement-live-file-backed-sparql-access-with/examples"
git clone https://github.com/The-Knowledge-Graph-Guys/vault-ld.git ../vault-ld
cd ../vault-ld
git checkout 025e71be8d810e387dc451c920e05472d1c47170
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r scripts/requirements.txt

Run the diagram's command in the same terminal, from the Vault-LD checkout root. It writes data.ttl & schema.ttl under build/wiki-link/.

To reproduce the comparisons, first prepare the sparqld development environment in its checkout's .venv, with j & the project dependencies installed. Continue in the same terminal with these commands. They return to sparqld & activate its environment. Run the final command alone to check existing results without regenerating them.

Generate & check comparisons compare-exporter.sh

deactivate
cd "$sparqld_root"
. .venv/bin/activate

# Regenerate the saved comparison files.
j vault-ld --vault-ld ../vault-ld

# Check the saved comparisons without changing them.
j vault-ld --vault-ld ../vault-ld --check

Querying

Batch export & load

The reference exporter needs a batch export, a separate triple store & a load step. Refreshing results requires repeating export & load after edits.

Query after initial load

After the initial directory load, query through the HTTP endpoint or Model Context Protocol (MCP). The file watcher loads subsequent edits.

Agent skills

Repository guidance

The inspected repository revision contains contributor guidance in AGENTS.md. No reusable agent skill was found in that revision.

Query, write & review

The SKILL.md guides agents through queries, YAML-LD writing & data reviews. Follow Agents to install it.

Data model

Graph organization

Triples

The reference exporter writes Turtle triples without named graphs.

Source graphs

Each source file has a named graph. Embedded graphs retain source-scoped names. Default queries use the union of named graphs.

Preprocessing required

context.jsonld defines companion as an IRI-valued property. The exporter resolves [[proxima-centauri]] to the identifier declared in the separate proxima-centauri.md.

Source alpha-centauri.md

---
type: https://dbpedia.org/ontology/Star
id: https://dbpedia.org/resource/Alpha_Centauri
companion: "[[proxima-centauri]]"
---

Reference by RDF IRIs

Source rdf-iri.yamlld

"@context":
  companion:
    "@id": http://dbpedia.org/property/component
    "@type": "@id"
"@type": https://dbpedia.org/ontology/Star
"@id": https://dbpedia.org/resource/Alpha_Centauri
companion: https://dbpedia.org/resource/Proxima_Centauri

Input formats

Typed Markdown notes

The exporter reads Markdown front matter from notes that declare a type.

Markdown & standalone documents

sparqld loads Markdown front matter, standalone YAML-LD & standalone JSON-LD. See Supported formats for the full list.

Conformance

Context placement

External contexts only

Vault-LD §4.2 requires contexts outside notes. The exporter ignores inline contexts, contrary to JSON-LD & YAML-LD. The exporter reads local JSON-LD context files & skips remote references.

Inline, local or registered contexts

Declare an inline context or reference a local file or a registered context IRI.

Vocabulary expansion

Exporter discrepancy

The tested exporter mishandles @vocab, contrary to its specification.

Standard expansion

JSON-LD vocabulary expansion gives bare terms their context-defined identifiers.

This Alpha Centauri example compares Vault-LD's exporter with RDFLib.

Tested exporter revision

The saved results use vault_to_rdf.py. Both processors receive the same frontmatter & folder context. The JSON-LD comparison supplies the context explicitly.

JSON-LD uses @vocab for the bare type Star & property name, as the specification's @vocab example shows. The expected result identifies Alpha Centauri as dbo:Star & preserves its dbo:name. The tested exporter instead uses urn:centauri:Star & drops the name.

Source alpha-centauri.md

---
id: https://dbpedia.org/resource/Alpha_Centauri
type: Star
name: Alpha Centauri
---

Source context.jsonld

{
  "@context": {
    "@base": "urn:centauri:",
    "@vocab": "https://dbpedia.org/ontology/",
    "id": "@id",
    "type": "@type"
  }
}

Vault-LD output vault-ld.ttl

@prefix centauri: <urn:centauri:> .
@prefix dbr: <https://dbpedia.org/resource/> .

dbr:Alpha_Centauri a centauri:Star .

JSON-LD output (RDFLib) rdflib.ttl

@prefix dbo: <https://dbpedia.org/ontology/> .
@prefix dbr: <https://dbpedia.org/resource/> .

dbr:Alpha_Centauri a dbo:Star ;
    dbo:name "Alpha Centauri" .

Exporter warnings exporter-warnings.txt

warnings:
  - alpha-centauri.md: field 'name' not in context -> skipped

The same semantic input, represented as JSON-LD, also produces both triples in sparqld. This checks standard JSON-LD loading. Vault-LD note lookup needs a separate test.

Source alpha-centauri.jsonld

{
  "@context": {
    "@base": "urn:centauri:",
    "@vocab": "https://dbpedia.org/ontology/",
    "id": "@id",
    "type": "@type"
  },
  "id": "https://dbpedia.org/resource/Alpha_Centauri",
  "type": "Star",
  "name": "Alpha Centauri"
}

Source query.rq

SELECT DISTINCT ?predicate ?object WHERE {
  VALUES ?predicate {
    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
    <https://dbpedia.org/ontology/name>
  }
  <https://dbpedia.org/resource/Alpha_Centauri> ?predicate ?object
}
ORDER BY ?predicate
predicate object
http://www.w3.org/1999/02/22-rdf-syntax-ns#type https://dbpedia.org/ontology/Star
http://www.w3.org/1999/02/22-rdf-syntax-ns#type urn:centauri:Star
https://dbpedia.org/ontology/name Alpha Centauri