Offline Loading
Tentris provides the load subcommand for the offline loading of RDF graphs and datasets.
load works by reading the data from streams (e.g., standard input and local files).
Offline loading is recommended for large datasets, as it is faster than inserting large amounts of data while the server is running.
For online loading, please refer to the chapter SPARQL endpoints.
Note:
loadcan also be used to initialize new databases.
Examples
Load a single file
tentris load < ./example-rdf-graph.nt
tentris load ./example-rdf-graph.nt
Load multiple files
tentris load ./example-graph-part1.nt ./example-graph-part2.nt
tentris load ./example-dir-1/*
Load files from directories
tentris load --recursive ./example-dir
tentris load --recursive ./example-dir-1 ./example-dir-2
Note: With the
--recursiveflag enabled, Tentris will try to read all files (i.e., also non-RDF files) that are found in the provided directories.
Load multiple files using cat
cat ./example-graph-part1.nt ./example-graph-part2.nt | tentris load
Note: When loading multiple files with
cat, Tentris considers the contents of the provided files to be part of the same file/graph when assigning blank node identifiers.
Load triples into a particular graph
tentris load --into-graph "https://example.com#my-graph" < ./example-rdf-graph.nt
Data Formats
Tentris automatically detects the format of the input, which can also be manually specified. The available formats are N-Triples, Turtle, N-Quads, TriG, and RDF/XML.
Interrupting a Load
To gracefully stop a running load, press CTRL+C twice within 5 seconds of each other.
Tentris then finishes its pending work before shutting down, which may take a few seconds.
Afterwards, the database contains all statements that were loaded up to that point.
When the load is resumed the entire file must be parsed again, statements already in the database are discarded.
⚠️ Warning: When Tentris is already trying to stop, pressing CTRL+C two additional times within 5 seconds of each other forces an immediate stop and leaves the database in a corrupted state.
Options
-
--format <FORMAT>
Manually specifies the format of the RDF file.
Note: if multiple files are being loaded the format is applied to all files.tentris load --format turtle < ./example-rdf-graph.ttl -
--into-graph <GRAPH_IRI>
Loads the triples into a specific named graph.tentris load --into-graph "http://example.com#graph" < ./example-rdf-graph.nt -
--force-no-snapshot
Prevents Tentris from creating a snapshot after the data has been loaded. This is useful for improving the performance ofload, when loading multiple files sequentially, especially on filesystems that do not support reflinks (e.g., ext4).# Load the first file without creating a snapshot tentris load --force-no-snapshot < ./example-graph-part1.nt # Load the final file and allow a snapshot to be created for safety tentris load < ./example-graph-part2.nt⚠️ Warning: If no snapshot is created after the final
load, the database may be unrecoverable in case of a server crash.