From 3d6496ea29cbef5b015160b3f594f3870fd3161a Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 10:56:03 +0200 Subject: [PATCH 1/6] Added image and title fields for OASIS --- helpers/transformer.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/helpers/transformer.js b/helpers/transformer.js index 54d7360..40148c6 100644 --- a/helpers/transformer.js +++ b/helpers/transformer.js @@ -49,7 +49,8 @@ exports.gebouwFetcher = async (params) => { if (err) throw new Error("Error while writing catalog file of specific building") fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]))), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], + "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg"))), err => { if (err) throw new Error("Error whiel writing building JSON") }) @@ -70,7 +71,8 @@ exports.gebouwFetcher = async (params) => { } else { fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]))), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], + "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg"))), err => { if (err) throw new Error("Error whiel writing building JSON") }) @@ -102,7 +104,7 @@ exports.gebouwFetcher = async (params) => { } }) - return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1])) + return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")) }; /** @@ -150,7 +152,7 @@ function fetch(url) { * @param {number} adresId * @param {number} location */ -function jsonLDBuilding(gebouwId, adresId, location) { +function jsonLDBuilding(gebouwId, adresId, location, name, image) { return { "@context": { "gebouwenRegister": "http://data.vlaanderen.be/id/gebouw/", @@ -161,10 +163,13 @@ function jsonLDBuilding(gebouwId, adresId, location) { "toevla": "http://semweb.mmlab.be/ns/wa#", "locn": "http://www.w3.org/ns/locn#", "geo": "http://www.opengis.net/ont/geosparql#", - "xsd": "http://www.w3.org/2001/XMLSchema#" + "xsd": "http://www.w3.org/2001/XMLSchema#", + "image": "http://schema.org/image" }, "@id": "gebouw:" + gebouwId, "@type": "gebouw:Gebouw", + "gebouw:gebouwnaam": name, + "image": image, "gebouw:Gebouw.adres": { "@id": "http://data.vlaanderen.be/id/adres/" + adresId, "@type": "http://www.w3.org/ns/locn#Address", @@ -252,4 +257,4 @@ function jsonLDService(id, name, description, productType, telephone, email, ope } return jsonLD; -} \ No newline at end of file +} From 9a00015e863dac045386185dfe588d413c327cee Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 11:07:07 +0200 Subject: [PATCH 2/6] WIP --- files/master-catalog.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/files/master-catalog.json b/files/master-catalog.json index 68a1e99..42aeaf9 100644 --- a/files/master-catalog.json +++ b/files/master-catalog.json @@ -1,9 +1 @@ -{ - "@context": { - "dcat": "https://www.w3.org/ns/dcat#", - "dcterms": "http://purl.org/dc/terms/", - "foaf": "http://xmlns.com/foaf/0.1/" - }, - "@type": "dcterms:Collection", - "dcterms:hasPart": [] -} \ No newline at end of file +{"@context":{"dcat":"https://www.w3.org/ns/dcat#","dcterms":"http://purl.org/dc/terms/","foaf":"http://xmlns.com/foaf/0.1/"},"@type":"dcterms:Collection","dcterms:hasPart":[{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/1800/catalog.json","@type":"dcat:Catalog"},{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/9300/catalog.json","@type":"dcat:Catalog"},{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/9300/catalog.json","@type":"dcat:Catalog"}]} \ No newline at end of file From e9c303ef032bd11a9a88e7cbb0714fb1df30c622 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 11:25:47 +0200 Subject: [PATCH 3/6] Added demo data for OASIS --- helpers/transformer.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/helpers/transformer.js b/helpers/transformer.js index 9dd1416..5e4f2bb 100644 --- a/helpers/transformer.js +++ b/helpers/transformer.js @@ -49,7 +49,7 @@ exports.gebouwFetcher = async (params) => { if (err) throw new Error("Error while writing catalog file of specific building") fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]))), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]), "Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")), err => { if (err) throw new Error("Error while writing building JSON") }) @@ -70,7 +70,7 @@ exports.gebouwFetcher = async (params) => { } else { fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]))), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]),"Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")), err => { if (err) throw new Error("Error while writing building JSON") }) @@ -78,7 +78,7 @@ exports.gebouwFetcher = async (params) => { let file_data = JSON.parse(data); let should_push = true; for(let i = 0; i < file_data["dcat:dataset"].length; i++){ - if (file_data["dcat:dataset"][i]["dcat:distribution"][0]["dcat:accessUrl"] === `http://smartflanders.ilabt.imec.be/graph/${params.postcode}/gebouwen${JSON.parse(gebouwId).gebouw.objectId}.json`){ + if (file_data["dcat:dataset"][i]["dcat:distribution"][0]["dcat:accessUrl"] === `http://smartflanders.ilabt.imec.be/graph/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`){ should_push = false; break; } @@ -89,7 +89,7 @@ exports.gebouwFetcher = async (params) => { "dcat:keyword": "http://data.vlaanderen.be/ns/gebouw#Gebouw", "dcat:distribution": [{ "@type": "dcat:Distribution", - "dcat:accessUrl": `http://smartflanders.ilabt.imec.be/graph/${params.postcode}/gebouwen${JSON.parse(gebouwId).gebouw.objectId}.json`, + "dcat:accessUrl": `http://smartflanders.ilabt.imec.be/graph/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, "dcat:mediaType": "text/html" }] }); @@ -121,7 +121,7 @@ exports.gebouwFetcher = async (params) => { } }) - return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1])) + return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], "Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")) }; /** @@ -169,7 +169,7 @@ function fetch(url) { * @param {number} adresId * @param {number} location */ -function jsonLDBuilding(gebouwId, adresId, location) { +function jsonLDBuilding(gebouwId, adresId, location, name, image) { return { "@context": { "gebouwenRegister": "http://data.vlaanderen.be/id/gebouw/", @@ -184,6 +184,8 @@ function jsonLDBuilding(gebouwId, adresId, location) { }, "@id": "gebouw:" + gebouwId, "@type": "gebouw:Gebouw", + "gebouw:gebouwnaam": name, + "image": image, "gebouw:Gebouw.adres": { "@id": "http://data.vlaanderen.be/id/adres/" + adresId, "@type": "http://www.w3.org/ns/locn#Address", @@ -271,4 +273,4 @@ function jsonLDService(id, name, description, productType, telephone, email, ope } return jsonLD; -} \ No newline at end of file +} From 5ec1f27690be86e50ce41e1116a640e560da14bc Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 11:30:20 +0200 Subject: [PATCH 4/6] Fixed service example --- files/service-example.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/service-example.json b/files/service-example.json index 3c541d5..8e49c57 100644 --- a/files/service-example.json +++ b/files/service-example.json @@ -55,7 +55,7 @@ ] }, "http://purl.org/dc/terms/description": "The public toilet of the public library of Mechelen", - "http://www.w3.org/ns/locn#location": "http://data.vlaanderen.be/id/gebouw/123", + "http://www.w3.org/ns/locn#location": "http://data.vlaanderen.be/id/adres/1531526", "toevla:accessibilityMeasurement": { "toevla:accessibilityMeasurement_for": { "dcterms:description": "The elevator", From f95a2fad9df68666b1848e832f7861cd3e3d7804 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 10:56:03 +0200 Subject: [PATCH 5/6] Added image and title fields for OASIS --- helpers/transformer.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/helpers/transformer.js b/helpers/transformer.js index 5e4f2bb..01b52c9 100644 --- a/helpers/transformer.js +++ b/helpers/transformer.js @@ -49,7 +49,8 @@ exports.gebouwFetcher = async (params) => { if (err) throw new Error("Error while writing catalog file of specific building") fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]), "Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], + "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg"))), err => { if (err) throw new Error("Error while writing building JSON") }) @@ -70,7 +71,8 @@ exports.gebouwFetcher = async (params) => { } else { fs.writeFile(__dirname + `/../files/${params.postcode}/gebouwen/${JSON.parse(gebouwId).gebouw.objectId}.json`, JSON.stringify(jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, - lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1]),"Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")), + lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], + "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg"))), err => { if (err) throw new Error("Error while writing building JSON") }) @@ -121,7 +123,7 @@ exports.gebouwFetcher = async (params) => { } }) - return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], "Gebouwnaam", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")) + return jsonLDBuilding(JSON.parse(gebouwDetails).identificator.objectId, JSON.parse(gebouwId).adressen[0].objectId, lambertToWGS(JSON.parse(gebouwId).geometriePunt.point.coordinates[0], JSON.parse(gebouwId).geometriePunt.point.coordinates[1], "Gebouw title", "https://installect.files.wordpress.com/2013/03/catsincup.jpg")) }; /** @@ -180,7 +182,8 @@ function jsonLDBuilding(gebouwId, adresId, location, name, image) { "toevla": "http://semweb.mmlab.be/ns/wa#", "locn": "http://www.w3.org/ns/locn#", "geo": "http://www.opengis.net/ont/geosparql#", - "xsd": "http://www.w3.org/2001/XMLSchema#" + "xsd": "http://www.w3.org/2001/XMLSchema#", + "image": "http://schema.org/image" }, "@id": "gebouw:" + gebouwId, "@type": "gebouw:Gebouw", From 73a9164ed33d4b0cdcbf69e4e5f99c726fe238e5 Mon Sep 17 00:00:00 2001 From: Dylan Van Assche Date: Mon, 23 Jul 2018 11:07:07 +0200 Subject: [PATCH 6/6] WIP --- files/master-catalog.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/files/master-catalog.json b/files/master-catalog.json index 68a1e99..42aeaf9 100644 --- a/files/master-catalog.json +++ b/files/master-catalog.json @@ -1,9 +1 @@ -{ - "@context": { - "dcat": "https://www.w3.org/ns/dcat#", - "dcterms": "http://purl.org/dc/terms/", - "foaf": "http://xmlns.com/foaf/0.1/" - }, - "@type": "dcterms:Collection", - "dcterms:hasPart": [] -} \ No newline at end of file +{"@context":{"dcat":"https://www.w3.org/ns/dcat#","dcterms":"http://purl.org/dc/terms/","foaf":"http://xmlns.com/foaf/0.1/"},"@type":"dcterms:Collection","dcterms:hasPart":[{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/1800/catalog.json","@type":"dcat:Catalog"},{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/9300/catalog.json","@type":"dcat:Catalog"},{"foaf:page":"http://smartflanders.ilabt.imec.be/graph/9300/catalog.json","@type":"dcat:Catalog"}]} \ No newline at end of file