The SPARQL LOAD statement is used to load data to AnzoGraph from files that are in Turtle, N-Triple, N-Quad, or TriG format.

For information about load file directory requirements and load architecture, see Load File Requirements. For more information on the data types thatAnzoGraph uses to store loaded or inserted data, see AnzoGraph Data Type Handling. Also see Loading Data from Files for specific examples and guidance for using the LOAD command on different deployment platforms.

LOAD Syntax

Run the following statement to load data from Turtle, N-Triple, N-Quad, or TriG files.

LOAD [ SILENT ] [ WITH 'leader' | 'compute' | 'global' ] <URI> [...<URIn>] [ INTO GRAPH <graph_name> ]
Option Description
SILENT Include this optional keyword if you do not want AnzoGraph to return errors during the load.
  • When SILENT is omitted, AnzoGraph aborts the load upon hitting an error and reports the error to the client.
  • When SILENT is specified and AnzoGraph encounters an error, it logs the error to a graph and proceeds with the load. By default, any errors are captured in the <load_errors> graph. After a load completes, you can query the graph to review errors. To customize the load error graph URI, you can change the load_errors_graph setting value in the system configuration file, <install_path>/config/settings.conf. See Changing System Settings for instructions.
WITH 'leader' Include this optional clause when loading files that only the leader server can access. WITH 'leader' is the default value for the LOAD statement. When the WITH clause is omitted, the load proceeds as if WITH 'leader' was specified.
The "leader" keyword is case-sensitive. Type the term using lower case letters.
WITH 'compute' Include this optional clause when all servers will load files from their local file systems. Use this option if you have arranged the load files so that each AnzoGraph server has a unique subset of files on its local file system.
The "compute" keyword is case-sensitive. Type the term using lower case letters.
WITH 'global' Include this optional clause when all servers will load a subset of files from directories on a mounted file system. Include this option when every AnzoGraph server in the cluster has visibility to the entire data set. AnzoGraph automatically divides file selection among the servers.
The "global" keyword is case-sensitive. Type the term using lower case letters.
<URI> Required clause that specifies the URIs to load. Each URI lists the path to the file or directory of files that you want to load. To load a single file, the scheme of the URI should be file:. To load a directory of files, the scheme of the URI should be dir:. When you specify a directory, AnzoGraph loads all valid files in that directory as well as any subdirectories. AnzoGraph does not load any hidden files that are named with a leading period, such as .file.ttl.

For example, the following URI loads a single file from a shared directory:


This example URI loads a directory of .ttl.gz files on a mounted file system:


If you specify more than one URI to load from, each URI must be of the same file type, that is, each URI must specify graph data in the same format such as .ttl, .TriG, etc. Also each URI must specify the same scheme, file: or dir:.

Make sure that the file system is accessible from AnzoGraph. In a Docker environment, the file or directory must be shared between the host and the container or be stored in the AnzoGraph container file system. For instructions on copying files or directories from a local file system to the AnzoGraph file system in a Docker container, see Loading Files from the AnzoGraph File System in Docker. For more information on loading data into AnzoGraph from HDFS data sources, see Loading Files from HDFS.

INTO GRAPH <graph_name> When loading files such as Turtle or N-Triple files without graph specifications, include this optional clause to specify the graph to load data into. If the graph does not exist, the system automatically creates it and then loads the data into it. If you do not specify a graph, AnzoGraph loads data into the default graph.

You can also include the INTO GRAPH option when loading N-Quad files. If the N-Quad files contain a mixture of quads and triples, AnzoGraph loads the triples into the specified graph. Quads are still loaded according to their graph specification. If you omit this option for N-Quad files, any triples without graph specifications are loaded into the default graph.

Related Topics