Resource Metadata

Introduction

Resource Metadata, available from version 8.0.0, is an enhanced and customizable way for enabling metadata according to the user desires. This mechanism is inspired to the Custom Form functionality and exploit the transformation language PEARL in order to define RDF graph pattern to write or delete following certain events (resource creation, update or deletion). In a nutshell, the idea behind Resource Metadata is that if (for instance) a concept is being edited, an event is fired and a dedicated CODA PEARL is triggered to do something, for instance, remove the old dct:modified and create a new one with the current date.

Resource Metadata page

Resource Metadata page can be accessed through the link under the Tools menu. The page is mainly splitted in two sections, left and right, respectively showing the Metadata Patterns and Pattern Associations and allowing their management.

Resource Metadata page

Metadata Pattern

A Metadata Pattern represents the actions to be performed following certain events. It is possible to defines three different patterns: Construction, Update and Destruction respectively fired when a resource is created, updated or deleted.

Through the buttons on the Metadata Patterns panel toolbar, users can create, delete and edit patterns. By clicking on the + button (for creation) or the "pencil" one (for editing), the following pattern editor is prompted.

Pattern editor

Below the two input fields for the name and the description of the pattern, a three tabbed panel contains PEARL editors for writing or editing the three different patterns aforementioned. Editor for factory-provided patterns (written in gray) are opened in readonly mode.

The previous screenshot shows the factory-provided pattern designed for writing and updating DublinCore metadata (dct:created and dct:modified). In order to better understand how it works, here below are reported the Construction and Update pearl rules (prefix declarations omitted for simplicity):

/* Construction */ rule it.uniroma2.art.semanticturkey.onResourceCreated id:onResourceCreated { nodes = { createdRes uri opCtx/resource . creationDate literal(coda:datetime()) . } graph = { $createdRes dct:created $creationDate . } } /* Update */ rule it.uniroma2.art.semanticturkey.onResourceModified id:onResourceModified { nodes = { modifiedRes uri opCtx/resource . modificationDate literal(coda:datetime()) . } insert = { $modifiedRes dct:modified $modificationDate . } delete = { OPTIONAL{ $modifiedRes dct:modified ?oldModificationDate . } } where = { $modifiedRes dct:modified ?oldModificationDate . } }

The first rule adds the dct:created metadata to a created resource, while the second one updates the old dct:modified value of the modified resource.

A special feature structure opCtx is present in the code. This structure holds contextual operation details in order to make them usable in the rule. Additionally to resource (that holds the resource being created/edited/deleted), it is available user holding the IRI of the user that performed the triggering action.

Through the toolbar buttons further actions are available. A pattern can be cloned. Factory provided patterns, rendered in gray, are widely available across all projects and cannot be edited. They can thus be cloned at project level in order to be customized. All patterns can be exported on the user filesystem and then imported in another project or even in another VB instance. An alternative way to share patterns across projects is represented by the pattern library

Pattern library actions

A project defined pattern can be shared into a cross-project pattern library simply by selecting it and clicking on the Store pattern in shared library item (see previous figure). A shared pattern can be then imported into a project through Import Pattern from shared library. The following figure shows the modals for storing in and importing from the shared patterns library.

Pattern library

Metadata Association

As seen previously, the right panel of the ResourceMetadata page lists the Metadata Associations. From this panel it is possible to create and delete association. An association is needed in order to make effective a pattern as it maps a resource type with a pattern. In this way the system is instructed to execute the proper PEARL rule following an event.

Creating a new association is quite simple. By clicking of the + button of the panel, the following modal is prompted, where user just need to select a resource type and a pattern among those available.

Pattern association

Enabling Resource Metadata during project creation

Enabling usage of Resource Metadata can be done also during the project creation. In the create project form, the ResourceMetadata section is available among the Optional settings. In this section, administrator user needs to tick the User Resource Metadata checkbox and add an association between a Resource type and a Pattern.

Project creation

Clicking on the button with the "pencil" icon, a modal prompts the available patterns. During the project creation, only factory-provided patterns can be chosen. Finally, it is possible to inspect a pattern selected in the list by clicking on the "eye" button on the top right corner of the panel. A further modal will show a readonly pattern editor (already seen in this page).

Pattern selection