Guides
Load data into named graphs
Upload local RDF files to a workspace where you have write access. Select the workspace first, and choose the destination branch for each import.
Choose a format
| Format | Extension | Graph names |
|---|---|---|
| Turtle | .ttl | Choose a target graph |
| N-Triples | .nt | Choose a target graph |
| RDF/XML | .rdf | Choose a target graph |
| N-Quads | .nq | Included in the data |
| TriG | .trig | Included in the data |
Upload one file
Set a recognizable graph IRI for a triple-format file:
legra graph upload contacts.ttl --workspace research --graph https://example.org/contacts --target-branch main
Without --graph, graph names are derived from file paths. Do not assume that
an upload becomes part of the default graph. For N-Quads and TriG, preserve the
graph names in the input instead of supplying a single target graph.
Upload a directory
Preview the input before uploading a collection of files:
legra graph upload ./datasets/ --dry-run
Then set the graph-name prefix and destination:
legra graph upload ./datasets/ --graph-base https://example.org/datasets/ --workspace research --target-branch review
Directory uploads include supported files in subdirectories. Use
Branching to create review before targeting it.
Uploads replace the corresponding graph data, so review a repeat import
before promoting its changes to shared data.
Verify the result
List graphs containing data:
legra graph query 'SELECT DISTINCT ?graph WHERE { GRAPH ?graph { ?s ?p ?o } }' --workspace research --branch review
For a particular graph, count its statements:
SELECT (COUNT(*) AS ?count) WHERE {
GRAPH <https://example.org/contacts> { ?s ?p ?o }
}
Run verification against the same workspace and destination branch used for the upload. See Upload options for command details or HTTP API for graph imports over HTTP.