Loading data using Workbench

The Workbench Import view hosts many of the interfaces used for loading RDF data into your repository, such as loading data:

  • from local files

  • from a remote URL (with a format extension or by specifying the data format)

  • by pasting the RDF data in the Text area tab

  • from files on the server where Workbench is located

Screenshot of the GraphDB Import interface with two tabs, one for User data and the other for Server files. Options to upload RDF files, get RDF data from a URL, and import RDF text snippet. Files with names like 'statements.jsonld,' 'publishing-ontology.ttl,' 'pub-ontology.ttl,' and 'star-wars-example.jsonld' are listed, each with an 'Import' button beside them. There is a Name filter used to filter the already uploaded files.

You can also load RDF data with an INSERT update request in the SPARQL editor.

All import methods support asynchronous running of the import tasks, with the exception of the text area import, which is intended for very fast and simple imports. Currently, only one import task of a type is executed at a time, while the others wait in the queue as pending.

Note

Since Workbench performs the parsing when importing data into a local repository, GraphDB supports interruption and additional settings. When importing data into a remote location, the data is sent to the remote endpoint, and the parsing and loading are performed there.

There are two tabs inside the view — User data, for RDF data provided by the user, and Server files, for files that are already hosted on the server. Both tabs provide a file name filter to narrow down the list of available files.

Note

When importing data from local files, a remote URL, or by pasting a text snippet, the files are first uploaded to the server. Once uploaded to the server, they can be imported into the repository.

Importing local RDF files

Go to Import ‣ User data ‣ Upload RDF files.

This lets you select, configure, and import data from various RDF formats.

Note

This method supports files of a limited size. The default is 200 megabytes, and is controlled by the graphdb.workbench.maxUploadSize property where it is set in bytes (-Dgraphdb.workbench.maxUploadSize=1073741824).

Loading data from your local machine directly streams the file to the RDF4J statements endpoint:

  1. Click the button to browse files for uploading.

  2. When the files appear in the table, either import a file by clicking Import on its line or select multiple files and click Import in the header.

  3. The Import settings dialog box appears in case you want to reset any other parameters.

Importing remote RDF files

Go to Import ‣ User data ‣ Get RDF data from a URL.

You can import from a URL with RDF data. Each endpoint that returns RDF data can be used.

If the URL has an extension, GraphDB uses that to detect the correct data type (for example, .ttl for a Turtle file and .rdf for an RDF/XML file; see RDF formats for a complete list). Otherwise, you have to provide the Data Format parameter, which is sent as Accept header to the endpoint and then to the import loader.

Importing RDF data from a text snippet

Go to Import ‣ User data ‣ Import RDF text snippet.

You can import data by typing or pasting it directly in the text area. This has the same effect as uploading a small RDF file and importing it.

Importing server files

Go to Import ‣ Server files.

The server files import allows you to load files of arbitrary sizes. Its limitation is that the files must be put in a specific directory. (Symbolic links are supported.) By default, it is $user.home/graphdb-import/ that you need to create beforehand.

If you’d rather use a different directory location, see the graphdb.workbench.importDirectory system property. GraphDB scans the directory recursively and all files with a semantic MIME type are visible in the Server files tab.

Import settings

The settings for each import are saved in case you want to re-import a file. You can see them in the dialog box that opens after you have uploaded a document and clicked Import:

_images/import-settings-dlg-box.png
  • Target graphs — when specified, the graphs where the imported data should be stored. RDF formats such as TriG and N-Quads may list specific named graphs where some or all of the triples should be stored, but formats such as Turtle and RDF/XML do not support this. Formats in the latter category are treated as if they specify the default graph as the target.

    • From data — Imports data into the graph (or graphs, for formats that can specify named graphs) specified by the data source.

    • The default graph — Imports all data into the default graph.

    • Named graph — Imports everything into a named graph that you specify on this dialog box.

  • Enable replacement of existing data — Let the imported data replace existing data in the repository.

    • Replaced graph(s) — All specified graphs will be cleared before the import is run. If a graph name ends in *, it will be treated as a prefix matching all named graphs starting with that prefix excluding the *. This option provides the most flexibility when the target graphs are determined from data.

    • I understand that data in the replaced graphs will be cleared before importing new data — this option must be checked when the data replacement is enabled.

  • JSON-LD context — Only visible when importing JSON-LD or NDJSON-LD files. Specifies external context as an URL. Only whitelisted URLs can be used.

    Tip

    The whitelist is a comma-separated list of URLs used to validate any context URLs in imported JSON-LD or specified by the user for export. The wildcard * allows for fine-grained control, enabling administrators to specify a set of URLs, including entire directories. Each entry in the list represents a source that is considered safe for JSON-LD and NDJSON-LD operations.

    # Sets whitelist for JSON-LD resources
    graphdb.jsonld.whitelist = https://example.com/my/jsonld/*, file:///usr/local/my/jsonld/*
    

Advanced settings:

  • Base IRI — the base IRI against which to resolve any relative IRIs found in the uploaded data. When data does not contain relative IRIs, this field may be left empty.

  • Preserve BNode IDs: whether to use the blank node IDs found in the imported file or to assign their own internal blank node identifiers.

  • Fail parsing if datatypes are not recognized: whether to fail parsing if datatypes are unknown.

  • Verify recognized datatypes: verify that the values of the datatype properties in the file are valid.

  • Normalize recognized datatypes values: whether recognized datatypes need to have their values be normalized.

  • Fail parsing if languages are not recognized: whether to fail parsing if languages are unknown.

  • Verify language based on a given set of definitions for valid languages: whether languages tags are to be verified.

  • Normalize recognized language tags: whether languages need to be normalized, and to which format they should be normalized.

  • Should stop on error: whether to ignore non-fatal errors.

  • Force serial pipeline: use the serial pipeline when importing data.

The Workbench Import view lists a table of previously imported files with the sortable columns Name, Size, Modified, Imported, and Context. Clicking the checkbox to the left of a table displays an Import button where you can re-import any checked files and a Remove button that lets you remove any checked files from the table. To the right of the Import button, a dropdown menu icon-fa-chevron-down lets you re-import any selected items without changing their import settings.

Import data with an INSERT query using the SPARQL endpoint

You can also insert triples into a graph with an INSERT update request in the SPARQL editor.