ShowVoc Developers Manual

This section provides comprehensive information for users and developers integrating the ShowVoc widget for semantic annotation and for accessing dataset catalogue metadata. It currently outlines the core architectural principles underlying the widget. Additional technical details and implementation guidelines will be provided in future updates.

Widget

The widgets are implemented using @angular/elements (version ^20.1.4), the Angular library designed for building framework-agnostic Web Components. This technology allows Angular components to be packaged as Custom Elements, enabling their use in any HTML-based environment regardless of the underlying framework or application stack.

In the context of widget development, @angular/elements provides several advantages:

This approach ensures a flexible and scalable solution for integrating semantic annotation and dataset catalogue functionalities into heterogeneous client applications.

Search widget - <st-search>

The <st-search> widget provides a search interface over the resources contained in the datasets imported into ShowVoc. The component is implemented as an Angular-based Web Component using the @angular/elements library, which allows it to be embedded in any HTML application regardless of the underlying framework.

The widget exposes several user-configurable options:

These options allow fine-grained control over the search behaviour and make it possible to tailor the discovery of resources to different querying and browsing needs.

Developer Reference <st-search>

Inputs

The <st-search> widget exposes a set of configuration parameters that allow developers to control its localisation, available languages, and project filtering behaviour. These inputs can be provided either through HTML attributes when embedding the Web Component, or through JavaScript property assignment when interacting programmatically.

Outputs

The widget emits a set of CustomEvents to notify the host application about search results and user interactions with the returned resources.

These outputs allow the host application to respond to search activity, update the UI, or trigger additional logic without requiring direct access to the internal implementation of the widget.

Behaviour

The internal logic of the <st-search> widget is organised around a simple, predictable lifecycle that coordinates the search input, filter controls, and results list.

  1. Initialization:
    On startup, the widget reads configuration parameters from the locale, translations, languages and projects inputs. It derives the effective translation set, initialises the search mode (exact match, case sensitivity, local-name search) and renders the UI by composing the internal components: <app-search-input>, <app-languages-dropdown>, <app-match-mode-dropdown> and <app-resources-info>.
  2. Search configuration:
    When the user interacts with the language filter or the match mode dropdown, the widget updates its internal state (searchMode, caseSensitive, searchInLocalName) and propagates these values to the child components. This ensures that subsequent search operations are executed with the currently selected filters and options.
  3. Result handling:
    The <app-search-input> component performs the actual search and emits a resultsChange event when new results are available. The widget listens to this event, updates its internal resources collection, refreshes the <app-resources-info> view, and emits the searchResult output so that the host application can access the list of ResourcesInfoWithProject[].
  4. Resource selection:
    When the user selects a resource from the results list, <app-resources-info> emits a resourceSelect event. The widget forwards this selection through the selectedResource output, exposing the corresponding ResourceInfo object to the host application.

This behavior keeps the widget self-contained while providing a clear integration surface for developers via the searchResult and selectedResource outputs.

st-search widget

Annotation form widget - <st-annotation-form>

The <st-annotation-form> widget provides a form-based interface to create semantic annotations associated with a given online resource or external content (e.g. text fragments, documents, or records). The component is implemented as an Angular-based Web Component using the @angular/elements library, which allows it to be embedded in any HTML application regardless of the underlying framework.

The widget exposes several user-configurable options:

These options allow fine-grained control over the search behaviour and make it possible to tailor the discovery of resources to different querying and browsing needs.

Developer Reference <st-annotation-form>

Inputs

The <st-annotation-form> widget exposes a set of configuration parameters that allow developers to control its localisation, the identification of the digital object being annotated, the organisational context and the languages and projects used during semantic search. These inputs can be provided either through HTML attributes when embedding the Web Component, or through JavaScript property assignment when interacting programmatically.

Outputs

The <st-annotation-form> widget exposes a set of CustomEvents that notify the host application about changes in the semantic annotation, resource selection, and the result of the save operation.

These outputs provide a clear integration surface for consuming applications: they can react to resource selection changes, inspect or store the full semantic annotation, and handle the result of the save operation without coupling directly to the internal implementation of the widget.

Behaviour

The internal logic of the <st-annotation-form> widget is organised around a predictable lifecycle that covers initialisation of the digital object context, semantic search and resource selection, facets management and persistence of the final annotation.

  1. Initialization:
    On startup, the widget reads configuration parameters from the locale, translations, digitalObject, digitalObjectLabel, system, systemLabel, organization, organizationLabel, projects and languages inputs. It derives the effective translation set, initialises the “Digital Object” section with the provided identifiers and labels, prepares the facets area, and configures the internal semantic search controls with the given projects and language filters.
  2. Form interaction:
    As the user edits the digital object information, adds or updates custom facets, or selects/deselects semantic resources via the integrated search, the widget maintains an internal SemanticAnnotation representation. Each change to the annotation context (digital object, facets, selected resources, datasets) triggers an update of this internal model and results in the semanticAnnotationChange event being emitted so that the host application can inspect or mirror the current annotation state.
  3. Resource selection:
    When the user selects a semantic resource from the search results, the widget computes its contextual path within the dataset (for example using project, role and language information) and emits a resourceSelectedChange event carrying a ResourceInfoWithPath payload. Conversely, when a previously selected resource is deselected, a resourceDeselectedChange event is emitted with the corresponding ResourceInfoWithPath, allowing the host application to keep any external views (chips, tags, lists) in sync with the widget state.
  4. Save operation:
    When the user confirms the annotation, the widget sends the current SemanticAnnotation payload to the backend service that persists semantic annotations (for example via AnnotationService.annotateDigitalObject()), using the configured token for authentication. Once the backend call completes, the widget emits a saveCompleted event containing a { success: boolean, data?: any, error?: any } object that reports the outcome of the operation. This allows the host application to display success or error notifications, update its own state, or trigger additional workflows.

This behaviour keeps the annotation logic encapsulated within the widget while providing a clear integration surface through the semanticAnnotationChange, resourceSelectedChange, resourceDeselectedChange and saveCompleted outputs.

st-st-semantic-annotation widget

The annotation form widget includes a preview modal that provides a read-only summary of the semantic annotation before it is submitted to the backend service. The modal is opened from the main form and displays the full context of the annotation in a compact, human-readable way.

st-st-semantic-annotation widget preview