From 85df6a27b9098d669ed8e5b9de5b56282ff31ca3 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 29 Apr 2019 14:06:16 +0200 Subject: [PATCH 1/4] update metadata interface --- src/ddo/MetaData.ts | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/ddo/MetaData.ts b/src/ddo/MetaData.ts index 2402df4..aea373a 100644 --- a/src/ddo/MetaData.ts +++ b/src/ddo/MetaData.ts @@ -27,7 +27,7 @@ export interface File { * File content length. * @type {[type]} */ - contentLength?: string + contentLength?: number /** * Resource ID (depending on the source). @@ -87,12 +87,19 @@ export interface MetaDataBase { description?: string /** - * The date on which the asset was created or was added. + * The date on which the asset was created by the originator in ISO 8601 format, Coordinated Universal Time. * @type {string} - * @example "2012-10-10T17:00:000Z" + * @example "2019-01-31T08:38:32Z" */ dateCreated: string + /** + * The date on which the asset DDO was registered into the metadata store. This value is created automatically by Aquarius upon registering, so this value can't be set. + * @type {string} + * @example "2019-01-31T08:38:32Z" + */ + datePublished?: string + /** * Name of the entity generating this data (e.g. Tfl, Disney Corp, etc.). * @type {string} @@ -151,16 +158,22 @@ export interface MetaDataBase { inLanguage?: string /** - * Keywords or tags used to describe this content. Multiple entries in a keyword - * list are typically delimited by commas. Empty by default. - * @type {String} - * @example "weather, uk, 2011, temperature, humidity" + * Categories used to describe this content. Empty by default. + * @type {string[]} + * @example ["Economy", "Data Science"] */ - tags?: string + categories?: string[] + + /** + * Keywords or tags used to describe this content. Empty by default. + * @type {string[]} + * @example ["weather", "uk", "2011", "temperature", "humidity"] + */ + tags?: string[] /** * Price of the asset. - * @type {String} + * @type {number} * @example 10 */ price: number @@ -201,8 +214,8 @@ export interface Curation { /** * Schema applied to calculate the rating. - * @type {number} - * @example "Binary Votting" + * @type {string} + * @example "Binary Voting" */ schema?: string } @@ -219,7 +232,7 @@ export interface AdditionalInformation { * @type {string} * @example "yearly" */ - updateFrecuency: string + updateFrequency: string /** * A link to machine-readable structured markup (such as ttl/json-ld/rdf) From 6dd1fa5d3623f6c4fed7d74522c50cf0a3570ffc Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 29 Apr 2019 14:35:42 +0200 Subject: [PATCH 2/4] update test data --- integration/utils/ddo-metadata-generator.ts | 45 ++++++++++++++------- src/ddo/MetaData.ts | 7 +++- test/ddo/DDO.test.ts | 18 +++------ test/testdata/MetaData.ts | 11 +++-- test/testdata/ddo.json | 24 +++++++---- 5 files changed, 64 insertions(+), 41 deletions(-) diff --git a/integration/utils/ddo-metadata-generator.ts b/integration/utils/ddo-metadata-generator.ts index 03e2f06..741f97d 100644 --- a/integration/utils/ddo-metadata-generator.ts +++ b/integration/utils/ddo-metadata-generator.ts @@ -5,28 +5,43 @@ const metadata: Partial = { name: undefined, type: "dataset", description: "Weather information of UK including temperature and humidity", - dateCreated: "2012-02-01T10:55:11+00:00", + dateCreated: "2012-10-10T17:00:000Z", + datePublished: "2012-10-10T17:00:000Z", author: "Met Office", license: "CC-BY", copyrightHolder: "Met Office", - // tslint:disable-next-line - workExample: "stationId,latitude,longitude,datetime,temperature,humidity423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", - files: [ - { - url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/package.json", - }, - { - url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/README.md", - }, - ], + workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", links: [ - {sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/"}, - {sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/"}, - {fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/"}, + { + sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/", + }, + { + sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/", + }, + { + fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/", + }, ], inLanguage: "en", - tags: "weather, uk, 2011, temperature, humidity", + categories: ["Economy", "Data Science"], + tags: ["weather", "uk", "2011", "temperature", "humidity"], price: 10, + files: [ + { + url: "234ab87234acbd09543085340abffh21983ddhiiee982143827423421", + checksum: "efb2c764274b745f5fc37f97c6b0e761", + contentLength: 4535431, + resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932", + }, + { + url: "234ab87234acbd6894237582309543085340abffh21983ddhiiee982143827423421", + checksum: "085340abffh21495345af97c6b0e761", + contentLength: 12324, + }, + { + url: "80684089027358963495379879a543085340abffh21983ddhiiee982143827abcc2", + }, + ], }, } diff --git a/src/ddo/MetaData.ts b/src/ddo/MetaData.ts index aea373a..294096b 100644 --- a/src/ddo/MetaData.ts +++ b/src/ddo/MetaData.ts @@ -87,14 +87,17 @@ export interface MetaDataBase { description?: string /** - * The date on which the asset was created by the originator in ISO 8601 format, Coordinated Universal Time. + * The date on which the asset was created by the originator in + * ISO 8601 format, Coordinated Universal Time. * @type {string} * @example "2019-01-31T08:38:32Z" */ dateCreated: string /** - * The date on which the asset DDO was registered into the metadata store. This value is created automatically by Aquarius upon registering, so this value can't be set. + * The date on which the asset DDO was registered into the metadata store. + * This value is created automatically by Aquarius upon registering, + * so this value can't be set. * @type {string} * @example "2019-01-31T08:38:32Z" */ diff --git a/test/ddo/DDO.test.ts b/test/ddo/DDO.test.ts index fa7f98f..562cfc8 100644 --- a/test/ddo/DDO.test.ts +++ b/test/ddo/DDO.test.ts @@ -93,19 +93,12 @@ describe("DDO", () => { name: "UK Weather information 2011", type: "dataset", description: "Weather information of UK including temperature and humidity", - size: "3.1gb", dateCreated: "2012-10-10T17:00:000Z", + datePublished: "2012-10-10T17:00:000Z", author: "Met Office", license: "CC-BY", copyrightHolder: "Met Office", - encoding: "UTF-8", - compression: "zip", - contentType: "text/csv", workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", - contentUrls: [ - "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip", - "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip", - ], links: [ { // tslint:disable-next-line @@ -120,19 +113,20 @@ describe("DDO", () => { }, ], inLanguage: "en", - tags: "weather, uk, 2011, temperature, humidity", + categories: ["Economy", "Data Science"], + tags: ["weather", "uk", "2011", "temperature", "humidity"], price: 10, files: [ { url: "234ab87234acbd09543085340abffh21983ddhiiee982143827423421", checksum: "efb2c764274b745f5fc37f97c6b0e761", - contentLength: "4535431", + contentLength: 4535431, resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932", }, { url: "234ab87234acbd6894237582309543085340abffh21983ddhiiee982143827423421", checksum: "085340abffh21495345af97c6b0e761", - contentLength: "12324", + contentLength: 12324, }, { url: "80684089027358963495379879a543085340abffh21983ddhiiee982143827abcc2", @@ -143,7 +137,7 @@ describe("DDO", () => { curation: { rating: 0.93, numVotes: 123, - schema: "Binary Votting", + schema: "Binary Voting", }, additionalInformation: { updateFrecuency: "yearly", diff --git a/test/testdata/MetaData.ts b/test/testdata/MetaData.ts index 50630a8..9a54b67 100644 --- a/test/testdata/MetaData.ts +++ b/test/testdata/MetaData.ts @@ -6,15 +6,17 @@ export const metadataMock: MetaData = { type: "dataset", description: "Weather information of UK including temperature and humidity", dateCreated: "2012-10-10T17:00:000Z", + datePublished: "2012-10-10T17:00:000Z", author: "Met Office", license: "CC-BY", copyrightHolder: "Met Office", workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", files: [ { + index: 0, url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip", checksum: "085340abffh21495345af97c6b0e761", - contentLength: "12324", + contentLength: 12324, }, { url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp2.zip", @@ -34,17 +36,18 @@ export const metadataMock: MetaData = { }, ], inLanguage: "en", - tags: "weather, uk, 2011, temperature, humidity", + categories: ["Economy", "Data Science"], + tags: ["weather", "uk", "2011", "temperature", "humidity"], price: 10, checksum: "", }, curation: { rating: 0.93, numVotes: 123, - schema: "Binary Votting", + schema: "Binary Voting", }, additionalInformation: { - updateFrecuency: "yearly", + updateFrequency: "yearly", structuredMarkup: [ { uri: "http://skos.um.es/unescothes/C01194/jsonld", diff --git a/test/testdata/ddo.json b/test/testdata/ddo.json index 8272643..cd53e6b 100644 --- a/test/testdata/ddo.json +++ b/test/testdata/ddo.json @@ -166,18 +166,25 @@ "name": "UK Weather information 2011", "type": "dataset", "description": "Weather information of UK including temperature and humidity", - "size": "3.1gb", "dateCreated": "2012-10-10T17:00:000Z", "author": "Met Office", "license": "CC-BY", "copyrightHolder": "Met Office", - "encoding": "UTF-8", - "compression": "zip", - "contentType": "text/csv", "workExample": "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", "contentUrls": [ "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip" ], + "files": [ + { + "index": 0, + "url": "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip", + "checksum": "085340abffh21495345af97c6b0e761", + "contentLength": 12324 + }, + { + "url": "https://testocnfiles.blob.core.windows.net/testfiles/testzkp2.zip" + } + ], "links": [ { "name": "Sample of Asset Data", @@ -191,16 +198,17 @@ } ], "inLanguage": "en", - "tags": "weather, uk, 2011, temperature, humidity", + "categories": ["Economy", "Data Science"], + "tags": ["weather", "uk", "2011", "temperature", "humidity"], "price": 10 }, "curation": { "rating": 0.93, "numVotes": 123, - "schema": "Binary Votting" + "schema": "Binary Voting" }, "additionalInformation": { - "updateFrecuency": "yearly", + "updateFrequency": "yearly", "structuredMarkup": [ { "uri": "http://skos.um.es/unescothes/C01194/jsonld", @@ -215,4 +223,4 @@ } } ] -} \ No newline at end of file +} From dedcb833308d7fc879124e0048bece56fb46baa5 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 29 Apr 2019 15:24:21 +0200 Subject: [PATCH 3/4] cleanup test data --- integration/utils/ddo-metadata-generator.ts | 16 ++---- test/ddo/DDO.test.ts | 13 ++--- test/testdata/AccessToken.json | 1 - test/testdata/MetaData.ts | 63 --------------------- 4 files changed, 10 insertions(+), 83 deletions(-) delete mode 100644 test/testdata/AccessToken.json delete mode 100644 test/testdata/MetaData.ts diff --git a/integration/utils/ddo-metadata-generator.ts b/integration/utils/ddo-metadata-generator.ts index 741f97d..ecc8f3b 100644 --- a/integration/utils/ddo-metadata-generator.ts +++ b/integration/utils/ddo-metadata-generator.ts @@ -28,19 +28,13 @@ const metadata: Partial = { price: 10, files: [ { - url: "234ab87234acbd09543085340abffh21983ddhiiee982143827423421", - checksum: "efb2c764274b745f5fc37f97c6b0e761", - contentLength: 4535431, - resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932", + index: 0, + url: 'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip' }, { - url: "234ab87234acbd6894237582309543085340abffh21983ddhiiee982143827423421", - checksum: "085340abffh21495345af97c6b0e761", - contentLength: 12324, - }, - { - url: "80684089027358963495379879a543085340abffh21983ddhiiee982143827abcc2", - }, + index: 1, + url: 'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip' + } ], }, } diff --git a/test/ddo/DDO.test.ts b/test/ddo/DDO.test.ts index 562cfc8..6928391 100644 --- a/test/ddo/DDO.test.ts +++ b/test/ddo/DDO.test.ts @@ -77,7 +77,6 @@ describe("DDO", () => { }, { type: "Consume", - // tslint:disable-next-line serviceEndpoint: "http://mybrizo.org/api/v1/brizo/services/consume?pubKey=${pubKey}&serviceId={serviceId}&url={url}", }, { @@ -101,12 +100,10 @@ describe("DDO", () => { workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", links: [ { - // tslint:disable-next-line - sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/" + sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/", }, { - // tslint:disable-next-line - sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/" + sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/", }, { fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/", @@ -118,18 +115,18 @@ describe("DDO", () => { price: 10, files: [ { - url: "234ab87234acbd09543085340abffh21983ddhiiee982143827423421", + index: 0, checksum: "efb2c764274b745f5fc37f97c6b0e761", contentLength: 4535431, resourceId: "access-log2018-02-13-15-17-29-18386C502CAEA932", }, { - url: "234ab87234acbd6894237582309543085340abffh21983ddhiiee982143827423421", + index: 1, checksum: "085340abffh21495345af97c6b0e761", contentLength: 12324, }, { - url: "80684089027358963495379879a543085340abffh21983ddhiiee982143827abcc2", + index: 2, }, ], checksum: "", diff --git a/test/testdata/AccessToken.json b/test/testdata/AccessToken.json deleted file mode 100644 index 27824c1..0000000 --- a/test/testdata/AccessToken.json +++ /dev/null @@ -1 +0,0 @@ -"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzM4NCJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE1Mzk3ODcxMDEsImV4cCI6NDcyNjk5NjcwNCwiYXVkIjoiIiwic3ViIjoiIiwic2VydmljZV9lbmRwb2ludCI6Imh0dHA6Ly9hZGFzZCIsInJlc291cmNlX2lkIjoiMTIzNDUifQ.2H3TRC3CAToVE9divSckwHi_HNvgOHKrtJPo8128qrKBHTk7YYb0UNfVCuYqwhGR" diff --git a/test/testdata/MetaData.ts b/test/testdata/MetaData.ts deleted file mode 100644 index 9a54b67..0000000 --- a/test/testdata/MetaData.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { MetaData } from "../../src/ddo/MetaData" - -export const metadataMock: MetaData = { - base: { - name: "UK Weather information 2011", - type: "dataset", - description: "Weather information of UK including temperature and humidity", - dateCreated: "2012-10-10T17:00:000Z", - datePublished: "2012-10-10T17:00:000Z", - author: "Met Office", - license: "CC-BY", - copyrightHolder: "Met Office", - workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68", - files: [ - { - index: 0, - url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip", - checksum: "085340abffh21495345af97c6b0e761", - contentLength: 12324, - }, - { - url: "https://testocnfiles.blob.core.windows.net/testfiles/testzkp2.zip", - }, - ], - links: [ - { - // tslint:disable-next-line - sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/" - }, - { - // tslint:disable-next-line - sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/" - }, - { - fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/", - }, - ], - inLanguage: "en", - categories: ["Economy", "Data Science"], - tags: ["weather", "uk", "2011", "temperature", "humidity"], - price: 10, - checksum: "", - }, - curation: { - rating: 0.93, - numVotes: 123, - schema: "Binary Voting", - }, - additionalInformation: { - updateFrequency: "yearly", - structuredMarkup: [ - { - uri: "http://skos.um.es/unescothes/C01194/jsonld", - mediaType: "application/ld+json", - }, - { - uri: "http://skos.um.es/unescothes/C01194/turtle", - mediaType: "text/turtle", - }, - ], - checksum: "", - }, -} From d2498af628b48de976a474932301f25e121e6077 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 30 Apr 2019 12:10:09 +0200 Subject: [PATCH 4/4] switch test files urls --- integration/utils/ddo-metadata-generator.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/utils/ddo-metadata-generator.ts b/integration/utils/ddo-metadata-generator.ts index ecc8f3b..e5e0e41 100644 --- a/integration/utils/ddo-metadata-generator.ts +++ b/integration/utils/ddo-metadata-generator.ts @@ -29,12 +29,12 @@ const metadata: Partial = { files: [ { index: 0, - url: 'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip' + url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/package.json", }, { index: 1, - url: 'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip' - } + url: "https://raw.githubusercontent.com/oceanprotocol/squid-js/develop/README.md", + }, ], }, }