Load your data

All examples given below are based on the News sample dataset provided in the distribution folder.

Tip

You can also use public datasets such as the w3.org Wine ontology by pasting its data URL — https://www.w3.org/TR/owl-guide/wine.rdf — in Import ‣ User data ‣ Get RDF data from a URL.

Load data through the GraphDB Workbench

Let’s load your data from a local file:

  1. Go to Import.

  2. Open the User data tab and click the Upload RDF files to upload the files from the News sample dataset provided in the examples/data/news directory of the GraphDB distribution.

    _images/import_local_file.png
  3. Click Import.

  4. Enter the Import settings in the pop-up window.

    _images/import_settings.png

    Import Settings

    • Base IRI: the default prefix for all local names in the file;

    • Target graphs: imports the data into one or more graphs.

    For more details, see Loading data using the Workbench.

  5. Click Import.

Note

You can also import data from files on the server where the Workbench is located, from a remote URL (with a format extension or by specifying the data format), by typing or pasting the RDF data in a text area, or by executing a SPARQL INSERT.

Import execution

  • Imports are executed in the background while you continue working on other things.

  • Interrupt is supported only when the location is local.

  • Parser config options are not available for remote locations.

Load data through SPARQL or RDF4J API

The GraphDB database also supports a powerful API with a standard SPARQL or RDF4J endpoint, to which data can be posted with cURL, a local Java client API, or an RDF4J console. It is compliant with all standards, and allows every database operation to be executed via an HTTP client request.

  1. Locate the correct GraphDB URL endpoint:

    • Go to Setup ‣ Repositories.

    • Click the link icon next to the repository name.

      _images/locate_repo_URL.png
    • Copy the repository URL.

  2. Go to the folder where your local data files are.

  3. Execute the script:

    curl -X POST -H "Content-Type:application/x-turtle" -T <local_file_name.ttl> \
      http://localhost:7200/repositories/repository-id/statements
    

    where local_file_name.ttl is the data file you want to import, and http://localhost:7200/repositories/repository-id/statements is the GraphDB URL endpoint of your repository.

    Tip

    Alternatively, use the full path to your local file.

Load data through the ImportRDF tool

ImportRDF is a low-level bulk load tool that writes directly in the database index structures. It is ultra-fast and supports parallel inference. For more information, see Loading data using the ImportRDF tool.

Note

Loading data through the GraphDB ImportRDF tool can be performed only if the repository is empty, e.g., the initial loading after the database has been inactive. If you use it on a non-empty repository, it will overwrite all of the data in it.