Search code examples
graphdb

import server file using relative path via REST API


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.


Solution

  • 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"]}'