Skip to content

Quickstart

This runs the core pipeline against the hosted data plane: load RDF, wait for the snapshot to publish, query it with SPARQL. You can do it with the TypeScript or Python SDK, or with plain curl.

You need a stack, its API key, and its endpoint. Create a stack in the hosted console and copy its key, which looks like lbb_sk_live_… or lbb_sk_test_…. Each stack answers at its own hostname:

https://<tenant-short-id>--<stack-slug>.db.eu.littlebigbrain.com

The tenant-short-id part is your account’s short ID; the stack slug is scoped within that account. Copy the complete endpoint from the console’s Connect view. The examples below use 0abc1def--your-stack; replace it with your endpoint_url. See Endpoints & base URLs for the addressing model and Authentication & endpoints for the key model.

The sample payload is three N-Triples statements:

<https://example.org/auth-service> <https://example.org/writesTo> <https://example.org/user-db> .
<https://example.org/auth-service> <http://www.w3.org/2000/01/rdf-schema#label> "Auth Service" .
<https://example.org/user-db> <http://www.w3.org/2000/01/rdf-schema#label> "User Database" .
Terminal window
npm install @littlebigbrain/client
import { LbbClient } from "@littlebigbrain/client";
const lbb = new LbbClient({
baseUrl: "https://0abc1def--your-stack.db.eu.littlebigbrain.com", // copy endpoint_url
apiKey: process.env.LBB_API_KEY, // lbb_sk_live_… / lbb_sk_test_…
graph: "main",
});
const ntriples = `
<https://example.org/auth-service> <https://example.org/writesTo> <https://example.org/user-db> .
<https://example.org/auth-service> <http://www.w3.org/2000/01/rdf-schema#label> "Auth Service" .
<https://example.org/user-db> <http://www.w3.org/2000/01/rdf-schema#label> "User Database" .
`;
// 1. Load RDF. The graph is created on first write if it does not exist.
const imported = await lbb.graph("main").facts.importRdf(ntriples, {
format: "ntriples",
idempotencyKey: "quickstart-1",
});
// 2. Query it. `minIndexedSeq` waits for the published snapshot to cover
// the sequence the load committed, so you read back your own write.
const { rows } = await lbb.sparqlRows(
{
query: `SELECT ?s ?label WHERE {
?s <http://www.w3.org/2000/01/rdf-schema#label> ?label
} LIMIT 10`,
},
{ minIndexedSeq: imported.committed_commit_seq },
);
for (const row of rows) console.log(row.s, row.label);

The hosted console runs the same steps without code: load data, watch the published watermark, and run a query.

  • Load appended the RDF statements to the write-ahead log as append-only events. The original predicate IRIs, named-graph labels, and literal term details are kept, so SPARQL projects the source RDF terms back unchanged.
  • Publish built one immutable generation off the request path and exposed it atomically. Nothing reads a half-built index.
  • Query ran against that single immutable snapshot. The response reports served_at_seq, the exact committed prefix it answered from.

Reads default to eventual consistency, which serves the last published snapshot. min_indexed_seq is the floor that turns that into read-your-writes: pass the sequence your load returned, and an uncovered floor comes back as a retryable 429 with a Retry-After so a pipeline can poll.

Two more reads: a validation report, and a query pinned to a past commit.

Terminal window
# SHACL conformance for the published snapshot, derived from the graph's ontology.
curl -sS "$LBB_URL/v1/ontology/conformance?graph=main" \
-H "Authorization: Bearer $LBB_KEY"
# The same query against a past commit. Every result stays reproducible.
curl -sS "$LBB_URL/sparql?graph=main&as_of_commit_seq=1" \
-H "Authorization: Bearer $LBB_KEY" \
-H "Accept: application/sparql-results+json" \
--data-urlencode 'query=SELECT (COUNT(*) AS ?n) WHERE { ?s ?p ?o }'

A pin past the current head is rejected as invalid input, so a cited snapshot always resolves to the same state.

Read Core concepts for snapshots, consistency, and the append-only model, then work through SPARQL, structured query & SHACL.