@piveau/piveau-hub-ui-modules 4.6.26 → 4.6.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data-provider-interface/components/BlankInput.vue.d.ts +2 -0
- package/dist/data-provider-interface/components/BlankInput.vue.mjs +11 -0
- package/dist/data-provider-interface/components/BlankInput.vue.mjs.map +1 -0
- package/dist/data-provider-interface/components/BlankInput.vue2.mjs +5 -0
- package/dist/data-provider-interface/components/BlankInput.vue2.mjs.map +1 -0
- package/dist/data-provider-interface/components/DistributionStepper.vue.mjs.map +1 -1
- package/dist/data-provider-interface/components/WidgetInput.vue.mjs +42 -37
- package/dist/data-provider-interface/components/WidgetInput.vue.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatapde_BFS/format-types.mjs +1 -0
- package/dist/data-provider-interface/config/dcatapde_BFS/format-types.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatapde_BFS/input-definition.d.ts +1 -1
- package/dist/data-provider-interface/config/dcatapde_BFS/input-definition.mjs +9 -0
- package/dist/data-provider-interface/config/dcatapde_BFS/input-definition.mjs.map +1 -1
- package/dist/data-provider-interface/config/dcatapde_BFS/page-content-config.mjs +1 -1
- package/dist/data-provider-interface/config/dcatapde_BFS/page-content-config.mjs.map +1 -1
- package/dist/data-provider-interface/utils/RDFconverter.mjs +155 -157
- package/dist/data-provider-interface/utils/RDFconverter.mjs.map +1 -1
- package/dist/data-provider-interface/utils/inputConverter.mjs +85 -86
- package/dist/data-provider-interface/utils/inputConverter.mjs.map +1 -1
- package/dist/data-provider-interface/views/InputPage.vue.mjs +30 -32
- package/dist/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
- package/dist/datasets/datasetsFacets/DatasetsFacets.vue.mjs +78 -71
- package/dist/datasets/datasetsFacets/DatasetsFacets.vue.mjs.map +1 -1
- package/dist/form/inputDefinitions.mjs +25 -20
- package/dist/form/inputDefinitions.mjs.map +1 -1
- package/dist/piveau-hub-ui-modules.css +1 -1
- package/dist/scss/_dpi-style.scss +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RDFconverter.mjs","sources":["../../../lib/data-provider-interface/utils/RDFconverter.js"],"sourcesContent":["import N3 from \"n3\";\nimport { isEmpty } from \"lodash\";\nimport { has } from \"lodash\";\n\nimport generalDpiConfig from \"../config/dpi-spec-config\";\n\nimport generalHelper from \"./general-helper\";\n\n/**\n * Converts all properties for given data from form input data into RDF (N-Triples)\n * @param {Object} data Data given within an object. Data stored as follows { datasets: {...}, distributions: [{...},...], catalogues: {...}}\n * @param {String} property Name of property which should be converted (either 'datasets' or 'catalogues')\n * @returns String of converted data in RDF format (N-Triples)\n */\nfunction convertToRDF(data, property, specification) {\n let finishedRDFdata;\n\n let dpiConfig = specification;\n\n // writer for adding data as quads\n const RDFdata = new N3.Writer({\n prefixes: dpiConfig.prefixes,\n format: \"N-Triples\",\n });\n // datasetURI also needed for distribution creation (add distributionURI to dataset (dcat:distribution))\n const datasetURI = `https://piveau.eu/set/data/${data.datasets.datasetID}`;\n\n // convert values for datasets/catalogues\n convertPropertyValues(\n RDFdata,\n data[property],\n property,\n \"\",\n \"\",\n true,\n datasetURI,\n dpiConfig\n ); // datasets and catalogues\n\n // include distribution data into same graph\n // differentiation neccessary because datasets also include distributions\n if (property === \"datasets\") {\n // multiple distributions possible -> [{data of distribution 1}, {data of distribution 2}, ...]\n for (let index = 0; index < data.distributions.length; index += 1) {\n convertPropertyValues(\n RDFdata,\n data.distributions[index],\n \"distributions\",\n \"\",\n \"\",\n true,\n datasetURI,\n dpiConfig\n );\n }\n }\n\n RDFdata.end((error, result) => (finishedRDFdata = result));\n return finishedRDFdata;\n}\n\n/**\n * Converts each single value of given form data based on type into RDF\n * @param {N3.Writer} RDFdataset Dataset the converted RDF data should be added to\n * @param {Object} data Object containing data as key-value pairs\n * @param {String} property String determining which property is handled (datasets/distributions/catalogues)\n * @param {DataFactory} preMainURI (can be undefined) Could be a namedNode or BlankNode containing an URI\n * @param {DataFactory} preMainType (can be undefined) NamedNode determining the type of the current property (e.g. dcat:Dataset (as object))\n * @param {Boolean} setMain Value determining if additional values should be set (type, id, sample...)\n * @param {String} datasetURI URI of dataset for use in distribution conversion\n */\nfunction convertPropertyValues(\n RDFdataset,\n data,\n property,\n preMainURI,\n preMainType,\n setMain,\n datasetURI,\n dpiConfig\n) {\n console.log(\n RDFdataset,\n data,\n property,\n preMainURI,\n preMainType,\n setMain,\n datasetURI,\n dpiConfig\n );\n\n const formatTypes = dpiConfig.formatTypes;\n\n // method can be called recursively for nested properties\n // need to access id of parent node for later use as subject -> provide via method parameters (preMainURI & preMainType)\n let mainURI;\n let mainType;\n\n // parent method can be called recursively for nested values\n // if called on non-nested values a overall id and type muste be set (setMain -> true)\n if (setMain) {\n if (property === \"datasets\") {\n mainType = generalHelper.addNamespace(\"dcat:Dataset\", dpiConfig);\n mainURI = N3.DataFactory.namedNode(datasetURI); // datasetID should never be empty because of frontend checking\n } else if (property === \"catalogues\") {\n mainType = generalHelper.addNamespace(\"dcat:Catalog\", dpiConfig);\n mainURI = N3.DataFactory.namedNode(\n `https://piveau.eu/set/data/${data.datasetID}`\n ); // datasetID should never be empty because of frontend checking\n } else {\n mainType = generalHelper.addNamespace(\"dcat:Distribution\", dpiConfig);\n const randomId = generalHelper.makeId(10);\n // distribution id can be random, will be overwritten by backend on saving data\n mainURI = N3.DataFactory.namedNode(\n `https://piveau.eu/set/data/${randomId}`\n );\n }\n\n // parent method can be called recursively to convert nested values\n // but setting the overal type and id of a dataset/catalogue is only required once at the beginning\n // -> only set additional properties when setMain === true\n setAdditionalProperties(\n RDFdataset,\n data,\n mainURI,\n mainType,\n property,\n datasetURI,\n dpiConfig\n );\n } else {\n // called on nested properties with already given URI and type which should used in the following conversion process\n mainURI = preMainURI;\n mainType = preMainType;\n }\n\n // distributions may have download URLs, if no downloadURL is provided -> provided accessUrls will be also set as downloadUrls\n // accessUrl is a required property and therefore always provided (made sure by the frontend)\n // const downloadUrlsProvided = has(data, 'dcat:downloadURL') && !isEmpty(data['dcat:downloadURL']) && data['dcat:downloadURL'].map(el => !isEmpty(el['@id'])).reduce((a, b) => b);\n\n // loop trough all keys within data object and convert values (or nested values) to RDF\n const valueKeys = Object.keys(data);\n for (let index = 0; index < valueKeys.length; index += 1) {\n const key = valueKeys[index]; // key format: either a normal name for special properties (e.g. datasetID) or namespaced keys (e.g. dct:title)\n\n if (generalHelper.propertyHasValue(data[key])) {\n // all properties are sorted by their format (see .../data-provider-interface/config/format-types.js)\n // depending on the format the corresponding conversion-method is used, writing the result to the overall RDF-writer\n if (formatTypes.singularString[property].includes(key)) {\n convertSingularString(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.singularURI[property].includes(key)) {\n convertSingularURI(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.multipleURI[property].includes(key)) {\n // if no dowloadURL is provided, set accessUrls as downloadUrls\n // if (!downloadUrlsProvided && key === 'dcat:accessURL') {\n // // copy accessurl array to donwloadurl array and convert data\n\n // data['dcat:downloadURL'] = cloneDeep(data['dcat:accessURL']);\n // convertMultipleURI(RDFdataset, mainURI, data, 'dcat:downloadURL', property, dpiConfig);\n // }\n\n convertMultipleURI(RDFdataset, mainURI, data, key, property, dpiConfig);\n } else if (formatTypes.typedStrings[property].includes(key)) {\n convertTypedString(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.multilingualStrings[property].includes(key)) {\n convertMultilingual(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.groupedProperties[property].includes(key)) {\n // grouped properties are properties provided by the form which consist of multiple properties (e.g contactPoint)\n // the properties values are stored within an object located within an array\n // for repeatable properties there are multiple objects in this array, otherwise there is just one\n\n let actualData;\n // vcard:hasAdress is an object as well as dct:creator and skos:notation\n if (\n key === \"vcard:hasAddress\" ||\n key === \"dct:creator\" ||\n key === \"skos:notation\" ||\n key === \"spdx:checksum\"\n )\n actualData = [data[key]];\n else actualData = data[key];\n\n // looping trough all existing objects within the array\n for (let groupId = 0; groupId < actualData.length; groupId += 1) {\n let currentGroupData = actualData[groupId];\n\n if (!isEmpty(currentGroupData)) {\n if (key === \"skos:notation\") {\n // property skos:notation work a little bit different then other properties\n // the form provides a value and a type from two seperated fields ({'@value': '...', '@type': '...'})\n // the resulting RDF should merge these values into a typed literal (value^^type)\n if (\n has(currentGroupData, \"@value\") &&\n !isEmpty(currentGroupData[\"@value\"])\n ) {\n let notationValue;\n\n // if a type is given, use to form typed literal\n // if no type is given, only use value to create literal\n if (\n has(currentGroupData, \"@type\") &&\n !isEmpty(currentGroupData[\"@type\"])\n ) {\n // typed literal\n notationValue = N3.DataFactory.literal(\n currentGroupData[\"@value\"],\n N3.DataFactory.namedNode(currentGroupData[\"@type\"].resource)\n );\n } else {\n // literal\n notationValue = N3.DataFactory.literal(\n currentGroupData[\"@value\"]\n );\n }\n\n // add type for adms:identifier\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"adms:Identifier\", dpiConfig)\n )\n )\n );\n\n // save quadruple with typed or untyped literal\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n notationValue\n )\n );\n\n // resulting rdf quads should look like this:\n // datasetId adms:identifier admsIdentifierUtl\n // admsIdentifierUrl rdf:type adms:Identifier\n // admsIdentifierUrl skos:notation value^^type\n }\n } else {\n let groupBlankNode;\n\n // because grouped properties have a list of nested properties we need an initial quadruple stating the parent property\n // using a blank node as object which later serves as subject for the nested properties\n // RDF example:\n // datasetID dct:contactPoint blankNodeId\n // blankNodeId foaf:mbox email@exmaple.com\n // blankNodeId fn:name InsitutionName ...\n\n // some form fields provide an URL which should serves as namedNode for other nested values (e.g. conformsTo)\n // RDF example:\n // datasetID dct:conformsTo conformsToURI\n // conformsToURI dct:title conformsTitle\n if (\n (key === \"foaf:page\" ||\n key === \"adms:identifier\" ||\n key === \"dct:conformsTo\") &&\n has(currentGroupData, \"@id\")\n ) {\n groupBlankNode = N3.DataFactory.namedNode(\n currentGroupData[\"@id\"]\n );\n }\n // all properties that don't provide an URL serving as namedNode for nested values need to define a blank node\n\n // page gets type but also has multilingual fields with preseleted langauge\n // don't create blank node if there is not data for page beside the preselected language\n let emptyPage = false;\n\n if (key === \"foaf:page\") {\n // if page has title and/or description property given, check if there are values given\n const hasTitle = has(currentGroupData, \"dct:title\");\n const hasDescription = has(currentGroupData, \"dct:description\");\n\n let hasNoValueKeysTitle = true;\n let hasEmptyValueTitle = true;\n let hasNoValueKeysDescription = true;\n let hasEmptyValueDescription = true;\n\n if (hasTitle) {\n hasNoValueKeysTitle = !currentGroupData[\"dct:title\"].every(\n (el) => has(el, \"@value\")\n );\n hasEmptyValueTitle = currentGroupData[\"dct:title\"].every(\n (el) => isEmpty(el[\"@value\"])\n );\n }\n\n if (hasDescription) {\n hasNoValueKeysDescription = !currentGroupData[\n \"dct:description\"\n ].every((el) => has(el, \"@value\"));\n hasEmptyValueDescription = currentGroupData[\n \"dct:description\"\n ].every((el) => isEmpty(el[\"@value\"]));\n }\n\n // page should be handled as empty if:\n // no title and/or no description given\n // if properties given: no value given or value empty\n if (\n (hasNoValueKeysTitle || hasEmptyValueTitle) &&\n (hasNoValueKeysDescription || hasEmptyValueDescription)\n )\n emptyPage = true;\n }\n\n if (!emptyPage) {\n if (!groupBlankNode)\n groupBlankNode = N3.DataFactory.blankNode(\"\");\n\n // save inital quadruple using the named or blank node as object\n // e.g. datasetId dct:contactPoint blankNode/namedNode\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n groupBlankNode\n )\n );\n\n // some properties provide additional types\n if (has(formatTypes.additionalPropertyTypes, key)) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n groupBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\n formatTypes.additionalPropertyTypes[key],\n dpiConfig\n )\n )\n )\n );\n }\n\n // temporal values nested inside another object: \"dct:temporal\": [{ \"dct:temporal\": { \"dcat:startDate\": \"...\", \"dcat:endDate\": \"...\" } }]\n if (key === \"dct:temporal\") {\n if (has(currentGroupData, \"dct:temporal\")) {\n currentGroupData = currentGroupData[\"dct:temporal\"];\n }\n }\n\n // convert all nested values provided by form\n convertPropertyValues(\n RDFdataset,\n currentGroupData,\n property,\n groupBlankNode,\n mainType,\n false,\n dpiConfig,\n dpiConfig\n );\n }\n }\n }\n }\n } else if (formatTypes.conditionalProperties[property].includes(key)) {\n // publisher either is an URI or a group with multiple values (name, homepage, email)\n // license either is an URI or a group with multiple values ()\n if (key === \"dct:publisher\" || key === \"dct:license\") {\n // data contains either {resource: '...', name: '...'} or object containing other keys\n if (has(data[key], \"resource\")) {\n convertSingularURI(RDFdataset, mainURI, data, key, dpiConfig);\n } else {\n const groupBlankNode = N3.DataFactory.blankNode(\"\");\n\n // some properties provide additional types\n if (has(formatTypes.additionalPropertyTypes, key)) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n groupBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\n formatTypes.additionalPropertyTypes[key],\n dpiConfig\n )\n )\n )\n );\n }\n\n // save inital quadruple using the named or blank node as object\n // e.g. datasetId dct:contactPoint blankNode/namedNode\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n groupBlankNode\n )\n );\n\n convertPropertyValues(\n RDFdataset,\n data[key],\n property,\n groupBlankNode,\n mainType,\n false,\n dpiConfig,\n dpiConfig\n );\n }\n }\n } else if (key === \"dcat:temporalResolution\") {\n // temporal resolution is displayed as group of input forms for each property (year, month, day, ...)\n // the form provides the data as following: [ { 'Year': '...', 'Month': '...', ... } ]\n // the final format of this property should look like this: P?Y?M?DT?H?M?S\n // not all values must be filled and therefore be present -> default behavior if not given: value = 0\n\n const resolutionValues = data[key];\n const valueString = `P${\n resolutionValues.Year ? resolutionValues.Year : 0\n }Y${resolutionValues.Month ? resolutionValues.Month : 0}M${\n resolutionValues.Day ? resolutionValues.Day : 0\n }DT${resolutionValues.Hour ? resolutionValues.Hour : 0}H${\n resolutionValues.Minute ? resolutionValues.Minute : 0\n }M${resolutionValues.Second ? resolutionValues.Second : 0}S`;\n\n // frontend always provides temporalResolution even if there is no value resulting in P0Y0M0DT0H0M0S\n // don't save if value is equal to P0Y0M0DT0H0M0S\n if (valueString !== \"P0Y0M0DT0H0M0S\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(\n valueString,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"xsd:duration\", dpiConfig)\n )\n )\n )\n );\n }\n } else if (key === \"dct:identifier\") {\n // form provides data as array of objects with strings: [ { '@value': 'string1' }, { '@value': 'string2' }, ... ]\n // create quadruple for each given object in the array\n for (let valueId = 0; valueId < data[key].length; valueId += 1) {\n const currentValue = data[key][valueId];\n if (has(currentValue, \"@value\") && !isEmpty(currentValue[\"@value\"])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(currentValue[\"@value\"])\n )\n );\n }\n }\n } else if (key === \"dct:rights\") {\n // rights has a static type (RightsStatement) which needs to be added to linked data as additional node\n // therefore we need to create an initial quadruple for with 'rights' being the predicate having a blank node\n // blank node serves as subject for the following quadruples which contain the type and actual value of the form field\n // RDF:\n // datasetID dct:rights blankNodeID\n // blankNodeId rdf:type RightsStatement\n // blankNodeId rdfs:label LabelValue\n\n // blank node as object for inital quadruple and also as subject for following quadruples\n const rightsBlankNode = N3.DataFactory.blankNode(\"\");\n\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n rightsBlankNode\n )\n );\n\n // add additional type declaration\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n rightsBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dct:RightsStatement\", dpiConfig)\n )\n )\n );\n\n // rights is a conditional property and provides either an URI or a string ( { rdfs:label : 'URL/string' } )\n let rightsValue;\n\n if (data[key][\"@type\"] === \"url\") {\n rightsValue = N3.DataFactory.namedNode(data[key][\"rdfs:label\"]);\n } else {\n rightsValue = N3.DataFactory.literal(data[key][\"rdfs:label\"]);\n }\n\n // add actual value\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n rightsBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdfs:label\", dpiConfig)\n ),\n rightsValue\n )\n );\n }\n }\n }\n}\n\n/**\n * Creates additional quads depending on given property and saves them to given RDF dataset\n * @param {N3.Writer} RDFdataset RDF dataset the quads are saved to\n * @param {Object} data Object containing data as key-value pairs\n * @param {DataFactory.namedNode} mainURI NamedNode defining URI of current property graph\n * @param {DataFactory} mainType NamedNode defining type of current property graph\n * @param {String} property String determining which property is converted (datasets/distributions/catalogues)\n * @param {String} datasetURI URI of dataset used to add distribution URI to dct:distribution within dataset graph\n */\nfunction setAdditionalProperties(\n RDFdataset,\n data,\n mainURI,\n mainType,\n property,\n datasetURI,\n dpiConfig\n) {\n // adding id and type of property\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(mainType)\n )\n );\n\n // catalogues always have to contain the property dct:type with the value 'dcat-ap'\n if (property === \"catalogues\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dct:type\", dpiConfig)\n ),\n N3.DataFactory.literal(\"dcat-ap\")\n )\n );\n }\n\n // add distribution id to dataset graph (dcat:distribution)\n if (property === \"distributions\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n N3.DataFactory.namedNode(datasetURI),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dcat:distribution\", dpiConfig)\n ),\n mainURI\n )\n );\n }\n}\n\n//-----------------------------------------------------------------------------------------------------\n// basic conversion (input to RDF) methods for different categories of data\n//-----------------------------------------------------------------------------------------------------\n// seems unnecessary at first but if we want to convert nested properties as well, we need these\n// methods (especially to provide the correct parent URI)\n\n/**\n * Converts provided data to quad and saves it to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data Data given by form used as object in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad\n */\nfunction convertSingularString(RDFdataset, id, data, key, dpiConfig) {\n if (!isEmpty(data[key])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key])\n )\n );\n }\n}\n\n/**\n * Converts provided data to quad and saves it to given dataset\n * @param {N3.Writer} RDFdata Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data Data given by form used as object in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad\n */\nfunction convertSingularURI(RDFdataset, id, data, key, dpiConfig) {\n // there are two different formats the frontend delivers URIs\n // 1: 'URI' or 2: {'name': 'abc', 'resource': 'URI'}\n\n // URIs can either be a normal URL or an email address\n // mail addresses typicall include '@' which is used to determine if the given string is a normal URL or an email address\n if (!isEmpty(data[key])) {\n let singleURI;\n\n if (typeof data[key] === \"object\") {\n if (has(data[key], \"resource\")) {\n singleURI = data[key].resource;\n }\n } else {\n if (data[key].includes(\"@\")) {\n // mail address\n singleURI = `mailto:${data[key]}`;\n } else {\n // normal URL\n singleURI = data[key];\n }\n }\n\n // save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.namedNode(singleURI)\n )\n );\n }\n}\n\n/**\n * Converts provided data to quads and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quads\n * @param {Array} data Array containing URLs used as object within quads\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quads\n * @param {String} property Determining which property is concerted (datasets/distributions/catalogues)\n */\nfunction convertMultipleURI(RDFdataset, id, data, key, property, dpiConfig) {\n // there are two different formats the frontend delivers multiple URIs\n // 1: [ {\"name\": '...', \"resource\": 'URI'}, {...} ] -> multi-autocomplete fields\n // 2: [ { \"@id\": \"URI1\" }, { \"@id\": \"URI2\" } ] repeatable fields\n\n for (let uriIndex = 0; uriIndex < data[key].length; uriIndex += 1) {\n let currentURI;\n const valueObject = data[key][uriIndex];\n if (!isEmpty(valueObject)) {\n if (has(valueObject, \"resource\")) currentURI = valueObject.resource;\n else if (has(valueObject, \"@id\")) currentURI = valueObject[\"@id\"];\n }\n\n // save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.namedNode(currentURI)\n )\n );\n }\n}\n\n/**\n * Converts provided data to quad and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data String data used as object with type in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad and to determine quad-object type\n */\nfunction convertTypedString(RDFdataset, id, data, key, dpiConfig) {\n if (!isEmpty(data[key])) {\n // there is a variety of properties which can have different types\n // issued and motified already provide a type definition ({'@type': 'date/datetime', '@value': '...'})\n if (key === \"dct:issued\" || key === \"dct:modified\") {\n if (has(data[key], \"@value\") && !isEmpty(data[key][\"@value\"])) {\n const imValueType =\n data[key][\"@type\"] === \"date\" ? data[key][\"@type\"] : \"dateTime\";\n const valueType = generalHelper.addNamespace(\n `xsd:${imValueType}`,\n dpiConfig\n );\n\n /// save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(\n data[key][\"@value\"],\n N3.DataFactory.namedNode(valueType)\n )\n )\n );\n }\n } else {\n // all other properties are given as a simple string\n let valueType;\n if (key === \"dcat:endDate\" || key === \"dcat:startDate\") {\n // dcat:endDate and dcat:startDate are xsd:dateTime\n valueType = generalHelper.addNamespace(\"xsd:dateTime\", dpiConfig);\n } else if (\n key === \"dcat:spatialResolutionInMeters\" ||\n key === \"dcat:byteSize\"\n ) {\n // dcat:spatialResolutionInMeters and dcat:byteSize are xsd:decimal\n valueType = generalHelper.addNamespace(\"xsd:decimal\", dpiConfig);\n } else if (key === \"pv:distributionType\") {\n valueType = generalHelper.addNamespace(\"xsd:string\", dpiConfig);\n }\n\n /// save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key], N3.DataFactory.namedNode(valueType))\n )\n );\n }\n }\n}\n\n/**\n * Converts provided data to quads and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quads\n * @param {Array} data Array of objects containing data and language converted into literal with language for quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quads\n */\nfunction convertMultilingual(RDFdataset, id, data, key, dpiConfig) {\n // multilingual fields mostly provide data as followed\n // [ { '@value': '....', '@language': '...' }, ... ]\n // only the licence title provides no language\n\n if (!isEmpty(data[key])) {\n // licence title\n if (!Array.isArray(data[key])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key])\n )\n );\n } else {\n for (let langIndex = 0; langIndex < data[key].length; langIndex += 1) {\n const currentData = data[key][langIndex];\n // only save data if a value is given (forntend provides preselected language which don't need to be saved if there is no actaul value)\n if (\n !isEmpty(currentData) &&\n has(currentData, \"@value\") &&\n !isEmpty(currentData[\"@value\"])\n ) {\n let languageTag;\n\n // if there is no langauge given, set language to english\n if (\n !has(currentData, \"@language\") ||\n isEmpty(currentData, \"@language\")\n ) {\n languageTag = \"en\";\n } else {\n // if language is given, use given tag\n languageTag = currentData[\"@language\"];\n }\n\n // saving quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(currentData[\"@value\"], languageTag)\n )\n );\n }\n }\n }\n }\n}\n\nexport default {\n convertToRDF,\n};\n"],"names":["convertToRDF","data","property","specification","finishedRDFdata","dpiConfig","RDFdata","N3","datasetURI","convertPropertyValues","index","error","result","RDFdataset","preMainURI","preMainType","setMain","formatTypes","mainURI","mainType","generalHelper","randomId","setAdditionalProperties","valueKeys","key","convertSingularString","convertSingularURI","convertMultipleURI","convertTypedString","convertMultilingual","actualData","groupId","currentGroupData","isEmpty","has","notationValue","groupBlankNode","emptyPage","hasTitle","hasDescription","hasNoValueKeysTitle","hasEmptyValueTitle","hasNoValueKeysDescription","hasEmptyValueDescription","el","resolutionValues","valueString","valueId","currentValue","rightsBlankNode","rightsValue","id","singleURI","uriIndex","currentURI","valueObject","imValueType","valueType","lang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Y,UAAUkD,CAAS,CAAC;AAAA,QACtE;AAAA,MACT;AAAA,IACK;AAEL;AASA,SAAS5B,EAAoBhB,GAAYsC,GAAIlD,GAAMuB,GAAKnB,GAAW;AAKjE,MAAI,CAAC4B,EAAQhC,EAAKuB,CAAG,CAAC;AAEpB,QAAI,CAAC,MAAM,QAAQvB,EAAKuB,CAAG,CAAC;AAC1B,MAAAX,EAAW;AAAA,QACTN,EAAG,YAAY;AAAA,UACb4C;AAAA,UACA5C,EAAG,YAAY,UAAUa,EAAc,aAAaI,GAAKnB,CAAS,CAAC;AAAA,UACnEE,EAAG,YAAY,QAAQN,EAAKuB,CAAG,CAAC;AAAA,QACjC;AAAA,MACT;AAAA;AAEM,eAASkC,IAAY,GAAGA,IAAYzD,EAAKuB,CAAG,EAAE,QAAQkC,KAAa,GAAG;AACpE,cAAMC,IAAc1D,EAAKuB,CAAG,EAAEkC,CAAS;AAEvC,YACE,CAACzB,EAAQ0B,CAAW,KACpBzB,EAAIyB,GAAa,QAAQ,KACzB,CAAC1B,EAAQ0B,EAAY,QAAQ,CAAC,GAC9B;AACA,cAAIC;AAGJ,UACE,CAAC1B,EAAIyB,GAAa,WAAW,KAC7B1B,EAAQ0B,GAAa,WAAW,IAEhCC,IAAc,OAGdA,IAAcD,EAAY,WAAW,GAIvC9C,EAAW;AAAA,YACTN,EAAG,YAAY;AAAA,cACb4C;AAAA,cACA5C,EAAG,YAAY;AAAA,gBACba,EAAc,aAAaI,GAAKnB,CAAS;AAAA,cAC1C;AAAA,cACDE,EAAG,YAAY,QAAQoD,EAAY,QAAQ,GAAGC,CAAW;AAAA,YAC1D;AAAA,UACb;AAAA,QACS;AAAA,MACF;AAGP;AAEA,MAAeC,IAAA;AAAA,EACb,cAAA7D;AACF;"}
|
|
1
|
+
{"version":3,"file":"RDFconverter.mjs","sources":["../../../lib/data-provider-interface/utils/RDFconverter.js"],"sourcesContent":["import N3 from \"n3\";\nimport { isEmpty } from \"lodash\";\nimport { has } from \"lodash\";\n\nimport generalDpiConfig from \"../config/dpi-spec-config\";\n\nimport generalHelper from \"./general-helper\";\n\n/**\n * Converts all properties for given data from form input data into RDF (N-Triples)\n * @param {Object} data Data given within an object. Data stored as follows { datasets: {...}, distributions: [{...},...], catalogues: {...}}\n * @param {String} property Name of property which should be converted (either 'datasets' or 'catalogues')\n * @returns String of converted data in RDF format (N-Triples)\n */\nfunction convertToRDF(data, property, specification) {\n let finishedRDFdata;\n\n let dpiConfig = specification;\n\n // writer for adding data as quads\n const RDFdata = new N3.Writer({\n prefixes: dpiConfig.prefixes,\n format: \"N-Triples\",\n });\n // datasetURI also needed for distribution creation (add distributionURI to dataset (dcat:distribution))\n const datasetURI = `https://piveau.eu/set/data/${data.datasets.datasetID}`;\n\n // convert values for datasets/catalogues\n convertPropertyValues(\n RDFdata,\n data[property],\n property,\n \"\",\n \"\",\n true,\n datasetURI,\n dpiConfig\n ); // datasets and catalogues\n\n // include distribution data into same graph\n // differentiation neccessary because datasets also include distributions\n if (property === \"datasets\") {\n // multiple distributions possible -> [{data of distribution 1}, {data of distribution 2}, ...]\n for (let index = 0; index < data.distributions.length; index += 1) {\n convertPropertyValues(\n RDFdata,\n data.distributions[index],\n \"distributions\",\n \"\",\n \"\",\n true,\n datasetURI,\n dpiConfig\n );\n }\n }\n\n RDFdata.end((error, result) => (finishedRDFdata = result));\n return finishedRDFdata;\n}\n\n/**\n * Converts each single value of given form data based on type into RDF\n * @param {N3.Writer} RDFdataset Dataset the converted RDF data should be added to\n * @param {Object} data Object containing data as key-value pairs\n * @param {String} property String determining which property is handled (datasets/distributions/catalogues)\n * @param {DataFactory} preMainURI (can be undefined) Could be a namedNode or BlankNode containing an URI\n * @param {DataFactory} preMainType (can be undefined) NamedNode determining the type of the current property (e.g. dcat:Dataset (as object))\n * @param {Boolean} setMain Value determining if additional values should be set (type, id, sample...)\n * @param {String} datasetURI URI of dataset for use in distribution conversion\n */\nfunction convertPropertyValues(\n RDFdataset,\n data,\n property,\n preMainURI,\n preMainType,\n setMain,\n datasetURI,\n dpiConfig\n) {\n const formatTypes = dpiConfig.formatTypes;\n\n // method can be called recursively for nested properties\n // need to access id of parent node for later use as subject -> provide via method parameters (preMainURI & preMainType)\n let mainURI;\n let mainType;\n\n // parent method can be called recursively for nested values\n // if called on non-nested values a overall id and type muste be set (setMain -> true)\n if (setMain) {\n if (property === \"datasets\") {\n mainType = generalHelper.addNamespace(\"dcat:Dataset\", dpiConfig);\n mainURI = N3.DataFactory.namedNode(datasetURI); // datasetID should never be empty because of frontend checking\n } else if (property === \"catalogues\") {\n mainType = generalHelper.addNamespace(\"dcat:Catalog\", dpiConfig);\n mainURI = N3.DataFactory.namedNode(\n `https://piveau.eu/set/data/${data.datasetID}`\n ); // datasetID should never be empty because of frontend checking\n } else {\n mainType = generalHelper.addNamespace(\"dcat:Distribution\", dpiConfig);\n const randomId = generalHelper.makeId(10);\n // distribution id can be random, will be overwritten by backend on saving data\n mainURI = N3.DataFactory.namedNode(\n `https://piveau.eu/set/data/${randomId}`\n );\n }\n\n // parent method can be called recursively to convert nested values\n // but setting the overal type and id of a dataset/catalogue is only required once at the beginning\n // -> only set additional properties when setMain === true\n setAdditionalProperties(\n RDFdataset,\n data,\n mainURI,\n mainType,\n property,\n datasetURI,\n dpiConfig\n );\n } else {\n // called on nested properties with already given URI and type which should used in the following conversion process\n mainURI = preMainURI;\n mainType = preMainType;\n }\n\n // distributions may have download URLs, if no downloadURL is provided -> provided accessUrls will be also set as downloadUrls\n // accessUrl is a required property and therefore always provided (made sure by the frontend)\n // const downloadUrlsProvided = has(data, 'dcat:downloadURL') && !isEmpty(data['dcat:downloadURL']) && data['dcat:downloadURL'].map(el => !isEmpty(el['@id'])).reduce((a, b) => b);\n\n // loop trough all keys within data object and convert values (or nested values) to RDF\n const valueKeys = Object.keys(data);\n for (let index = 0; index < valueKeys.length; index += 1) {\n const key = valueKeys[index]; // key format: either a normal name for special properties (e.g. datasetID) or namespaced keys (e.g. dct:title)\n\n if (generalHelper.propertyHasValue(data[key])) {\n // all properties are sorted by their format (see .../data-provider-interface/config/format-types.js)\n // depending on the format the corresponding conversion-method is used, writing the result to the overall RDF-writer\n if (formatTypes.singularString[property].includes(key)) {\n convertSingularString(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.singularURI[property].includes(key)) {\n convertSingularURI(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.multipleURI[property].includes(key)) {\n // if no dowloadURL is provided, set accessUrls as downloadUrls\n // if (!downloadUrlsProvided && key === 'dcat:accessURL') {\n // // copy accessurl array to donwloadurl array and convert data\n\n // data['dcat:downloadURL'] = cloneDeep(data['dcat:accessURL']);\n // convertMultipleURI(RDFdataset, mainURI, data, 'dcat:downloadURL', property, dpiConfig);\n // }\n\n convertMultipleURI(RDFdataset, mainURI, data, key, property, dpiConfig);\n } else if (formatTypes.typedStrings[property].includes(key)) {\n convertTypedString(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.multilingualStrings[property].includes(key)) {\n convertMultilingual(RDFdataset, mainURI, data, key, dpiConfig);\n } else if (formatTypes.groupedProperties[property].includes(key)) {\n // grouped properties are properties provided by the form which consist of multiple properties (e.g contactPoint)\n // the properties values are stored within an object located within an array\n // for repeatable properties there are multiple objects in this array, otherwise there is just one\n\n let actualData;\n // vcard:hasAdress is an object as well as dct:creator and skos:notation\n if (\n key === \"vcard:hasAddress\" ||\n key === \"dct:creator\" ||\n key === \"skos:notation\" ||\n key === \"spdx:checksum\"\n )\n actualData = [data[key]];\n else actualData = data[key];\n\n // looping trough all existing objects within the array\n for (let groupId = 0; groupId < actualData.length; groupId += 1) {\n let currentGroupData = actualData[groupId];\n\n if (!isEmpty(currentGroupData)) {\n if (key === \"skos:notation\") {\n // property skos:notation work a little bit different then other properties\n // the form provides a value and a type from two seperated fields ({'@value': '...', '@type': '...'})\n // the resulting RDF should merge these values into a typed literal (value^^type)\n if (\n has(currentGroupData, \"@value\") &&\n !isEmpty(currentGroupData[\"@value\"])\n ) {\n let notationValue;\n\n // if a type is given, use to form typed literal\n // if no type is given, only use value to create literal\n if (\n has(currentGroupData, \"@type\") &&\n !isEmpty(currentGroupData[\"@type\"])\n ) {\n // typed literal\n notationValue = N3.DataFactory.literal(\n currentGroupData[\"@value\"],\n N3.DataFactory.namedNode(currentGroupData[\"@type\"].resource)\n );\n } else {\n // literal\n notationValue = N3.DataFactory.literal(\n currentGroupData[\"@value\"]\n );\n }\n\n // add type for adms:identifier\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"adms:Identifier\", dpiConfig)\n )\n )\n );\n\n // save quadruple with typed or untyped literal\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n notationValue\n )\n );\n\n // resulting rdf quads should look like this:\n // datasetId adms:identifier admsIdentifierUtl\n // admsIdentifierUrl rdf:type adms:Identifier\n // admsIdentifierUrl skos:notation value^^type\n }\n } else {\n let groupBlankNode;\n\n // because grouped properties have a list of nested properties we need an initial quadruple stating the parent property\n // using a blank node as object which later serves as subject for the nested properties\n // RDF example:\n // datasetID dct:contactPoint blankNodeId\n // blankNodeId foaf:mbox email@exmaple.com\n // blankNodeId fn:name InsitutionName ...\n\n // some form fields provide an URL which should serves as namedNode for other nested values (e.g. conformsTo)\n // RDF example:\n // datasetID dct:conformsTo conformsToURI\n // conformsToURI dct:title conformsTitle\n if (\n (key === \"foaf:page\" ||\n key === \"adms:identifier\" ||\n key === \"dct:conformsTo\") &&\n has(currentGroupData, \"@id\")\n ) {\n groupBlankNode = N3.DataFactory.namedNode(\n currentGroupData[\"@id\"]\n );\n }\n // all properties that don't provide an URL serving as namedNode for nested values need to define a blank node\n\n // page gets type but also has multilingual fields with preseleted langauge\n // don't create blank node if there is not data for page beside the preselected language\n let emptyPage = false;\n\n if (key === \"foaf:page\") {\n // if page has title and/or description property given, check if there are values given\n const hasTitle = has(currentGroupData, \"dct:title\");\n const hasDescription = has(currentGroupData, \"dct:description\");\n\n let hasNoValueKeysTitle = true;\n let hasEmptyValueTitle = true;\n let hasNoValueKeysDescription = true;\n let hasEmptyValueDescription = true;\n\n if (hasTitle) {\n hasNoValueKeysTitle = !currentGroupData[\"dct:title\"].every(\n (el) => has(el, \"@value\")\n );\n hasEmptyValueTitle = currentGroupData[\"dct:title\"].every(\n (el) => isEmpty(el[\"@value\"])\n );\n }\n\n if (hasDescription) {\n hasNoValueKeysDescription = !currentGroupData[\n \"dct:description\"\n ].every((el) => has(el, \"@value\"));\n hasEmptyValueDescription = currentGroupData[\n \"dct:description\"\n ].every((el) => isEmpty(el[\"@value\"]));\n }\n\n // page should be handled as empty if:\n // no title and/or no description given\n // if properties given: no value given or value empty\n if (\n (hasNoValueKeysTitle || hasEmptyValueTitle) &&\n (hasNoValueKeysDescription || hasEmptyValueDescription)\n )\n emptyPage = true;\n }\n\n if (!emptyPage) {\n if (!groupBlankNode)\n groupBlankNode = N3.DataFactory.blankNode(\"\");\n\n // save inital quadruple using the named or blank node as object\n // e.g. datasetId dct:contactPoint blankNode/namedNode\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n groupBlankNode\n )\n );\n\n // some properties provide additional types\n if (has(formatTypes.additionalPropertyTypes, key)) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n groupBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\n formatTypes.additionalPropertyTypes[key],\n dpiConfig\n )\n )\n )\n );\n }\n\n // temporal values nested inside another object: \"dct:temporal\": [{ \"dct:temporal\": { \"dcat:startDate\": \"...\", \"dcat:endDate\": \"...\" } }]\n if (key === \"dct:temporal\") {\n if (has(currentGroupData, \"dct:temporal\")) {\n currentGroupData = currentGroupData[\"dct:temporal\"];\n }\n }\n\n // convert all nested values provided by form\n convertPropertyValues(\n RDFdataset,\n currentGroupData,\n property,\n groupBlankNode,\n mainType,\n false,\n dpiConfig,\n dpiConfig\n );\n }\n }\n }\n }\n } else if (formatTypes.conditionalProperties[property].includes(key)) {\n // publisher either is an URI or a group with multiple values (name, homepage, email)\n // license either is an URI or a group with multiple values ()\n if (key === \"dct:publisher\" || key === \"dct:license\") {\n // data contains either {resource: '...', name: '...'} or object containing other keys\n if (has(data[key], \"resource\")) {\n convertSingularURI(RDFdataset, mainURI, data, key, dpiConfig);\n } else {\n const groupBlankNode = N3.DataFactory.blankNode(\"\");\n\n // some properties provide additional types\n if (has(formatTypes.additionalPropertyTypes, key)) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n groupBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\n formatTypes.additionalPropertyTypes[key],\n dpiConfig\n )\n )\n )\n );\n }\n\n // save inital quadruple using the named or blank node as object\n // e.g. datasetId dct:contactPoint blankNode/namedNode\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n groupBlankNode\n )\n );\n\n convertPropertyValues(\n RDFdataset,\n data[key],\n property,\n groupBlankNode,\n mainType,\n false,\n dpiConfig,\n dpiConfig\n );\n }\n }\n } else if (key === \"dcat:temporalResolution\") {\n // temporal resolution is displayed as group of input forms for each property (year, month, day, ...)\n // the form provides the data as following: [ { 'Year': '...', 'Month': '...', ... } ]\n // the final format of this property should look like this: P?Y?M?DT?H?M?S\n // not all values must be filled and therefore be present -> default behavior if not given: value = 0\n\n const resolutionValues = data[key];\n const valueString = `P${\n resolutionValues.Year ? resolutionValues.Year : 0\n }Y${resolutionValues.Month ? resolutionValues.Month : 0}M${\n resolutionValues.Day ? resolutionValues.Day : 0\n }DT${resolutionValues.Hour ? resolutionValues.Hour : 0}H${\n resolutionValues.Minute ? resolutionValues.Minute : 0\n }M${resolutionValues.Second ? resolutionValues.Second : 0}S`;\n\n // frontend always provides temporalResolution even if there is no value resulting in P0Y0M0DT0H0M0S\n // don't save if value is equal to P0Y0M0DT0H0M0S\n if (valueString !== \"P0Y0M0DT0H0M0S\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(\n valueString,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"xsd:duration\", dpiConfig)\n )\n )\n )\n );\n }\n } else if (key === \"dct:identifier\") {\n // form provides data as array of objects with strings: [ { '@value': 'string1' }, { '@value': 'string2' }, ... ]\n // create quadruple for each given object in the array\n for (let valueId = 0; valueId < data[key].length; valueId += 1) {\n const currentValue = data[key][valueId];\n if (has(currentValue, \"@value\") && !isEmpty(currentValue[\"@value\"])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(currentValue[\"@value\"])\n )\n );\n }\n }\n } else if (key === \"dct:rights\") {\n // rights has a static type (RightsStatement) which needs to be added to linked data as additional node\n // therefore we need to create an initial quadruple for with 'rights' being the predicate having a blank node\n // blank node serves as subject for the following quadruples which contain the type and actual value of the form field\n // RDF:\n // datasetID dct:rights blankNodeID\n // blankNodeId rdf:type RightsStatement\n // blankNodeId rdfs:label LabelValue\n\n // blank node as object for inital quadruple and also as subject for following quadruples\n const rightsBlankNode = N3.DataFactory.blankNode(\"\");\n\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n rightsBlankNode\n )\n );\n\n // add additional type declaration\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n rightsBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dct:RightsStatement\", dpiConfig)\n )\n )\n );\n\n // rights is a conditional property and provides either an URI or a string ( { rdfs:label : 'URL/string' } )\n let rightsValue;\n\n if (data[key][\"@type\"] === \"url\") {\n rightsValue = N3.DataFactory.namedNode(data[key][\"rdfs:label\"]);\n } else {\n rightsValue = N3.DataFactory.literal(data[key][\"rdfs:label\"]);\n }\n\n // add actual value\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n rightsBlankNode,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdfs:label\", dpiConfig)\n ),\n rightsValue\n )\n );\n }\n }\n }\n}\n\n/**\n * Creates additional quads depending on given property and saves them to given RDF dataset\n * @param {N3.Writer} RDFdataset RDF dataset the quads are saved to\n * @param {Object} data Object containing data as key-value pairs\n * @param {DataFactory.namedNode} mainURI NamedNode defining URI of current property graph\n * @param {DataFactory} mainType NamedNode defining type of current property graph\n * @param {String} property String determining which property is converted (datasets/distributions/catalogues)\n * @param {String} datasetURI URI of dataset used to add distribution URI to dct:distribution within dataset graph\n */\nfunction setAdditionalProperties(\n RDFdataset,\n data,\n mainURI,\n mainType,\n property,\n datasetURI,\n dpiConfig\n) {\n // adding id and type of property\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"rdf:type\", dpiConfig)\n ),\n N3.DataFactory.namedNode(mainType)\n )\n );\n\n // catalogues always have to contain the property dct:type with the value 'dcat-ap'\n if (property === \"catalogues\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n mainURI,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dct:type\", dpiConfig)\n ),\n N3.DataFactory.literal(\"dcat-ap\")\n )\n );\n }\n\n // add distribution id to dataset graph (dcat:distribution)\n if (property === \"distributions\") {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n N3.DataFactory.namedNode(datasetURI),\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"dcat:distribution\", dpiConfig)\n ),\n mainURI\n )\n );\n }\n}\n\n//-----------------------------------------------------------------------------------------------------\n// basic conversion (input to RDF) methods for different categories of data\n//-----------------------------------------------------------------------------------------------------\n// seems unnecessary at first but if we want to convert nested properties as well, we need these\n// methods (especially to provide the correct parent URI)\n\n/**\n * Converts provided data to quad and saves it to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data Data given by form used as object in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad\n */\nfunction convertSingularString(RDFdataset, id, data, key, dpiConfig) {\n if (!isEmpty(data[key])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key])\n )\n );\n }\n}\n\n/**\n * Converts provided data to quad and saves it to given dataset\n * @param {N3.Writer} RDFdata Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data Data given by form used as object in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad\n */\nfunction convertSingularURI(RDFdataset, id, data, key, dpiConfig) {\n // there are two different formats the frontend delivers URIs\n // 1: 'URI' or 2: {'name': 'abc', 'resource': 'URI'}\n\n // URIs can either be a normal URL or an email address\n // mail addresses typicall include '@' which is used to determine if the given string is a normal URL or an email address\n if (!isEmpty(data[key])) {\n let singleURI;\n\n if (typeof data[key] === \"object\") {\n if (has(data[key], \"resource\")) {\n singleURI = data[key].resource;\n }\n } else {\n if (data[key].includes(\"@\")) {\n // mail address\n singleURI = `mailto:${data[key]}`;\n } else {\n // normal URL\n singleURI = data[key];\n }\n }\n\n // save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.namedNode(singleURI)\n )\n );\n }\n}\n\n/**\n * Converts provided data to quads and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quads\n * @param {Array} data Array containing URLs used as object within quads\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quads\n * @param {String} property Determining which property is concerted (datasets/distributions/catalogues)\n */\nfunction convertMultipleURI(RDFdataset, id, data, key, property, dpiConfig) {\n // there are two different formats the frontend delivers multiple URIs\n // 1: [ {\"name\": '...', \"resource\": 'URI'}, {...} ] -> multi-autocomplete fields\n // 2: [ { \"@id\": \"URI1\" }, { \"@id\": \"URI2\" } ] repeatable fields\n\n for (let uriIndex = 0; uriIndex < data[key].length; uriIndex += 1) {\n let currentURI;\n const valueObject = data[key][uriIndex];\n if (!isEmpty(valueObject)) {\n if (has(valueObject, \"resource\")) currentURI = valueObject.resource;\n else if (has(valueObject, \"@id\")) currentURI = valueObject[\"@id\"];\n }\n\n // save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.namedNode(currentURI)\n )\n );\n }\n}\n\n/**\n * Converts provided data to quad and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quad\n * @param {String} data String data used as object with type in quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quad and to determine quad-object type\n */\nfunction convertTypedString(RDFdataset, id, data, key, dpiConfig) {\n if (!isEmpty(data[key])) {\n // there is a variety of properties which can have different types\n // issued and motified already provide a type definition ({'@type': 'date/datetime', '@value': '...'})\n if (key === \"dct:issued\" || key === \"dct:modified\") {\n if (has(data[key], \"@value\") && !isEmpty(data[key][\"@value\"])) {\n const imValueType =\n data[key][\"@type\"] === \"date\" ? data[key][\"@type\"] : \"dateTime\";\n const valueType = generalHelper.addNamespace(\n `xsd:${imValueType}`,\n dpiConfig\n );\n\n /// save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(\n data[key][\"@value\"],\n N3.DataFactory.namedNode(valueType)\n )\n )\n );\n }\n } else {\n // all other properties are given as a simple string\n let valueType;\n if (key === \"dcat:endDate\" || key === \"dcat:startDate\") {\n // dcat:endDate and dcat:startDate are xsd:dateTime\n valueType = generalHelper.addNamespace(\"xsd:dateTime\", dpiConfig);\n } else if (\n key === \"dcat:spatialResolutionInMeters\" ||\n key === \"dcat:byteSize\"\n ) {\n // dcat:spatialResolutionInMeters and dcat:byteSize are xsd:decimal\n valueType = generalHelper.addNamespace(\"xsd:decimal\", dpiConfig);\n } else if (key === \"pv:distributionType\") {\n valueType = generalHelper.addNamespace(\"xsd:string\", dpiConfig);\n if (\n data[key][\"@Tag\"] === \"LeadingWidget\" ||\n data[key][\"lead\"] === \"true\"\n ) {\n data[key] = \"Widget\";\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(\"pv:isLeading\", dpiConfig)\n ),\n N3.DataFactory.literal(true)\n )\n );\n }\n if (data[key][\"@Tag\"] === \"Widget\") {\n data[key] = \"Widget\";\n } else data[key] = data[key];\n }\n\n /// save quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key], N3.DataFactory.namedNode(valueType))\n )\n );\n }\n }\n}\n\n/**\n * Converts provided data to quads and saves them to given dataset\n * @param {N3.Writer} RDFdataset Dataset the converter saves the converted data to\n * @param {DataFactory} id Node (Blank or Named) used as subject in quads\n * @param {Array} data Array of objects containing data and language converted into literal with language for quad\n * @param {String} key Name of current value (e.g. dct:title) used as predicate in quads\n */\nfunction convertMultilingual(RDFdataset, id, data, key, dpiConfig) {\n // multilingual fields mostly provide data as followed\n // [ { '@value': '....', '@language': '...' }, ... ]\n // only the licence title provides no language\n\n if (!isEmpty(data[key])) {\n // licence title\n if (!Array.isArray(data[key])) {\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(generalHelper.addNamespace(key, dpiConfig)),\n N3.DataFactory.literal(data[key])\n )\n );\n } else {\n for (let langIndex = 0; langIndex < data[key].length; langIndex += 1) {\n const currentData = data[key][langIndex];\n // only save data if a value is given (forntend provides preselected language which don't need to be saved if there is no actaul value)\n if (\n !isEmpty(currentData) &&\n has(currentData, \"@value\") &&\n !isEmpty(currentData[\"@value\"])\n ) {\n let languageTag;\n\n // if there is no langauge given, set language to english\n if (\n !has(currentData, \"@language\") ||\n isEmpty(currentData, \"@language\")\n ) {\n languageTag = \"en\";\n } else {\n // if language is given, use given tag\n languageTag = currentData[\"@language\"];\n }\n\n // saving quad to dataset\n RDFdataset.addQuad(\n N3.DataFactory.quad(\n id,\n N3.DataFactory.namedNode(\n generalHelper.addNamespace(key, dpiConfig)\n ),\n N3.DataFactory.literal(currentData[\"@value\"], languageTag)\n )\n );\n }\n }\n }\n }\n}\n\nexport default {\n convertToRDF,\n};\n"],"names":["convertToRDF","data","property","specification","finishedRDFdata","dpiConfig","RDFdata","N3","datasetURI","convertPropertyValues","index","error","result","RDFdataset","preMainURI","preMainType","setMain","formatTypes","mainURI","mainType","generalHelper","randomId","setAdditionalProperties","valueKeys","key","convertSingularString","convertSingularURI","convertMultipleURI","convertTypedString","convertMultilingual","actualData","groupId","currentGroupData","isEmpty","has","notationValue","groupBlankNode","emptyPage","hasTitle","hasDescription","hasNoValueKeysTitle","hasEmptyValueTitle","hasNoValueKeysDescription","hasEmptyValueDescription","el","resolutionValues","valueString","valueId","currentValue","rightsBlankNode","rightsValue","id","singleURI","uriIndex","currentURI","valueObject","imValueType","valueType","langIndex","currentData","languageTag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D,EAAY,QAAQ,GAAGC,CAAW;AAAA,YAC1D;AAAA,UACb;AAAA,QACS;AAAA,MACF;AAGP;AAEA,MAAeC,IAAA;AAAA,EACb,cAAA7D;AACF;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import m from "./general-helper.mjs";
|
|
2
2
|
import "lodash-es";
|
|
3
|
-
async function
|
|
4
|
-
let a,
|
|
3
|
+
async function p(i, e, t, n) {
|
|
4
|
+
let a, o, c;
|
|
5
5
|
e === "datasets" ? c = t.match(
|
|
6
6
|
null,
|
|
7
7
|
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
@@ -12,21 +12,21 @@ async function I(i, e, t, s) {
|
|
|
12
12
|
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
|
|
13
13
|
"http://www.w3.org/ns/dcat#Catalog",
|
|
14
14
|
null
|
|
15
|
-
),
|
|
15
|
+
), o = m.getPagePrefixedNames(
|
|
16
16
|
e,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
n.inputDefinition,
|
|
18
|
+
n.pageConent
|
|
19
19
|
), i[e] = {};
|
|
20
20
|
for (let v of c) {
|
|
21
21
|
a = v.subject.value;
|
|
22
|
-
for (let b in
|
|
22
|
+
for (let b in o[e])
|
|
23
23
|
i[e][b] = {}, g(
|
|
24
24
|
e,
|
|
25
25
|
i[e][b],
|
|
26
26
|
a,
|
|
27
27
|
t,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
o[e][b],
|
|
29
|
+
n
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
if (e === "datasets") {
|
|
@@ -36,58 +36,58 @@ async function I(i, e, t, s) {
|
|
|
36
36
|
null,
|
|
37
37
|
null
|
|
38
38
|
);
|
|
39
|
-
|
|
39
|
+
o = m.getPagePrefixedNames(
|
|
40
40
|
"distributions",
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
n.inputDefinition,
|
|
42
|
+
n.pageConent
|
|
43
43
|
), i.datasets.Distributions.distributionList = [];
|
|
44
44
|
for (let b of v) {
|
|
45
45
|
const l = {}, u = b.object.value;
|
|
46
|
-
for (let
|
|
47
|
-
l[
|
|
46
|
+
for (let s in o.distributions)
|
|
47
|
+
l[s] = {}, g(
|
|
48
48
|
"distributions",
|
|
49
|
-
l[
|
|
49
|
+
l[s],
|
|
50
50
|
u,
|
|
51
51
|
t,
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
o.distributions[s],
|
|
53
|
+
n
|
|
54
54
|
);
|
|
55
55
|
i.datasets.Distributions.distributionList.push(l);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
function g(i, e, t,
|
|
59
|
+
function g(i, e, t, n, a, o) {
|
|
60
60
|
var v;
|
|
61
|
-
const c =
|
|
61
|
+
const c = o.formatTypes;
|
|
62
62
|
for (let b = 0; b < a.length; b += 1) {
|
|
63
63
|
const l = a[b];
|
|
64
|
-
let u =
|
|
64
|
+
let u = n.match(
|
|
65
65
|
t,
|
|
66
|
-
m.addNamespace(l,
|
|
66
|
+
m.addNamespace(l, o),
|
|
67
67
|
null,
|
|
68
68
|
null
|
|
69
69
|
);
|
|
70
70
|
if (c.singularString[i].includes(l))
|
|
71
|
-
|
|
71
|
+
I(u, e, l);
|
|
72
72
|
else if (c.singularURI[i].includes(l))
|
|
73
|
-
T(u, e, l,
|
|
73
|
+
T(u, e, l, o);
|
|
74
74
|
else if (c.multipleURI[i].includes(l))
|
|
75
|
-
N(u, e, l, i,
|
|
75
|
+
N(u, e, l, i, o);
|
|
76
76
|
else if (c.typedStrings[i].includes(l))
|
|
77
77
|
S(u, e, l);
|
|
78
78
|
else if (c.multilingualStrings[i].includes(l))
|
|
79
79
|
D(u, e, l);
|
|
80
80
|
else if (c.conditionalProperties[i].includes(l)) {
|
|
81
81
|
if (l === "dct:publisher" || l === "dct:license") {
|
|
82
|
-
for (let
|
|
83
|
-
if (
|
|
84
|
-
e[l] = { name:
|
|
85
|
-
else if (
|
|
86
|
-
const f = m.getNestedKeys(
|
|
82
|
+
for (let s of u)
|
|
83
|
+
if (s.object.termType === "NamedNode")
|
|
84
|
+
e[l] = { name: s.object.value, resource: s.object.value };
|
|
85
|
+
else if (s.object.termType === "BlankNode") {
|
|
86
|
+
const f = m.getNestedKeys(n.match(s.object, null, null, null), o).filter((r) => r !== "dct:title"), d = {};
|
|
87
87
|
if (l === "dct:license") {
|
|
88
|
-
const r =
|
|
89
|
-
|
|
90
|
-
m.addNamespace("dct:title",
|
|
88
|
+
const r = n.match(
|
|
89
|
+
s.object,
|
|
90
|
+
m.addNamespace("dct:title", o),
|
|
91
91
|
null,
|
|
92
92
|
null
|
|
93
93
|
);
|
|
@@ -97,36 +97,36 @@ function g(i, e, t, s, a, n) {
|
|
|
97
97
|
g(
|
|
98
98
|
i,
|
|
99
99
|
d,
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
s.object,
|
|
101
|
+
n,
|
|
102
102
|
f,
|
|
103
|
-
|
|
103
|
+
o
|
|
104
104
|
), e[l] = d;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
} else if (c.groupedProperties[i].includes(l)) {
|
|
108
108
|
if (u.size > 0) {
|
|
109
109
|
e[l] = [];
|
|
110
|
-
for (let
|
|
110
|
+
for (let s of u) {
|
|
111
111
|
let f = {};
|
|
112
112
|
if (l === "skos:notation")
|
|
113
|
-
|
|
114
|
-
name:
|
|
115
|
-
resource:
|
|
113
|
+
s.object.value && (f["@value"] = s.object.value), s.object.datatypeString && (f["@type"] = {
|
|
114
|
+
name: s.object.datatypeString,
|
|
115
|
+
resource: s.object.datatypeString
|
|
116
116
|
});
|
|
117
117
|
else {
|
|
118
|
-
|
|
118
|
+
s.object.termType === "NamedNode" && (f["@id"] = s.object.value);
|
|
119
119
|
const d = m.getNestedKeys(
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
n.match(s.object, null, null, null),
|
|
121
|
+
o
|
|
122
122
|
);
|
|
123
123
|
g(
|
|
124
124
|
i,
|
|
125
125
|
f,
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
s.object,
|
|
127
|
+
n,
|
|
128
128
|
d,
|
|
129
|
-
|
|
129
|
+
o
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
l === "dct:creator" || l === "vcard:hasAddress" || l === "skos:notation" || l === "spdx:checksum" ? e[l] = f : e[l].push(f);
|
|
@@ -135,7 +135,7 @@ function g(i, e, t, s, a, n) {
|
|
|
135
135
|
} else if (l === "dcat:temporalResolution") {
|
|
136
136
|
if (u.size > 0) {
|
|
137
137
|
e[l] = {};
|
|
138
|
-
const
|
|
138
|
+
const s = ["Y", "M", "D", "H", "M", "S"], f = {
|
|
139
139
|
0: "Year",
|
|
140
140
|
1: "Month",
|
|
141
141
|
2: "Day",
|
|
@@ -147,8 +147,8 @@ function g(i, e, t, s, a, n) {
|
|
|
147
147
|
for (let r of u)
|
|
148
148
|
d = r.object.value;
|
|
149
149
|
if (d.startsWith("P"))
|
|
150
|
-
for (let r = 0; r <
|
|
151
|
-
const j = d.indexOf(
|
|
150
|
+
for (let r = 0; r < s.length; r += 1) {
|
|
151
|
+
const j = d.indexOf(s[r]), h = d.substring(0, j), w = ((v = h == null ? void 0 : h.match(/\d+/g)) == null ? void 0 : v[0]) ?? "";
|
|
152
152
|
d = d.substring(j), e[l][f[r]] = w;
|
|
153
153
|
}
|
|
154
154
|
else {
|
|
@@ -160,21 +160,21 @@ function g(i, e, t, s, a, n) {
|
|
|
160
160
|
} else if (l === "dct:identifier") {
|
|
161
161
|
if (u.size > 0) {
|
|
162
162
|
e[l] = [];
|
|
163
|
-
for (let
|
|
164
|
-
e[l].push({ "@value":
|
|
163
|
+
for (let s of u)
|
|
164
|
+
e[l].push({ "@value": s.object.value });
|
|
165
165
|
}
|
|
166
166
|
} else if (l === "dct:rights") {
|
|
167
167
|
if (u.size > 0) {
|
|
168
|
-
let
|
|
168
|
+
let s;
|
|
169
169
|
for (let f of u) {
|
|
170
170
|
const d = f.object;
|
|
171
|
-
|
|
171
|
+
s = n.match(
|
|
172
172
|
d,
|
|
173
|
-
m.addNamespace("rdfs:label",
|
|
173
|
+
m.addNamespace("rdfs:label", o),
|
|
174
174
|
null,
|
|
175
175
|
null
|
|
176
176
|
);
|
|
177
|
-
for (let r of
|
|
177
|
+
for (let r of s)
|
|
178
178
|
m.isUrl(r.object.value) ? e[l] = { "@type": "url", "rdfs:value": r.object.value } : e[l] = {
|
|
179
179
|
"@type": "text",
|
|
180
180
|
"rdfs:value": r.object.value
|
|
@@ -184,75 +184,74 @@ function g(i, e, t, s, a, n) {
|
|
|
184
184
|
} else if (l === "datasetID" && i !== "datatsets")
|
|
185
185
|
e[l] = t.substr(t.lastIndexOf("/") + 1), e.hidden_datasetIDFormHidden = t.substr(t.lastIndexOf("/") + 1);
|
|
186
186
|
else if (l === "dcat:catalog" && i === "datasets") {
|
|
187
|
-
u.size > 0 || (u =
|
|
188
|
-
for (let
|
|
189
|
-
e[l] =
|
|
190
|
-
} else if (l === "rdf:type") {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
} else
|
|
200
|
-
l === "pv:distributionType" && console.log(e[l]);
|
|
187
|
+
u.size > 0 || (u = n.match(t, "dcat:catalog", null, null)), e[l] = "";
|
|
188
|
+
for (let s of u)
|
|
189
|
+
e[l] = s.object.value;
|
|
190
|
+
} else if (l === "rdf:type" && u.size > 0) {
|
|
191
|
+
e[l] = "";
|
|
192
|
+
for (let s of u)
|
|
193
|
+
e[l] = m.removeNamespace(
|
|
194
|
+
s.object.value,
|
|
195
|
+
o
|
|
196
|
+
);
|
|
197
|
+
}
|
|
201
198
|
}
|
|
202
199
|
}
|
|
203
|
-
function
|
|
200
|
+
function I(i, e, t) {
|
|
204
201
|
if (i.size > 0) {
|
|
205
202
|
e[t] = "";
|
|
206
|
-
for (let
|
|
207
|
-
e[t] =
|
|
203
|
+
for (let n of i)
|
|
204
|
+
e[t] = n.object.value;
|
|
208
205
|
}
|
|
209
206
|
}
|
|
210
|
-
function T(i, e, t,
|
|
211
|
-
const a =
|
|
207
|
+
function T(i, e, t, n) {
|
|
208
|
+
const a = n.formatTypes;
|
|
212
209
|
if (i.size > 0) {
|
|
213
210
|
e[t] = "";
|
|
214
|
-
for (let
|
|
215
|
-
const c =
|
|
211
|
+
for (let o of i) {
|
|
212
|
+
const c = o.object.value;
|
|
216
213
|
c.startsWith("mailto:") ? e[t] = c.replace("mailto:", "") : a.URIformat.voc.includes(t) ? e[t] = { name: c, resource: c } : a.URIformat.string.includes(t) ? e[t] = c : e[t] = { "@id": c };
|
|
217
214
|
}
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
|
-
function N(i, e, t,
|
|
221
|
-
const
|
|
217
|
+
function N(i, e, t, n, a) {
|
|
218
|
+
const o = a.formatTypes;
|
|
222
219
|
if (i.size > 0) {
|
|
223
220
|
e[t] = [];
|
|
224
221
|
for (let c of i)
|
|
225
|
-
|
|
222
|
+
o.URIformat.voc.includes(t) ? e[t].push({ name: c.object.value, resource: c.object.value }) : o.URIformat.string.includes(t) ? e[t].push(c.object.value) : e[t].push({ "@id": c.object.value });
|
|
226
223
|
}
|
|
227
224
|
}
|
|
228
225
|
function S(i, e, t) {
|
|
229
226
|
if (i.size > 0) {
|
|
230
227
|
e[t] = "";
|
|
231
|
-
for (let
|
|
228
|
+
for (let n of i)
|
|
232
229
|
if (t === "dcat:spatialResolutionInMeters" || t === "dcat:byteSize")
|
|
233
|
-
e[t] =
|
|
230
|
+
e[t] = n.object.value;
|
|
234
231
|
else if (t === "dcat:startDate" || t === "dcat:endDate")
|
|
235
|
-
e[t] =
|
|
232
|
+
e[t] = n.object.value;
|
|
236
233
|
else if (t === "pv:distributionType")
|
|
237
|
-
e[t] =
|
|
234
|
+
e[t] = { "@Tag": n.object.value };
|
|
235
|
+
else if (t === "pv:isLeading")
|
|
236
|
+
e["pv:distributionType"].lead = n.object.value;
|
|
238
237
|
else {
|
|
239
238
|
let a;
|
|
240
|
-
|
|
239
|
+
n.object.value.includes("T") ? a = "dateTime" : a = "date", e[t] = { "@type": a, "@value": n.object.value };
|
|
241
240
|
}
|
|
242
241
|
}
|
|
243
242
|
}
|
|
244
243
|
function D(i, e, t) {
|
|
245
244
|
if (i.size > 0) {
|
|
246
245
|
e[t] = [];
|
|
247
|
-
for (let
|
|
248
|
-
if (!
|
|
246
|
+
for (let n of i)
|
|
247
|
+
if (!n.object.language.includes("-")) {
|
|
249
248
|
const a = {};
|
|
250
|
-
a["@value"] =
|
|
249
|
+
a["@value"] = n.object.value, a["@language"] = n.object.language, e[t].push(a);
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
const R = {
|
|
255
|
-
convertToInput:
|
|
254
|
+
convertToInput: p
|
|
256
255
|
};
|
|
257
256
|
export {
|
|
258
257
|
R as default
|