Import RDF data

Step by step guide to importing RDF data

There are multiple ways to import RDF data into LinkedDataHub.

Single resource

Create or update a single RDF document using the command line interface.

Append dataset

This method simply appends RDF data to the application's dataset.

If you want to append RDF data in a way where it attaches to the existing document hierarchy, you need to make sure that it:

  • consists of triples (quad import into a container is undefined)
  • describes one or more documents, possibly with some non-information resources attached to them
  • the documents are either containers with a dh:Container (or its subclass) type, or items with a dh:Item (or its subclass) type
  • have sioc:has_parent or sioc:has_container properties, respectively
  • the document resources may be blank nodes, in which case there will be an attempt to skolemize them based on the their type class properties

Documents conforming to the above criteria will become children the container they are submitted to (the target container). Each of the documents and its related resources will be put into separate named graphs.

To execute the actual import, make an HTTP POST request, for example using cURL:

cat data.ttl | curl -E ${cert_pem_file}:${cert_password} -d @- -H "Content-Type: text/turtle" -H "Accept: text/turtle" "${target}" -i

This submits the data.ttl file, which could look like this:

@prefix dh:        <https://www.w3.org/ns/ldt/document-hierarchy/domain#> .
@prefix dct:       <http://purl.org/dc/terms/> .

_:item a dh:Item ;
  dh:slug "test-item" ;
  dct:title "Test item" .
        
_:container a dh:Container ;
  dh:slug "test-container" ;
  dct:title "Test container" .

The command line parameters are as follows:

${cert_pem_file}
Location of your WebID certificate in a PEM format.
PKCS12 (.p12) files can be converted to PEM (.pem) using openssl pkcs12 -in cert.p12 -out cert.pem.
${cert_password}
The password of your WebID certificate (provided during signup)
${target}
URI of the target container, for example https://linkeddatahub.com/demo/skos/

Service import

Use Graph Store Protocol to import data directly into your end-user service repository, or use a management UI to upload it, if your vendor provides one.