0

I'm trying to kick-off an import of RDF files into a GraphDB repository via the workbench REST API. It works fine when the file is in the {graphdb.workbench.importDirectory} directory and the request specifies "filenames": [ "file1.owl" ].

However, if the file is in a subdirectory (eg. {graphdb.workbench.importDirectory}/top/) and the request uses "filenames": [ "top/file1.owl" ], no such luck - nor does "/top/file1.owl" work. The Workbench Import UI shows the entire collection of eligible files under the {graphdb.workbench.importDirectory} directory. The file in question imports when the Workbench UI is used to initiate the import.

My question is: does the REST API support importing server files that are located is such child directories? And if so, what simple syntax am I missing out? any chance I have to specify any other property (eg. "baseURI":"file:/home/steve/graphdb-import/top/file1.owl")

Many thanks for any feedback.

1 Answer 1

2

If you have started GDB with -Dgraphdb.workbench.importDirectory=<path_to_the_import_directory> in "Server files" tab you should be able to see listed all files in this directory and in the child directories, which are located in the <path_to_the_import_directory> in following manner:

I've started GDB with -Dgraphdb.workbench.importDirectory=/home/sava/Videos/data_for_import and in this directory I have subDirectory "movieDB" with two files "movieDB.brf" and "movieDB.brf.gz" and both are shown in the tab like "movieDB/movieDB.brf" and "movieDB/movieDB.brf.gz".

If you want to import these files using cURL use server import URL with method POST or:

curl -H POST 'http://localhost:7200/rest/data/import/server/w1' -H 'Accept: application/json, text/plain, /' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"importSettings":{"name":"movieDB/movieDB.brf","status":"NONE","message":"","context":"","replaceGraphs":[],"baseURI":null,"forceSerial":false,"type":"file","format":null,"data":null,"timestamp":1608016179633,"parserSettings":{"preserveBNodeIds":false,"failOnUnknownDataTypes":false,"verifyDataTypeValues":false,"normalizeDataTypeValues":false,"failOnUnknownLanguageTags":false,"verifyLanguageTags":true,"normalizeLanguageTags":false,"stopOnError":true},"requestIdHeadersToForward":null},"fileNames":["movieDB/movieDB.brf"]}'

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Sava, Thanks for the quick reply. Yes - I do see the various files, including those in subdirectories. And the REST API GET /rest/data/import/server/{repositoryId} endpoint response shows these files - each shows a "name" value with a relative path - relative to the configured directory (eg. "subdir1/file1.owl"). However, using that same path in the POST endpoint (to initiate the import) does not result in an import occuring. But the workbench UI import (showing the same relative path) import function does work.
Hi Steven. Edited the answer above with example how to import files bigger than 200 MB using cURL.
Hi Sava, Many thanks for the example curl request. It works!! (I had to remove the / Accept value from the header replacement option - graphdb log msg below). I can now import server files from subdirectories. I had used the short POST body as shown in the documentation - I used just the fileNames property as documented... graphdb log msg on 1st try (with / still in the Accept header field value string: HttpMediaTypeNotAcceptableException: Could not parse 'Accept' header [application/json, text/plain, /]: Invalid mime type " /": does not contain subtype after '/'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.