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 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", diff --git a/helpers/transformer.js b/helpers/transformer.js index 9dd1416..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]))), + 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]))), + 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") }) @@ -78,7 +80,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 +91,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 +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])) + 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")) }; /** @@ -169,7 +171,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/", @@ -180,10 +182,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", @@ -271,4 +276,4 @@ function jsonLDService(id, name, description, productType, telephone, email, ope } return jsonLD; -} \ No newline at end of file +}