Accessor: services/SemanticRepositoryUpdate

services/SemanticRepositoryUpdate

Perform a SPARQL update on a semantic repository such as GraphDB.

SPARQL is a W3C standard for querying semantic repositories, playing an analogous role to SQL with respect to relational databases. Semantic repositories fall within the domain of knowledge representation in AI and typically are implemented as a triplestore: entries in the repository have the form "subject", "predicate", "object" eg. "An Apple" "IsA" "Fruit"

An example SPARQL update to add a triple to the repository:

INSERT DATA { http://ptolemy.berkeley.edu/a http://ptolemy.berkeley.edu/b http://ptolemy.berkeley.edu/c . }

Documentation for SPARQL and the SPARQL Protocol 1.1 introducing updates can be found at https://www.w3.org/TR/sparql11-query/

Information on GraphDB can be found at http://graphdb.ontotext.com/

SPARQL is also a protocol for communicating with RDF databases Upon receiving an update input, this accessor performs an http POST to the specified server and port with the body set to the update input. The http status code is produced on the output with a 204 response from the server indicating success. If a different status code is received, this accessor throws an error. Note that an INSERT that inserts data already in the repository or a DELETE that removes data already absent from the repository is treated by the respository as a successful update.

This accessor does not block waiting for the response, but if any additional update input is received before a pending request has received a response or timed out, then the new request will be queued and sent out only after the pending request has completed. This strategy ensures that outputs are produced in the same order as the input requests.

Version:
  • $$Id: SemanticRepository.js 1725 2017-05-19 22:59:11Z cxh $$
Author:
  • Matt Weber
Source:
Inputs:
Name Type Description
update string The update to be sent to the semantic repository. Types of SPARQL updates are: INSERT and DELETE, but raw ontology data is accepted too with appropriate format.
Outputs:
Name Type Description
status string The status code of the http POST to the Semantic Repository. A 204 code indicates success.
Parameters:
Name Type Description
format string The format of data sent to the ontology. Currently only supports data types from http://docs.rdf4j.org/rest-api/#_content_types.
host string The URL for the semantic repository.
port string The port for the semantic repository.
repositoryName string The name of the particular repository on the host.
authenticate boolean If true, enable authentication to an access controlled semantic repository by sending username and password with request. If false, username and password information will not be sent. An error will occur if the http protocol is selected with a true authenticate setting to avoid sending username/password information in plain text.
username string A username for an access controlled semantic repository.
password string A password for an access controlled semantic repository.
timeout int The amount of time (in milliseconds) to wait for a response before triggering a null response and an error. This defaults to 20000.

Methods

(static) setup()

Set up the accessor by defining the inputs and outputs.

Source: