Difference between revisions of "GCat Background"

From Gcube Wiki
Jump to: navigation, search
(Access the Catalogue via RESTful service)
(Available Catalogues and their public locations)
Line 20: Line 20:
 
''BLUEBRIDGE Catalogue''
 
''BLUEBRIDGE Catalogue''
  
* https://bluebridge.d4science.org/catalogue
+
* https://bluebridge.d4science.org/catalogue-bluebridge
* https://i-marine.d4science.org/catalogue
+
* https://i-marine.d4science.org/catalogue-bluebridge
  
 
''D4Science Catalogue''  
 
''D4Science Catalogue''  
* https://services.d4science.org/catalogue
+
* https://services.d4science.org/catalogue-d4s1
 
+
  
 
== Metadata ==
 
== Metadata ==

Revision as of 10:27, 26 September 2019

A catalogue is a service supporting its users to publish and search collections of descriptive information (metadata) for items including data, services, and related information objects.

D4Science offers services for seamless access and analysis to a wide spectrum of data including biological and ecological data, geospatial data, statistical data and semi-structured data from multiple authoritative data providers and information systems. These services can be exploited both via web based graphical user interfaces and web based protocols for programmatic access, e.g. OAI-PMH, CSW, WFS, SDMX. This offering nicely complements specific and community-specific applications. The gCube Data Catalogue catalogue contains a wealth of resources resulting from several activities, projects and communities including BlueBRIDGE (www.bluebridge-vres.eu/), i-Marine (www.i-marine.eu), SoBigData.eu (www.sobigdata.eu), and FAO (www.fao.org). All the products are accompanied with rich descriptions capturing general attributes, e.g. title and creator(s), as well as usage policies and licences.

The gCube Data Catalogue is built using and extending CKAN platform. CKAN is a powerful DMS (data management system) that makes data accessible – by providing tools to streamline publishing, sharing, finding and using data. CKAN is an open-source DMS for powering data hubs and data portals. CKAN makes it easy to publish, share and use data see: http://ckan.org/

CKAN model is made by the following entities (and their relations):

CKAN: 'Entities and Relations'

Available Catalogues and their public locations

BLUEBRIDGE Catalogue

D4Science Catalogue

Metadata

A Metadata in the gCube Data Catalogue is made by two parts: CKAN's default metadata fields and gCube Metadata Profile.

CKAN's default metadata fields

Those are metadata fields common for all metadata types in the gCube Data Catalogue (and used by default in the CKAN platform).

Label Field Name (API) Definition Guidelines Example
Title* title Name given to the dataset. Short phrase, written in plain language. Should be sufficiently descriptive to allow for search and discovery. Aquaculture Production and Consumption in Africa (2011)
Description description Short description explaining the content and its origins. Description of a few sentences, written in plain language. Should,provide a sufficiently comprehensive overview of the resource for anyone,to understand its content, origins, and any continuing work on it. The,description can be written at the end, since it summarizes key,information from the other metadata fields. This dataset contains attributes of aquaculture production and,consumption for each of Africa’s provinces in 2011. The data was,provided by………
Tags tags An array of Taxonomic terms stored as tags Taxonomic terms Access to education, Bamboo
License* lincese_title the license that applies to published dataset.
Organization* organization Organization the datasets belongs to See list of organizations on

https://ckan-d-d4s.d4science.org/organization

D4Science
Version version Version of dataset Increase manually after editing 1.0
Author* Owner of dataset The person who created the dataset in the format: Surname, Name Bloggs, Joe
Author Contact Contact details of owner The email or other contact details of the person who created the dataset. joe@example.com
Mantainer Mantainer of the dataset The person or the authority that maintains the dataset A person: Bloggs, Joe. An authority: D4Science
Mantainer

Contact

Contact details of mantainer The email or other contact details of the person who maintains the dataset. joe@example.com

mandatory fields are marked with an asterisk (*)

gCube Metadata Profile

gCube Metadata Profile defines a Metadata schema XML-based for adding custom metadata fields.

A gCube Metadata Profile is composed by one Metadata Format (<metadataformat>) containing an ordered list of (at least one) Metadata Field (<metadatafield>). From version 3 a Metadata Field can contain also a reference (categoryref="category_id_#") to an entity "Category" using the Namespace of the Category (<namespace id="category_id_#">). Add a Category Reference to a Metadata Field means that the "field" belongs to the Category referred by Category Identifier (id="category_id_#). See Metadata Profile v.3. for more details.

Metadata Profile v.3

Metadata Profile v.3 is a XML file having the format:

<?xml version="1.0" encoding="UTF-8"?>
<metadataformat type="YOUR TYPE HERE">
    <metadatafield categoryref="category_id_#">
        <fieldName>Name of Metadata Field</fieldName>
        <mandatory>true|false</mandatory>
        <dataType>String|Time|Time_Interval|Times_ListOf|Text|Boolean|Number|GeoJSON</dataType>
        <maxOccurs>N|*</maxOccurs>
        <defaultValue>default value</defaultValue>
        <note>shown as suggestions in the insert/update metadata form of CKAN
		</note>
        <vocabulary isMultiSelection="true|false">
            <vocabularyField>field1</vocabularyField>
            <vocabularyField>field2</vocabularyField>
            <vocabularyField>field3</vocabularyField>
        </vocabulary>
        <validator>
            <regularExpression>a regular expression for validating values</regularExpression>
        </validator>
        <tagging create="true|false" separator="char_to_separate">onFieldName|onValue|onFieldName_onValue|onValue_onFieldName</tagging> 
        <grouping create="true|false">onFieldName|onValue|onFieldName_onValue|onValue_onFieldName</grouping>
    </metadatafield>
</metadataformat>

The <fieldName> field contains the name of the metadata field.

The <mandatory> field declares if the <metadatafield> is a field mandatory (by using 'true') or not (by using 'false').

DataType values:

The <dataType> field specifies the kind of data. A valid dataType must be equal to one of the values {String, Time, Time_Interval, Times_ListOf, Text, Boolean, Number, GeoJSON}. When the data type is not specified the metadata field has the default value "String". Temporal type: by using the value Time or Time_Interval or Times_ListOf (based on ISO 8601). Spatial type: by using the value GeoJSON.

In detail:

  • String: is a string;
  • Time: an instant time that follows the general format: YYYY-MM-DD [HH:MM] where: YYYY: 4-digit year, MM: 2-digit month, DD: 2-digit day, [optional HH: 2-digit hour], [optional MM: 2-digit minute] (e.g. "2005-03-01");
  • Time_Interval: a continuous interval instead of a single instant by specifying a start and end time, separated by one '/' ('slash') character (e.g. "2005-03-01/2006-05-11");
  • Times_ListOf: a list of discrete time values, separated by a ',' ('comma') character (e.g. "2005-03-01, 2006-05-11, 2006-05-11-2007-04-12");
  • Text: is a text;
  • Boolean: is True/False;
  • Number: is a valid Java number, see: Apache Commons NumberUtils.isNumber;
  • GeoJSON: is a string in the GeoJSON is a format for encoding a variety of geographic data structures. In particular, it should contain a GeoJSON geometry;

GeoJSON example: an instance of MedataField for GeoSpatial

    <metadatafield idref="category_id_#">
        <fieldName>spatial</fieldName>  <!--'spatial' is mandatory name of GeoSpatial field  -->
        <dataType>GeoJSON</dataType>
        <defaultValue>{"type": "Point","coordinates": [-20.145,74.078]}</defaultValue>
        <note>shown as suggestions in the insert/update metadata form of CKAN</note>
    </metadatafield>

maxOccurs Indicator:

The <maxOccurs> indicator specifies the maximum number of times that <metadatafield> can occur:

  • N (as number): if the field must appear N times;
  • * (as char asterisk): if the field can appear an unlimited number of times.

Categories as "Namespaces":

  • the Namespace of a Category declares a "class" for metadata fields having particular characteristics. It has been introduced in order to group metadata fields for categories and displaying them in a dedicated area through advanced GUI provided by CKAN D4Science plugin.

Namespaces (for Categories) are defined in an XML file made by one Namespaces element (<namespaces>) containing a list of (at least) one or many Namespace (<namespace>). The file has the format:

<?xml version="1.0" encoding="UTF-8"?>
<namespaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<namespace id="category_id_#">
		<name>Category Name</name>
		<title>Category Title</title>
		<description>This section is about Category description</description>
	</namespace>
</namespaces>

A Namespace element (<namespace>) has an attribute (id) and three entities. The attribute "id" must be unique in the file #Namespaces_Categories_schema:_NamespacesCatalogueCategories.xsd, it represents the category identifier for the Category. The elements are: name (is mandatory), title (is mandatory), description (is optional).

Metadata Field and Category Reference (categoryref="category_id_#"):

  • categoryref is an optional attribute. It is a unique id (id="category_id_#"). A metadata field can belong to only one Namespace of a Category referring it via idref (categoryref="id category to which metadata field belongs one").

Type of (meta)data (is Mandatory):

  • type: a Metadata Format (metadataformat) must have a unique 'type' (as a xml attribute) that declares a "type" for it. This mandatory information is saved as custom key (system:type="value of type") of the item stored in the Data Catalogue.

Tagging:

  • It is used by gCube Data Catalogue front-end for adding a metadata field as a Tag of the metadata. A Tag is a string between 2 and 100 characters long containing only alphanumeric characters and '-' (hyphen), '_' (underscore), . (dot). Tagging element in the Metadata Profile schema v3 must have a value equal to one of the values: {onFieldName, onValue, onFieldName_onValue, onValue_onFieldName}. Tagging values meanings:
    • onFieldName: (only) the fieldName specified to metadata field must be added as a Tag;
    • onValue: (only) the value specified to metadata field must be added as a Tag;
    • onFieldName_onValue: both the fieldName and the value (in this order) specified to metadata field must be added as a Tag. They are separated by string used as separator (<tagging create="true|false" separator="char_to_separate">{onFieldName_onValue}</tagging>);
    • onValue_onFieldName: both the value and the fieldName (in this order) specified to metadata field must be added as a Tag. They are separated by string used as separator (<tagging create="true|false" separator="char_to_separate">{onValue_onFieldName}</tagging>).
  • Moreover, Tagging has two (optional) attribute: 'create' and 'separator'. The first one (create="true"|"false") is used to mean: create the Tag if does not exist, no otherwise. The second one (separator="char_to_separate") is the string that will be used to separate the FieldName from its value. Default value for separator is the character '-' if it is not specified.

Tagging example: using following instance of metadata field

	<metadatafield categoryref="contact">
		<fieldName>Name</fieldName>
		<dataType>String</dataType>
		<defaultValue>My Name</defaultValue>
		<note>Insert your Name</note>
		<tagging create="true" separator="-">onFieldName_onValue</tagging>
	</metadatafield>

where My Name is "Francesco", gCube Data Catalogue adds the tag Name-Francesco to metadata field if it does not exist

Grouping:

  • It is used by Data Catalogue fron-end for adding a metadata field to a Group of Data Catalogue. Data Catalogue groups are used for browsing. Grouping element in the Metadata Profile schema v3 must have a value equal to one of the values: {onFieldName, onValue, onFieldName_onValue, onValue_onFieldName}. The (optional) attribute create="true" is used to mean: create the Group if does not exist, no otherwise. Grouping values meanings:
    • onFieldName: (only) the fieldName specified to metadata field must be added to a Group;
    • onValue: (only) the value specified to metadata field must be added to a Group;
    • onFieldName_onValue: both the fieldName and the value (in this order) specified to metadata field must be added to a Group (<grouping create="true|false">{onFieldName_onValue}</grouping>);
    • onValue_onFieldName: both the value and the fieldName (in this order) specified to metadata field must be added to a Group (<grouping create="true|false">{onValue_onFieldName}</grouping>).
  • Moreover, Grouping has one (optional) attribute: 'propagateUp' This property will let a user specify if an item, that is going to be added to that group, must be also added to the hierarchical chain of groups involving it. For instance, if we have group B as child of group A, and item I is going to be added to B, then it will also be added to A.
Metadata Profile schema: gcdcmetadataprofilev3.xsd

The gCube Data Catalogue Metadata Profile (v.3) schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:include schemaLocation="NamespacesCatalogueCategories.xsd"/>
	<xs:element name="metadataformat">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="metadatafield" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element type="xs:string" name="fieldName" />
							<xs:element type="xs:boolean" name="mandatory"
								minOccurs="0" maxOccurs="1" />
							<xs:element name="dataType">
								<xs:simpleType>
									<xs:restriction base="xs:string">
										<xs:enumeration value="String" />
										<xs:enumeration value="Time" />
										<xs:enumeration value="Time_Interval" />
										<xs:enumeration value="Times_ListOf" />
										<xs:enumeration value="Text" />
										<xs:enumeration value="Boolean" />
										<xs:enumeration value="Number" />
										<xs:enumeration value="GeoJSON" />
									</xs:restriction>
								</xs:simpleType>
							</xs:element>
							<xs:element type="xs:string" name="maxOccurs"
								minOccurs="0" maxOccurs="1" />
							<xs:element type="xs:string" name="defaultValue"
								minOccurs="0" maxOccurs="1" />
							<xs:element type="xs:string" name="note" minOccurs="0"
								maxOccurs="1" />
							<xs:element name="vocabulary" minOccurs="0" maxOccurs="1">
								<xs:complexType>
									<xs:sequence>
										<xs:element type="xs:string" name="vocabularyField"
											minOccurs="1" maxOccurs="unbounded" />
									</xs:sequence>
									<xs:attribute type="xs:boolean" name="isMultiSelection" />
								</xs:complexType>
							</xs:element>
							<xs:element name="validator" minOccurs="0" maxOccurs="1">
								<xs:complexType>
									<xs:sequence>
										<xs:element type="xs:string" name="regularExpression" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="tagging" type="TaggingType"
								minOccurs="0" maxOccurs="1">
							</xs:element>
							<xs:element name="grouping" type="GroupingType"
								minOccurs="0" maxOccurs="1">
							</xs:element>
						</xs:sequence>
						<xs:attribute name="categoryref" use="optional" type="xs:string" />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
			<xs:attribute type="NotEmpty" use="required" name="type" />
		</xs:complexType>
	</xs:element>
	<xs:simpleType name="TaggingGroupingValue">
		<xs:restriction base="xs:string">
			<xs:enumeration value="onFieldName" />
			<xs:enumeration value="onValue" />
			<xs:enumeration value="onFieldName_onValue" />
			<xs:enumeration value="onValue_onFieldName" />
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="TaggingType">
		<xs:simpleContent>
			<xs:extension base="TaggingGroupingValue">
				<xs:attribute type="xs:boolean" name="create" />
				<xs:attribute type="NotEmpty" name="separator" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="GroupingType">
		<xs:simpleContent id="TaggingGroupingValue">
			<xs:extension base="TaggingGroupingValue">
				<xs:attribute type="xs:boolean" name="create" />
				<xs:attribute type="xs:boolean" name="propagateUp" />
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:simpleType name="NotEmpty">
		<xs:restriction base="xs:string">
			<xs:minLength value="1" />
		</xs:restriction>
	</xs:simpleType>
</xs:schema>

You can download it by clicking on Gcdcmetadataprofilev3.xsd

A "generic" example of MetadataProfile.xml:

<?xml version="1.0" encoding="UTF-8"?>
<metadataformat type="the_metadata_type" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="gcdcmetadataprofilev3.xsd">
  <metadatafield categoryref="idvalue0">
    <fieldName>fieldName</fieldName>
    <dataType>String</dataType>
    <defaultValue>defaultValue</defaultValue>
    <note>note</note>
    <vocabulary isMultiSelection="true">
      <vocabularyField>vocabularyField</vocabularyField>
    </vocabulary>
    <validator>
      <regularExpression>regularExpression</regularExpression>
    </validator>
    <tagging create="true" separator="-">onFieldName_onValue</tagging>
    <grouping create="true">onFieldName</grouping>
  </metadatafield>
</metadataformat>

Another example (of MetadataProfile.xml ) is the following one:

<?xml version="1.0" encoding="UTF-8"?>
<metadataformat type="the_metadata_type"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="gcdcmetadataprofilev3.xsd">
	<metadatafield categoryref="contact">
		<fieldName>Name</fieldName>
		<dataType>String</dataType>
		<defaultValue>My Name</defaultValue>
		<note>Insert your Name</note>
		<tagging create="true" separator="-">onFieldName_onValue</tagging>
	</metadatafield>
	<metadatafield categoryref="contact">
		<fieldName>Surname</fieldName>
		<dataType>String</dataType>
		<defaultValue>My Surname</defaultValue>
		<note>Insert your Surname</note>
	</metadatafield>
</metadataformat>
Namespaces Categories schema: NamespacesCatalogueCategories.xsd

The Namespaces Catalogue Categories schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified"
	elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:category="http://www.w3.org/TR/html4/">
	<xs:element name="namespaces">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="namespace" minOccurs="1" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element type="xs:string" name="name" minOccurs="1"
								maxOccurs="1" />
							<xs:element type="xs:string" name="title" minOccurs="1"
								maxOccurs="1" />
							<xs:element type="xs:string" name="description"
								minOccurs="0" maxOccurs="1" />
						</xs:sequence>
						<xs:attribute type="xs:string" name="id" use="required" />
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
		<xs:unique name="unique-namespace-id">
			<xs:selector xpath="namespace" />
			<xs:field xpath="@id" />
		</xs:unique>
	</xs:element>
</xs:schema>

You can download it by clicking on NamespacesCatalogueCategories

An example of valid Namespaces.xml:

<?xml version="1.0" encoding="UTF-8"?>
<namespaces xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="NamespacesCatalogueCategories.xsd">
	<namespace id="contact">
		<name>Contact</name>
		<title>Contact Title</title>
		<description>This section is about Contact(s)</description>
	</namespace>
	<namespace id="developer_information">
		<name>Developer</name>
		<title>Developer Title</title>
		<description>This section is about Developer(s)</description>
	</namespace>
	<namespace id="extra_information">
		<name>Extra</name>
		<title>Extra Title</title>
		<description>This section is about Extra(s)</description>
	</namespace>
</namespaces>

Instances of Metadata Profile

The following list shows the instances of metadata profile created in the D4Sciece infrastructure and currently used in gCube Data Catalogue:

SoBigData.eu

SoBigData.eu: Metadata Profile for gCube Data Catalogue

Ckan Connector

The Ckan Connector Service is a gCube RESTFul service that allows infrastructure users to interact with CKAN.

It implements two methods:

  • /connect: creates a new CKAN session. The user can interact with CKAN while the session is alive (not expired or destroyed by the user).
  • /disconnect : destroys the current CKAN session.

Geo Harvesting

This extension contains plugins like ckanext-geonetwork (and others) which add geospatial capabilities to CKAN.

Several harvesters to import geospatial metadata (like ISO 19139 format) into CKAN from other sources have been created in gCube Data Catalogue. In particular all metadata created into gCube Geonetwork (GeoNetwork is the catalog application to manage spatially referenced resources generated into D4Science Infrastructure) are harvested through the Geonetwork Resolver.

Mapping (among fields) from an ISO19139 Metadata to Ckan Dataset via ckanext-geonetwork is shown in the following table:

ISO19139 Ckan Dataset
Title Title
Description Description
bbox spatial
Descriptive Keywords
gmd:keyword Tag
Additional Info
metadata language, age,

reference system, etc.

key/value
Digital Transfer Option Data and Resource
CI_OnlineResource
gmd:url URL
gmd:name Name
gmd:description Description

Geonetwork Resolver

The 'Geonetwork Resolver' is a "middle tier" that authorizing the CKAN's harvesters to CSW harvesting of ISO19139 items provided through the gCube Geonetworks.

See more at https://wiki.gcube-system.org/gcube/URI_Resolver#Geonetwork_Resolver

Geo Datasets

In order to make a dataset queryable by location (geospatial dataset), a special extra must be defined, with its key named ‘spatial’. The value must be a valid GeoJSON geometry, for example:

{
  "type":"Polygon",
  "coordinates":[[[2.05827, 49.8625],[2.05827, 55.7447], [-6.41736, 55.7447], [-6.41736, 49.8625], [2.05827, 49.8625]]]
}

[Note: the polygon must be closed]

or

{
  "type": "Point",
  "coordinates": [-3.145,53.078]
}

GeoJSON Format Specification are available here: http://geojson.org/geojson-spec.html Datasets with spatial values are automatically geo-indexed, for example so that they can be searched using spatial filters.

GeoSpatial search for datasets: via API or Search Widget

Once your datasets are geo-indexed, you can perform spatial queries by bounding box (coordinates format is [LONG, LAT]), via the following API call:

/api/2/search/dataset/geo?bbox={minx,miny,maxx,maxy}[&crs={srid}]

If the bounding box coordinates are not in the same projection as the one defined in the database, a CRS must be provided, in one of the following forms:

    urn:ogc:def:crs:EPSG::4326
    EPSG:4326
    4326

Otherwise default bounding box is 4326. CKAN Wiki page for Legacy API

Moreover, you can perform spatial queries using an integrated map widget available on CKAN, which allows filtering results by an area of interest. You can try it on D4Science Data Catalogue

CKAN Wiki page for Spatial Search Widget

Users, Roles and Groups

Three roles are envisaged to capture the actions users are allowed to execute by the catalogue in the context of each VRE:

  • Catalogue_Member - users with this role are allowed to:
    • View the organization’s private datasets.
  • Catalogue_Editor - users with this role are allowed to:
    • View the organization’s private datasets;
    • Publish new datasets (into the organization);
    • Edit or delete the organization’s datasets the user is owner of.
  • Catalogue_Admin - users with this role are allowed to:
    • View the organization’s private datasets;
    • Publish new datasets (into the organization);
    • Edit or delete any of the organization’s datasets;
    • Make datasets public or private.

The default role assigned to every VRE user is Catalogue_Member, i.e. every user of a VRE is entitled to view the private datasets published in the VRE scope in addition to any public dataset. VRE Managers can assign other roles to selected users to enlarge their capabilities.

CKAN Groups can used to create and manage collections of datasets. This could be to catalogue datasets for a particular project or team, or on a particular theme, or as a very simple way to help people find and search your own published datasets.

Dataset Update

As above presented only Catalogue_Editor (Editor) and Catalogue_Admin (Admin) can update existing dataset. The update can be performed by them via REST API (see: https://wiki.gcube-system.org/gcube/Catalogue_restful_service)

However, it is possible to edit a dataset also through the CKAN GUI (via Manage), but in this case If Editor or Admin need to edit records by adding/updating resources to them, they need to:

  • 1. store the file on the workspace;
  • 2. get a public link to the that file;
  • 3. edit the record by adding that link.

D4Science CKAN plugin

@TODO Francesco

Release procedure to D4Science CKAN plugin

@TODO Francesco

Access the Catalogue via RESTful service

You can find more details at gCat Service page.

Related Issues

[1] gCube Data Catalogue for Global Record of Stocks and Fisheries - https://wiki.gcube-system.org/gcube/GCube_Data_Catalogue_for_GRSF

[2] Data Catalogue Resolver - https://wiki.gcube-system.org/gcube/URI_Resolver#CATALOGUE_Resolver