The SWKM Services: The Versioning Service.
About the Versioning Service.
The Versioning Service is responsible for constructing a new persistent version of a name or graph space already stored in the repository, in effect allowing the creation of several versions of an ontology or their instances in an RDF KB, while keeping the logical relationships between each of its versions, i.e., which version was created as an evolution of which pre-existing one etc.
The initial functionality of the Versioning service will offer versioning at the level of single RDF name or graph spaces. To this end, it takes as input the information regarding the version’s URI, the parent versions’ URI and the contents of the new version and creates a persistent version of the name or graph space in the given URI, with a new version ID.
More specifically, the URI of a version is assumed to be "split" in two appropriately delimited parts; the first part contains the URI prefix, which is shared between all different versions of the same name or graph space, while the second part contains the version ID that allows us to discriminate between the various versions. For example, the URI of version v1 or namespace ns1 would be "ns1~_~v1".
The version IDs are generated automatically by the service each time a new version is requested. The service guarantees that no two versions of the same name or graph space will get the same version ID. The user of the service relies on the use of the full URI to refer to the name or graph version, whereas the Registry Service offers the necessary functionality for accessing the different versions and querying their interrelationships, in a transparent way.

Figure 5: The Versioning Service
Figure 5 summarizes the functionality of the service. Initially, a new version identifier is created; this identifier will be associated with the new version. Moreover, the contents of the new version are validated before being fed to the Import Service (along with the new version ID), which will make the version persistent. During the import, the URIs of the various elements of a namespace need to be changed as they no longer correspond to the same elements as the old ones. As an example, consider a resource A that exists in version v1 of the namespace ns1; then its full name (fylly-qualified) will be "ns1~_~v1#A". Following the creation of the new version, say v2, the name of A will change to "ns1~_~v2#A". This renaming process is necessary because, if any particular triple appeared unchanged in both versions, we would end up having the same triple appearing in more than one namespaces, which is invalid. As the uniqueness requirement is true only for the namespaces, the renaming process is performed only for namespace versions. Following the renaming, appropriate calls to the Registry Service guarantee that the new version is properly recorded in the registry; to this end, the information on the new version’s parent(s) is necessary.
It should be emphasized that the creation of the new version does not remove the old version(s) from the repository. Since the old version’s URI does not change, references to old versions, are still valid. Changes of references to old versions is under the responsibility of the programmers.
One of the requirements of the method is that the new version and its parents should have the same URI prefix, as they are assumed to be different versions of the same name or graph space. Therefore, the validity of the input URIs should be verified before making the new version persistent, and success of the validation (and the import) is a prerequisite for the new version to be recorded in the registry. If validation succeeds, the Registry Service is used to record the new version of the name or graph space. The final output of the service is a URI that includes the URI prefix and the version ID of the new version.
The corresponding programming interface for this service may be found here.
Last modified: September 22, 2008