Class: UploadService

UploadService()

Service for uploading data streams.

Constructor

new UploadService()

Author:
  • Mihail Radkov
  • Svilen Velikov
Source:

Methods

addFile(filePath, contentType, contextopt, baseURIopt) → {ServiceRequest}

Uploads the file specified by the provided file path to the server.

See #upload

Parameters:
Name Type Attributes Description
filePath string

path to a file to be streamed to the server

contentType string

MIME type of the file's content

context string | Array.<string> <optional>

restricts the operation to the given context. Will be encoded as N-Triple if it is not already one

baseURI string <optional>

used to resolve relative URIs in the data

Source:
Returns:

a service request that will be resolved when the file has been successfully consumed by the server

Type
ServiceRequest

getServiceName()

Source:

overwrite(readStream, contentType, context, baseURIopt) → {ServiceRequest}

Executes a PUT request against the /statements endpoint. The statements which have to be updated are provided through a readable stream. This method is useful for overriding large set of statements that might be provided as a readable stream e.g. reading from file.

Parameters:
Name Type Attributes Description
readStream ReadableStream
contentType string
context NamedNode | string

restrict the operation. Will be encoded as N-Triple if it is not already one

baseURI string <optional>

optional uri against which any relative URIs found in the data would be resolved.

Source:
Returns:

a service request that will be resolved when the stream has been successfully consumed by the server

Type
ServiceRequest

putFile(filePath, contentType, contextopt, baseURIopt) → {ServiceRequest}

Uploads the file specified by the provided file path to the server overwriting any data in the server's repository.

The overwrite will be restricted if the context parameter is specified.

See #overwrite

Parameters:
Name Type Attributes Description
filePath string

path to a file to be streamed to the server

contentType string

MIME type of the file's content

context string <optional>

restricts the operation to the given context. Will be encoded as N-Triple if it is not already one

baseURI string <optional>

used to resolve relative URIs in the data

Source:
Returns:

a service request that will be resolved when the file has been successfully consumed by the server

Type
ServiceRequest

upload(readStream, contentType, contextopt, baseURIopt) → {ServiceRequest}

Executes a POST request against the /statements endpoint. The statements which have to be added are provided through a readable stream. This method is useful for library client who wants to upload a big data set into the repository.

Parameters:
Name Type Attributes Description
readStream ReadableStream
contentType string

is one of RDF mime type formats, application/x-rdftransaction' for a transaction document or application/x-www-form-urlencoded

context NamedNode | string <optional>

optional context to restrict the operation. Will be encoded as N-Triple if it is not already one

baseURI string <optional>

optional uri against which any relative URIs found in the data would be resolved.

Source:
Returns:

a service request that will be resolved when the stream has been successfully consumed by the server

Type
ServiceRequest