Metadata Manager
Contents
Introduction
The Metadata Catalog service manage the modelling of arbitrary metadata relationships (IDB-relationships). The only assumption it does is that the metadata objects are serialized as well-formed XML documents. The service has a two-fold role:
- to manage Metadata Objects and Metadata Collections
- to establish secondary role-typed links. Such relationships can be in place between any type of Information Object and in the scope of a Collection or not
Metadata Object
A Metadata Object (MO) is a source Information Object for an IDB-relationship. An MO can be associated to one and only one target Information Object (even if in the context of different Metadata Collections) which is described by the MO. An MO here is always intended as an XML document wrapped in a well defined envelope. As to content, the Metadata Manager Service adopts an exchange model to add a number of system-level properties needed for the appropriate management of the Metadata Objects within the context of the Metadata Manager Service.
The Metadata Manager Components
The main functionality of the Metadata Manager components is the management of Metadata Objects, Metadata Collection and their relationships. To operate over Metadata Collections, the Metadata Catalog instantiates Collection Managers (or shortly, Managers) for each collection. A Collection Manager is the access point to all the possible operations over a specific Metadata Collection. From an architectural point of view, the Metadata Manager adopts the Factory pattern and Collection Managers are implemented as a stateful WS-Resource. Physically, the service is composed by:
- the MetadataManagerFactory, a factory service that creates new Collection Managers and offers some cross-Collection operations
- the MetadataManagerService, a service that operates over Metadata Collections (MCs) and on Metadata Objects as Elements, i.e. members of a specific Metadata Collection
MetadataManagerFactory
The MetadataManagerFactory Service creates new Collection Managers and offers some cross-Collection operations. Moreover, it operates on Metadata Objects as Information Objects related to other Information Objects and not as Members of Metadata Collections.
- EndPointReferenceType createManager(CollectionID, params): This operation takes a set of creation parameters and creates a new Manager in order to manage a Metadata Collection bound to such a Collection. If a Metadata Collection with the specified Metadata characteristics does not exist, the Manager creates the Metadata Collection, binds it with the Document Collection with the given secondary role relationship and publishes its profile in the IS. The Creation parameters are a set of key-value; the following keys are defined in the MMLibrary and accepted by the operation:
These ones are mandatory:
- COLLECTIONNAME -> name of the collection
- METADATANAME -> metadata name (e.g. “dc”)
- METADATALANG -> metadata language (e.g. “English”), as specified in the ISO 639-2
- METADATAURI -> metadata URI: the XML Schema that defines the MO payloads
- ROLE -> secondary role
The optional ones are:
- DESCRIPTION -> description
- INDEXABLE -> if the collection is indexable or not (“True”/”False”)
- USER -> if the collection is a user collection or not (“True”/”False”)
- RELATEDBY_COLLID -> the name of the source content collection
- RELATEDBY_URI -> the source XML Schema from which the current one has been generated
- GENERATEDBY_COLLID -> the source Metadata Collection from which the current one has been generated (by the Metadata Broker), if any
- GENERATEDBY_ROLE -> the secondary role between the Metadata Collection and the one from which the current one has been generated (by the Metadata Broker), if any
- Among the others, two parameters can modify the way in which the Metadata Collection is managed:
- Indexable: if the new Metadata Collection is indexable, the Manager creates also a new MetadataXMLIndexer (see Section 4.2.2.3) for such a Collection using the XMLIndexer Service;
- User: a user Collection is shown in the Portals and an end-user can operate on it; a non-user Collection is intended for internal puporses (like to collect parts of persisted Indexes).
- Among the others, two parameters can modify the way in which the Metadata Collection is managed:
- ResultSetService
- EndPointReferenceType createManagerFromCollection (MetadataCollectionID): This operation takes a Metadata Collection ID. It returns:
- the related CollectionManager, if it already exists
- creates a new CollectionManager and returns its EPR, if the Metadata Collection exists
- an error, if the Collection ID is not valid
- MOID addMetadata(ObjectID, MO, SecondaryRole): This operation takes a new non-collectable Metadata Object and
- completes the metadata header information (e.g. the MOID, if it is not specified)
- stores (or updates if the MOID is already included in the MO header) the object on the Storage Management Service as Information Object
- creates a <is-described-by, <SecondaryRole>> binding in the Storage Management Service between the Metadata Object and the Information Object identified by the given Object ID
- returns the assigned MOID
- void deleteMetadata(MOID): This operation deletes from the Storage Management Service the Metadata Object identified by the given ID.
- (ObjectID, (MO, SecondaryRole)[])[] getMetadata ((ObjectID, SecondaryRole, CollectionID, Rank)[]): For each given ObjectID, this operation returns the Metadata Objets. They are:
- bound with the specified secondary role (the primary role is, of course, is-described-by) to the Information Object identified by that ObjectID
- members of the specified Metadata Collection. The operation relies on the String[] retrieveReferred(String targetObjectID, String role, String secondaryrole) operation of the Storage Management Service.
Dependencies
These are the dependencies of the Service :
- XMLIndexer
- ResultSetService
- ContentManagement
- MMLibrary
Usage Examples
This example shows how to create a MetadataManager:
... String factoryURI = "http://node2.d.d4science.research-infrastructures.eu:8080/wsrf/services/gcube/metadatamanagement/metadatamanager/MetadataManagerFactory"; MetadataManagerFactoryServiceAddressingLocator factoryLocator = new MetadataManagerFactoryServiceAddressingLocator(); try { EndpointReferenceType factoryEPR = new EndpointReferenceType(); MetadataManagerFactoryPortType mFactory; factoryEPR.setAddress(new Address(factoryURI)); System.out.println("Creating the new Factory portType"); mFactory= factoryLocator.getMetadataManagerFactoryPortTypePort(factoryEPR); CreateManagerRequest request = new CreateManagerRequest(); request.setCollectionID("D4S-test2"); CollectionParameter [] collectionpar = new CollectionParameter[13]; CreateCollectionParameters ccp = new CreateCollectionParameters(); for ( int i =0; i<collectionpar.length; i++ ) collectionpar[i] = new CollectionParameter(); collectionpar[0].setName(CreationParameters.COLLECTIONNAME.toString()); collectionpar[0].setValue("EDEDEDED");//FAO Reports 4 statistics collectionpar[1].setName(CreationParameters.DESCRIPTION.toString()); collectionpar[1].setValue("prova "); collectionpar[2].setName(CreationParameters.RELATEDBY_COLLID.toString()); collectionpar[2].setValue(RelatedContentCollectionID); collectionpar[3].setName(CreationParameters.RELATEDBY_ROLE.toString()); collectionpar[3].setValue("is-described-by"); collectionpar[4].setName(CreationParameters.EDITABLE.toString()); collectionpar[4].setValue("True"); collectionpar[5].setName(CreationParameters.INDEXABLE.toString()); collectionpar[5].setValue("True"); collectionpar[6].setName(CreationParameters.USER.toString()); collectionpar[6].setValue("True"); collectionpar[7].setName(CreationParameters.METADATALANG.toString()); collectionpar[7].setValue("en"); collectionpar[8].setName(CreationParameters.METADATANAME.toString()); collectionpar[8].setValue("dc"); collectionpar[9].setName(CreationParameters.METADATAURI.toString()); collectionpar[9].setValue("http://www.opendlib.com/resources/schemas/metadata_dc.xsd"); collectionpar[10].setName(CreationParameters.ROLE.toString()); collectionpar[10].setValue("is-described-by"); // optional String GeneratedCollectionID = "cfb556a0-83da-11dd-be9e-b4b1d1517767"; collectionpar[11].setName(CreationParameters.GENERATEDBY_COLLID.toString()); collectionpar[11].setValue(GeneratedCollectionID); collectionpar[12].setName(CreationParameters.GENERATEDBY_URI.toString()); collectionpar[12].setValue("http://mail.google.com/mail"); ccp.setParams(collectionpar); request.setCollectionParameters(ccp); CreateManagerResponse response = null; try{ mFactory = GCUBERemotePortTypeContext.getProxy(mFactory,GCUBEScope.getScope("/gcube/devsec")); response = mFactory.createManager(request); }catch(Exception e ){ e.printStackTrace(); return; } System.out.println(response.getEndpointReference().toString()); } catch (Exception e) { e.printStackTrace(); } ....
The new feature of the Metadata Manager: "generated-by" relationship between metadata objects The Metadata Manager handle this new relationship between MO To be able to use this feature it is needed to create a Metadata Collection specifying the following CollectionParameter:
- the GENERATEDBY_COLLID: the ID of the Metadata Collection from which it has been generated
Then,the Metadata envelope need to have a new field <generatedByMOID> to specify the Metadata Object from which it has been generated The Metadata Manager will take care of this new field and will store the information in the Storage as secondary role, to be able to retrieve it later.