Getting Your Data into Waratah

Waratah answers SPARQL queries over data that has been loaded into it first. This guide shows every way to load data and helps you pick the right one. Nothing here assumes you have used a graph database before: loading data simply means reading RDF from a file — or from a snippet pasted into the browser — and storing it so that queries can find it.

The ways to load data

How Server must be running? Good for

Web console: upload a file

Yes

Point-and-click loads from your browser.

Web console: paste a snippet

Yes

A handful of statements you want to try right away.

waratah import --connect

Yes

Loading a file from disk while the server keeps serving.

waratah import --data-dir

No

The first load into a fresh data directory.

waratah import --offline

No

The fastest bulk load, for large files into an empty data directory.

What you need: an RDF file

Everything Waratah loads is RDF: statements of the form subject, predicate, object. If that is new to you, RDF Basics explains it from scratch. RDF comes in several plain-text formats, and Waratah reads all of the common ones — plain or .gz-compressed:

Format File extension What the file holds

Turtle

.ttl

Triples. The everyday choice, and what this guide’s examples use.

N-Triples

.nt

Triples, one simple line per statement.

TriG

.trig

Triples grouped into named graphs.

N-Quads

.nq

Triples with an optional graph name on each line.

RDF/XML

.rdf, .xml, .owl

Triples in XML form, common in older datasets.

A small Turtle file looks like this:

@prefix ex: <http://ex/> .

ex:alice ex:livesIn ex:brisbane .
ex:brisbane ex:hasWeather "Sunny" .

Turtle, the everyday syntax in RDF Basics walks through this line by line.

Load data in the web console

Browse to http://127.0.0.1:8080/ — the console that waratah start serves (see Getting Started) — and choose Ingest in the sidebar.

Stage first, ingest second

Loading through the console is always two steps:

  1. Stage the file. Upload it or paste it. This copies the RDF into a staging folder on the server. Nothing is queryable yet, and you can stage as many files as you like.

  2. Ingest the file. Press Ingest on its row in the list. Waratah reads the staged file and adds its statements to the store. The data is queryable the moment this finishes.

The staging folder is {data_dir}/ingest/main when the server runs with --data-dir, otherwise ./ingest/main — the store behind the console is always the repository named main. You do not have to use the browser for staging: files copied into that folder from the terminal show up in the list exactly like uploads.

Upload a file

Press Upload file and pick an RDF file.

  • Formats are recognized by extension: .ttl, .nt, .nq, .trig, .rdf, .xml, .owl, each optionally .gz-compressed.

  • One upload holds at most 1 GiB. For larger files, load from the terminal instead (see the import sections below).

  • Uploading a file with the same name as an existing staged file replaces it.

  • A progress bar tracks the upload; when it finishes the file appears in the staged list.

Paste a snippet

Press Paste snippet to open a dialog with three fields:

  • Path — the name the snippet is saved under. The default is snippet, which becomes snippet.ttl; if you type a path without a known extension, the right one is added for the chosen format.

  • Format — Turtle, N-Triples, N-Quads, TriG, or RDF/XML. Turtle is the usual choice for pasted examples.

  • RDF — the statements themselves.

Press Upload and the snippet is saved as a staged file, ready to ingest from the list like any other.

Ingest a staged file

Press Ingest on a row. A dialog offers two optional fields:

  • Target graph IRI — where default-graph triples in the file should land. Leave it empty and they stay in the default graph, which is what most files and most queries expect. If you are loading TriG or N-Quads, triples that already name a graph keep that graph; only the unnamed ones move. RDF Basics' graphs section explains named graphs.

  • Base IRI — only relevant if the file contains relative IRIs, which are completed against this base. Leave it empty otherwise.

Press Ingest again and wait. The request runs to completion before answering, so a large file can take a while, and it cannot be cancelled. When it finishes, a confirmation shows how many quads were loaded and how many terms were newly registered — for a first load you can read that simply as "it worked, and this is how much went in".

The staged file is kept afterwards, so you can ingest the same file again — for example into a different target graph.

After ingest

Run a query in the SPARQL workbench and the new data is already there. One caution from Getting Started applies here too: a cluster started without --data-dir keeps everything in memory, and ingested data disappears when the cluster stops. Start it with --data-dir to keep what you load.

Load a file into a running server from the terminal

waratah import data.ttl --connect

This reads the file and streams it into the cluster that is already running; the server keeps serving while it loads. Existing data is kept, and the data is queryable as soon as the command returns.

If your cluster listens on non-default addresses, pass the same --config address table you started it with:

waratah import data.ttl --connect --config ./cluster.toml

Every imported quad is stamped with the current time; --timestamp MILLIS overrides that if you need to backdate a load.

Bulk-load a data directory before the first start

For a large first load, fill the data directory before the server starts, then serve what you loaded:

waratah import data.ttl.gz --data-dir ./waratah-data
waratah start --data-dir ./waratah-data

The import command starts its own storage for the load, writes the file, and stops that storage again. Nothing needs to be running first, and the directory is created if it does not exist.

The fast path: --offline

waratah import big.ttl.gz --offline --data-dir ./waratah-data

--offline loads the file in a single process — no helper processes, no network — and is the fastest way to fill an empty data directory. Intended for a fresh directory, it keeps any data that is already there. Two more flags matter on big loads:

  • --disable-wal — skips the write-ahead log during the load. Faster, but a crash mid-load leaves the directory incomplete, so use it only when you can simply start the import over.

  • --compact — runs a full maintenance pass after the load. Offline loads always do this; the flag offers the same treatment to the default import mode.

After an offline load, waratah start --data-dir ./waratah-data serves the data; the import directory stays as it is.

What Waratah refuses to load

Waratah checks data while loading and refuses one specific shape: a triple whose predicate is exactly rdf:type and whose object is a literal.

ex:alice rdf:type "Person" .   # refused: the object must be an IRI

RDF’s grammar technically allows a literal there, but a class is meant to be identified by an IRI — writing the class as a quoted string is almost always a mistake made upstream, most often by a CSV-to-RDF conversion that mapped a column of labels into the type position. Rather than store data that no class query can meaningfully match, Waratah rejects the statement and tells you which one it was.

Each load request is checked as a unit, so a refused request loads nothing from it — fix or remove the offending statement and load again. Very large terminal imports are loaded in batches; an offending statement stops the import at the batch that contains it. Everything else about literals is unaffected: a literal object under any other predicate, including properties you define yourself, loads normally.

Geometry validation uses the same batch behavior. A batch containing genuinely invalid geometry is not written, but earlier batches remain loaded. Exactly retraced zero-area polygon spikes are accepted with a warning and counted in the waratah import summary; their stored coordinates are preserved while spatial evaluation uses the reduced valid region. Fix rejected source geometry, re-ingest the corrected file, then rebuild the geo index from scratch on a stopped store with waratah geo rebuild-index --data-dir <data-dir>. See Geospatial Data for the validity rules.

Which one should I use?

  • A few statements to try out? Paste snippet in the console.

  • Have a file and prefer clicking? Upload file, then Ingest.

  • The server is running and the file is on disk? waratah import data.ttl --connect.

  • Filling a brand-new data directory? waratah import --data-dir, or --offline when the file is large. Start the server afterwards.

Good to know

  • Loading never removes statements. Every method adds to what the store already holds.

  • One statement shape is refused outright: an rdf:type triple whose object is a literal — see What Waratah refuses to load.

  • The web console upload holds at most 1 GiB per file. Terminal imports have no such limit because the file is read from the server’s own disk.

  • Staged files stay in the staging folder after ingest. Delete them from {data_dir}/ingest/main (or ./ingest/main) when you no longer want them, or keep them to re-ingest later.

  • For the underlying HTTP contract behind the console’s Ingest page — useful if you want to script uploads with curl — see the ingest API reference.