Exporting Data

Data can be exported in several ways and formats.

To export flattened, framed or compacted document form, you should also provide context as a file or a link. Use the graphdb.jsonld.whitelist GraphDB configuration property inside the graphdb.properties config file to provide a whitelist with URLs that are permitted for JSON-LD processing.

The whitelist is a comma-separated list of URLs. 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 operations.

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

Exporting a repository

  1. Go to Explore ‣ Graphs overview.

  2. Click Export repository and then the format that fits your needs.


Exporting individual graphs

  1. Go to Explore ‣ Graphs overview.

  2. A list of contexts (graphs) in a repository is displayed. You can also search for particular graphs from the search field above it.

  3. Inspect a graph by clicking on it.

  4. Delete a graph by clicking the bucket icon, or click to export the graph in the format of your choice.


Exporting query results

The SPARQL query results can also be exported from the SPARQL view by clicking Download As.

Exporting resources

After finding a resource from the View resource on GraphDB’s home page, you can download its RDF triples in a format of your choice:


Exporting via HTTP with curl

Using the curl command line utility lets you script export calls in an application.

Request headers

  • Accept: Relevant values for GET requests are the MIME types of the supported RDF formats.

  • Content-Type: When exporting graph queries, used to specify the encoding of any request data sent to a server. Relevant values are the MIME types of the supported RDF formats.

  • Link: Used only when exporting to JSON-LD document form. When importing or exporting to compacted or flattened JSON-LD document form, address of context. When exporting to framed JSON-LD document form, address of frame that should be used by the Framing processor.

    If a link is not provided when exporting:

    • Exporting to compacted JSON-LD document form — exported data will use the namespaces of the repository instead.

    • Exporting to flattened JSON-LD document form — exported data will not contain context.

    • Exporting to framed JSON-LD document form — exported data will be exported to expanded JSON-LD document form instead.

Fetch statements from repository

GET /repositories/<repo_id>/statements


curl '<base_url>/repositories/<repo_id>/statements' --header 'Accept: <MIME-type>/<MIME-subtype>'

Export JSON-LD example:

curl '<base_url>/repositories/<repo_id>/statements'
\ --header 'Accept: application/ld+json;profile=http://www.w3.org/ns/json-ld#<type-of-mode>'
\ --header 'Link: <link_to_the_context_location>; rel="http://www.w3.org/ns/json-ld#context"'

Fetch queries from repository

GET /repositories/<repo_id>/

The query can be specified with --data-raw. It can also be provided with --data-urlencode query@/<path-to-query-file>


curl '<base_url>/repositories/<repo_id>'
\ --header 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8'
\ --header 'Accept: application/<MIME-type>'
\ --data-raw $'query=<sparql-query>'

Export JSON-LD example:

curl '<base_url>/repositories/<repo_id>'
\ --header 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8'
\ --header 'Accept: application/ld+json;profile=http://www.w3.org/ns/json-ld#<type-of-mode>'
\ --header 'Link: <link_to_the_context_location>; rel="http://www.w3.org/ns/json-ld#context"'
\ --data-raw $'query=<sparql-query>'

Configuring the JSON-LD writer properties

The JSON-LD writer has additional properties that configure how the writer operates:

Property name


Default value


Defines whether the writer will use JSON-LD 1.0 or JSON-LD 1.1 specifications when processing JSON-LD exports.



Provides a path to a frame that is used when exporting to framed document form.



Determines if IRIs are compacted relative to the base option or document location when compacting.



Provides a path to a context that is used to expand the active context when expanding a document.



If set to TRUE, certain algorithm processing steps are ordered lexicographically where indicated. If set to FALSE, order is not considered during processing.



Indicates whether the output should be in explicit form. When set to TRUE, the output will include redundant information to improve human readability.



When set to ALWAYS, node objects are embedded as property values, unless this would cause a circular reference. When set to NEVER, node references are used when serializing matching values. When set to ONCE, only a single value within a given node object will be embedded, and other values of other properties will use a node reference.



Controls whether default values are omitted from the output.



Controls whether the top-level graph is omitted from the output.



Specifies whether all properties are considered as required.



Allows the use of numeric values as @id in the exported JSON-LD document.



Specifies whether URI validation is enabled. When set to TRUE, URI validation is performed during JSON-LD processing.