THE KNOWLEDGE REPOSITORY SERVICES API REFERENCE (version 2.0)

VERSIONING SERVICE
METHOD NAME DESCRIPTION/PRECONDITIONS/EFFECTS METHOD SIGNATURE EXCEPTIONS  THROWN
IMPORT VERSION Description:

The purpose of this operation is to store a new version of a given namespace or named graph in the repository. The contents of the namespace or named graph are provided through the RDFDocument parameter, and it can be either a namespace or a named graph.

The URI of the new version is returned by the service. This URI is created automatically as described below.

Assume the base URI of the imported version has the following form:

uriPrefix[~_~oldVersionId]#

Where “[ … ]” denotes an optional part. The new URI of the version is constructed to be:

uriPrefix~_~newversionId#

The “newversionId” is an automatically generated index number which guarantees that no two versions will have the same version ID. That is, the automatically generated version identifier is appended to the URI prefix of the imported version.


Preconditions:
  • The contents of the version (RDFDocument) should be specified in TRIG or RDF_XML format.
Effects:
A new version of the given namespace or named graph is created in the repository. The parents of the new version (as specified in the parentVersions parameter) are adequately recorded in the registry.
public java.lang.String importVersion(
gr.forth.ics.rdfsuite.services.RdfDocument document,
java.util.Collection < java.lang.String > parentVersions,
gr.forth.ics.rdfsuite.services.DbSettings dbSettings)

The following exceptions are thrown by the method:

CREATE AND IMPORT VERSIONS Description:

The purpose of this operation is to allow the caller to specify new versions, not by providing their entire contents, but by providing the difference with existing versions, i.e., by specifying the triples that should be added and deleted from the existing version(s), via the delta parameter.

This method is only applied upon namespaces, not named graphs, since the semantics of this operation in the case of named graphs is yet unclear. The namespace(s) to be affected are given in the existingVersions parameter, and the triples to be added (and deleted) are given in the delta parameter. Unlike importVersion, this method accepts more than one namespaces in the input.

Each change (addition or deletion) specified in the delta parameter is applied upon one namespace only. In order for the method to determine to (from) which namespace(s) each triple should be added (deleted), the following convention is used:

  • All non-schema triples are ignored (as the method deals with namespaces only).

  • Each added schema triple is added to the namespace to which the subject of the triple belongs.

  • Each deleted schema triple is deleted from the namespace it belongs.

  • If any addition should affect (per the above convention) a namespace that is not in the given list of namespaces (existingVersions), then an exception is thrown (see below).

  • If any deletion should affect (per the above convention) a namespace that is not in the given list of namespaces (existingVersions), then this particular change is ignored.

The parameter UpdateSemantics can be either PLAIN or INFERRED and controls the way the delta is interpreted. If it is PLAIN, the delta is applied directly, as-is. If it is INFERRED, then the delta is enriched with certain triples, in order to account for (explicitly reinstate) implicit triples that would be lost if plain application was used. The output of the Change Impact service should be applied using INFERRED semantics in order to give the correct results.

Preconditions:
  • The versions in existingVersions should be already in the repository and should be namespaces.

  • The delta parameter should be in TRIG format.

  • The updateSemantics parameter can be either PLAIN or INFERRED, as explained above.

Effects:
A number of new namespace versions are created in the repository as the result of the application of the delta upon the existing namespace(s), and are adequately recorded through calls in the registry. Notice that we don’t save new versions of namespaces which are unaffected by the above changes.
public java.lang.String[][] createAndImportVersions(
java.util.Collection <java.lang.String&qt; existingVersions,
gr.forth.ics.rdfsuite.services.Delta delta,
gr.forth.ics.rdfsuite.services.VersionManager.UpdateSemantics updateSemantics,
gr.forth.ics.rdfsuite.services.DbSettings dbSettings)

The following exceptions are thrown by these methods:

IMPORT VERSION WITH SPECIFIC URI Description:
The purpose of this operation is to store a new version in the repository with a specific URI. The functionality is similar to the one described in (importVersion), with the only difference that the URI of the new version is now explicitly specified by the caller, rather than being automatically generated by the system. The caller can choose and provide any target URI to be used, but there must be no other namespace with the same URI.
Preconditions:
  • The contents of the version (document) should be specified in TRIG or RDF_XML format.
Effects:
A new version of the given namespace or named graph is created in the repository, using the specified URI. The parents of the new version (as specified in the parentVersions parameter) are adequately recorded in the registry.
public java.lang.String importVersionWithSpecificURI(
gr.forth.ics.rdfsuite.services.RdfDocument document,
java.util.Collection <java.lang.String> parentVersions,
java.lang.String versionUri,
gr.forth.ics.rdfsuite.services.DbSettings dbSettings)
IMPORT VERSION WITH SPECIFIC ID Description:
The purpose of this operation is to store a new version in the repository with a specific version ID. The document itself is provided as a whole (RDFDocument parameter), and it can be either a namespace or a graphspace.
Preconditions:
  • The contents of the version (document) should be specified in TRIG or RDF_XML format.
Effects:
A new version of the given namespace or named graph is created in the repository, using the specified version ID. The parents of the new version (as specified in the parentVersions parameter) are adequately recorded in the registry.
public java.lang.String importVersionWithSpecificId(
gr.forth.ics.rdfsuite.services.RdfDocument document,
java.util.Collection <java.lang.String> parentVersions,
java.lang.String versionId,
gr.forth.ics.rdfsuite.services.DbSettings dbSettings)