The figure below shows how the injection of annotations work.
Injection is the process of adding references to external supplementary documentation to local metadata. Such references could already be part of the metadata, but in many cases existing implementations do not support them. Here, the injectors provide an easy and efficient way to add the annotations to the documents, without the requirement for large-scale modifications of the existing implementation. The figure above is an example for an injection for a generic Web Service. The injector can be configured, for example to place the annotations on different levels (see the mentioned OGC Discussion Paper for an introduction into the concept of Annotation Levels). It is therefore possible to either simply add one reference in the appropriate location of the getCapabilities section, or multiple references for each feature type. It depends on the application's specific needs to specify on which level the annotations should be created.
In this case we assume that the annotations already exist in a database (Annotations). The metadata of an OGC Web Service (like the result coming from the getCapabilities-Operation of a Web Feature Service) is on the left-hand side. The geospatial data entities e.g. features, are within in a database (Data Entities). The features are modelled and described using feature types (encoded in GML schema) which is delivered when, for example, the describeFeatureType-operation is called. Such descriptions are usually generated on the fly. The semantic annotations linking the schema to external documentation have a volatile nature, the location and nature of external vocabularies change of the time. The same is valid for the data models itself. We therefore decided to „inject“ the annotations during the generation of the descriptions of the data models. The Web Service component forwards the XML stream to the sapience injector component.
This Java library takes the stream, as well as a unique service identifier, as input and checks if semantic annotations exist for the given service identifier. It either returns an unmodified stream, or (if the service identifier is confirmed by the component annotations-lookup) retrieves all annotations (in one document) and injects them at the appropriate locations. The annotations-lookup component either runs locally within the Web Service or, in the case of an infrastructure including multiple services, remotely as another Web Service. Reference links are stored in an annotation database (illustrated on the right-hand side of the figure) and consist of the document identifier, a XPath statement which shows the location within the document, and the accompanying URI pointing to the element in the external metadata document. The injector component adds the reference (the URL) to the individual elements and returns the modified stream to the original component. The result is a standard-compliant meta-data document enhanced with semantic annotations.