diff --git a/CHANGELOG.md b/CHANGELOG.md index f136f11a427800e55242b7bdae4dd0ae26fc3f07..8240dd195599e4be774a53c06fb15295a5c9cf3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,30 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [2.0.0] +## [Unreleased] + +### Removed + +- Removed Travis CI `bin/` directory, along with all associated Travis CI configuration files and scripts. +- Removed the functionality that retrieved the current commit hash of the checked out Git repository for the extension. The commit hash was previously inserted into a custom API resource to provide external developers repository information. +- Removed `ckanext.odsh.home` configuration variable. +- The `tag_name_validator` function, responsible for validating tag names, has been removed. Tag names are no longer restricted by any validation checks, allowing for unrestricted input (according [DCAT-AP](https://www.dcat-ap.de/def/dcatde/2.0/spec/#datensatz-schlagwort)). +- Removed `ckanext.odsh.upload_formats` configuration variable. Upload formats are now populated by EU-approved file formats. +- Removed subject mappings and other subject related code used in Transparenzportal SH (TPSH). + +### Changed + +- Reorganized default mapping and resource files for improved organization and maintenance. Mapping and config files (e.g., file formats) are now located in `ckanext/odsh/resources/`. +- Refactor distribution/resource editing form to replace free-text format field with select field populated by EU-approved file formats. +- Reorganized tests and helper TPSH specific code +- Migrated TPSH helpers to `helpers.py`. +- Moved TPSH tests to `tests/` and legacy tests to `tests_wip`. + +## [2.0.0] - 2023-06-08 ### Added -- Custom robots.txt file. +- Custom `robots.txt` file. ### Changed diff --git a/README.md b/README.md index 4bc711a8965a5adaaaa6597c508ffd7d3947d540..f02bba0fd0bd64e504ec89b0ccfdc622e0c17276 100644 --- a/README.md +++ b/README.md @@ -87,20 +87,21 @@ the config file is located at `/etc/ckan/default/production.ini`). The extension requires configuration parameters in the CKAN configuration file (e.g., `production.ini`). The following parameters should be set: -Parameter | Type | Description ---------- | ----- | ----------- -ckanext.odsh.home | `string` | Absolute path to base directory, e.g., `/usr/lib/ckan/default/src/ckanext-odsh`. -ckanext.odsh.public_url | `string` | The public URL, e.g., `https://opendata.schleswig-holstein.de`. -ckanext.odsh.showtestbanner | `boolean` | `true` switches on the banner "test system". Must be `false` for production server. -ckanext.odsh.language_mapping | `string` | Absolute path to language mapping file, e.g., `/usr/lib/ckan/default/src/ckanext-odsh/language_mapping.json`. -ckanext.odsh.subject_mapping | `string` | Absolute path to subject mapping file, e.g., `/usr/lib/ckan/default/src/ckanext-odsh/subject_mapping.json`. -ckanext.odsh.spatial.mapping | `string` | Absolute path to spatial mapping file, e.g., `/usr/lib/ckan/default/src/odsh-odsh/schleswig-holstein_geojson.csv`. -ckanext.odsh.resource_formats_fallback_filepath | `string` | Absolute path to resource formats fallback file, e.g., `/usr/lib/ckan/default/src/ckanext-odsh/fileformats.rdf` -ckanext.odsh.upload_formats | `string` | E.g., `pdf`. -ckanext.odsh.require_at_least_one_category | `boolean` | E.g., `True`. -ckanext.odsh.require_spatial_uri | `boolean` | E.g., `True`. -ckanext.odsh.require_subject | `boolean` | E.g., `False`. -ckanext.odsh.is_optional_temporal_start | `boolean` | E.g., `False`. +Parameter | Type | Default | Description +--------- | ---- | ------- | ----------- +`ckanext.odsh.public_url` | `string` | - | The public URL, e.g., `https://opendata.schleswig-holstein.de`. +`ckanext.odsh.showtestbanner` | `boolean` | `True` | Switches on the banner "test system". Must be `false` for production server. +`ckanext.odsh.language_mapping` | `string` | `/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/resources/language_mapping.json` | Absolute path to language mapping file. +`ckanext.odsh.spatial.mapping` | `string` | `/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/resources/schleswig-holstein_geojson.csv` | Absolute path to spatial mapping file. The mapping file is expected to be a tab-separated file with three columns: URI, spatial text, and JSON geometry. +`ckanext.odsh.resource_formats_fallback_filepath` | `string` | `/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/resources/fileformats.rdf` | Absolute path to resource formats fallback file. +`ckanext.odsh.require_at_least_one_category` | `boolean` | `False` | Indicates whether the presence of at least one category is required during validation. +`ckanext.odsh.require_spatial_uri` | `boolean` | `False` | Indicates whether a spatial URI is required for the dataset. +`ckanext.odsh.is_optional_temporal_start` | `boolean` | `False` | Indicate whether the `temporal_start` property is considered optional or not during validation. +`ckanext.odsh.download_proxy` | `string` | `None` | Use proxy server to access the web, e.g., `http://1.2.3.4:4123`. +`copy_remote_resources` | `boolean` | `False` | Indicates whether remote resources should be copied when creating a resource. +`ckanext.odsh.lenient_with` | `string` | Empty string | Comma seperated list of organization IDs for which certain validations should be more lenient, e.g., `09871195-cd0a-4767-9396-276404c940d9,6389d8d9-4eed-472f-9220-4cc2dd82fb90`. +`ckanext.odsh.testuser` | `string` | `None` | Name of user for testing. +`ckanext.odsh.testuserpass` | `string` | `None` | Password of user for testing. ### Testing @@ -117,13 +118,10 @@ test suite is provided. You can follow the instructions below to run the tests: ```sh pytest ckanext/odsh/tests/ - pytest ckanext/odsh/tests_tpsh/ ``` Running these commands will initiate the test suite, which will automatically execute -various test cases and verify the expected behavior of the extension. The tests are -organized into two directories: `tests` and `tests_tpsh`, each containing different -sets of tests. +various test cases and verify the expected behavior of the extension. ### Internationalization diff --git a/bin/travis-build.bash b/bin/travis-build.bash deleted file mode 100644 index b97c6106d9a778d1d2713438e9fa802d0070b404..0000000000000000000000000000000000000000 --- a/bin/travis-build.bash +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -set -e - -echo "This is travis-build.bash..." - -echo "Installing the packages that CKAN requires..." -sudo apt-get update -qq -sudo apt-get install solr-jetty - -echo "Installing CKAN and its Python dependencies..." -git clone https://github.com/ckan/ckan -cd ckan -export latest_ckan_release_branch=`git branch --all | grep remotes/origin/release-v | sort -r | sed 's/remotes\/origin\///g' | head -n 1` -echo "CKAN branch: $latest_ckan_release_branch" -git checkout $latest_ckan_release_branch -python setup.py develop -pip install -r requirements.txt --allow-all-external -pip install -r dev-requirements.txt --allow-all-external -cd - - -echo "Creating the PostgreSQL user and database..." -sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';" -sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;' - -echo "SOLR config..." -# Solr is multicore for tests on ckan master, but it's easier to run tests on -# Travis single-core. See https://github.com/ckan/ckan/issues/2972 -sed -i -e 's/solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' ckan/test-core.ini - -echo "Initialising the database..." -cd ckan -paster db init -c test-core.ini -cd - - -echo "Installing ckanext-odsh and its requirements..." -python setup.py develop -pip install -r dev-requirements.txt - -echo "Moving test.ini into a subdir..." -mkdir subdir -mv test.ini subdir - -echo "travis-build.bash is done." \ No newline at end of file diff --git a/bin/travis-run.sh b/bin/travis-run.sh deleted file mode 100644 index f6e6a6c8c8e95cb31e5ce367d935e935b238251b..0000000000000000000000000000000000000000 --- a/bin/travis-run.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -e - -echo "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty -sudo cp ckan/ckan/config/solr/schema.xml /etc/solr/conf/schema.xml -sudo service jetty restart - -nosetests --ckan \ - --nologcapture \ - --with-pylons=subdir/test.ini \ - --with-coverage \ - --cover-package=ckanext.odsh \ - --cover-inclusive \ - --cover-erase \ - --cover-tests diff --git a/ckanext/odsh/fanstatic/odsh.css b/ckanext/odsh/fanstatic/odsh.css index 5a21b2a6ff9c9e636e7e5ebf4bd4405be51a49ca..41139e9fa5c6878a2500f9e4846549c1876f111e 100644 --- a/ckanext/odsh/fanstatic/odsh.css +++ b/ckanext/odsh/fanstatic/odsh.css @@ -3075,7 +3075,7 @@ body.filters-modal div.row>aside.secondary.span3 { } } -.tpsh-collection-list { +.odsh-collection-list { list-style-type: none; } diff --git a/ckanext/odsh/fanstatic/odsh_guessformat.js b/ckanext/odsh/fanstatic/odsh_guessformat.js index 3efcbff85782b72b22f5dadc325a364ef6022ecf..c55d478a79fb68f1346950da02fb146a8ad0c6dc 100644 --- a/ckanext/odsh/fanstatic/odsh_guessformat.js +++ b/ckanext/odsh/fanstatic/odsh_guessformat.js @@ -1,13 +1,13 @@ ckan.module('odsh_guessformat', function ($) { - let known_formats = ['pdf', 'rdf', 'txt', 'doc', 'csv'] + let known_formats = ['PDF', 'RDF', 'TXT', 'DOC', 'CSV'] let c = $('#field-format') let onChange = function (filename) { - let ext = filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(); + let ext = filename.slice((filename.lastIndexOf(".") - 1 >>> 0) + 2).toUpperCase(); if (ext !== undefined && known_formats.indexOf(ext) > -1) { c.val(ext.toUpperCase()) diff --git a/ckanext/odsh/fanstatic/tpsh_toggle_menu.js b/ckanext/odsh/fanstatic/odsh_toggle_menu.js similarity index 91% rename from ckanext/odsh/fanstatic/tpsh_toggle_menu.js rename to ckanext/odsh/fanstatic/odsh_toggle_menu.js index 1a8a8c82d0f4849ca49b8bf525247cca7cdbf755..876b3f8740ae4f021a8969a01562259722339619 100644 --- a/ckanext/odsh/fanstatic/tpsh_toggle_menu.js +++ b/ckanext/odsh/fanstatic/odsh_toggle_menu.js @@ -1,6 +1,6 @@ "use strict"; -ckan.module('tpsh_toggle_menu', function ($) { +ckan.module('odsh_toggle_menu', function ($) { return { initialize: function () { $.proxyAll(this, /_on/); diff --git a/ckanext/odsh/fanstatic/tpsh_validate_password.js b/ckanext/odsh/fanstatic/odsh_validate_password.js similarity index 97% rename from ckanext/odsh/fanstatic/tpsh_validate_password.js rename to ckanext/odsh/fanstatic/odsh_validate_password.js index f0f8f71b55e4f6a2cd9e52c6a39b09ab302d2dab..9ad4a91b7299d67251997cf190699f2dbcb664eb 100644 --- a/ckanext/odsh/fanstatic/tpsh_validate_password.js +++ b/ckanext/odsh/fanstatic/odsh_validate_password.js @@ -53,7 +53,7 @@ function setSubmitButtonState(isPasswordValid) { } -ckan.module('tpsh_validate_password', function ($) { +ckan.module('odsh_validate_password', function ($) { return { initialize: function () { $.proxyAll(this, /_on/); diff --git a/ckanext/odsh/fanstatic/webassets.yml b/ckanext/odsh/fanstatic/webassets.yml index 6ddebcd3183c4695db12f95ed4772a05e74325fc..37bb956c0f2bbb607951648982a36d607ad6bef7 100644 --- a/ckanext/odsh/fanstatic/webassets.yml +++ b/ckanext/odsh/fanstatic/webassets.yml @@ -52,20 +52,20 @@ odsh_popover_script: contents: - odsh_popover.js -tpsh_toggle_menu: +odsh_toggle_menu: filters: rjsmin # preprocessor - output: ckanext-odsh/tpsh_toggle_menu.js + output: ckanext-odsh/odsh_toggle_menu.js extra: preload: - base/main contents: - - tpsh_toggle_menu.js + - odsh_toggle_menu.js -tpsh_validate_password: +odsh_validate_password: filters: rjsmin # preprocessor - output: ckanext-odsh/tpsh_validate_password.js + output: ckanext-odsh/odsh_validate_password.js contents: - - tpsh_validate_password.js + - odsh_validate_password.js odsh_dataset_map_script: filters: rjsmin # preprocessor @@ -135,8 +135,8 @@ odsh_spatial_query_style: # - odsh_popover.js # - odsh_populate_tags.js # - odsh_spatial_query.js -# - tpsh_toggle_menu.js -# - tpsh_validate_password.js +# - odsh_toggle_menu.js +# - odsh_validate_password.js # - vendor/jquery-ui-autocomplete/jquery-ui.js # - vendor/leaflet.draw.js # - vendor/leaflet.js diff --git a/ckanext/odsh/helper_pkg_dict.py b/ckanext/odsh/helper_pkg_dict.py index 26f7917c6ef77f4368c9f8581fc411fee48e0e57..a35c9cf88bc2e4c9fbcf78cc7155407b431cf726 100644 --- a/ckanext/odsh/helper_pkg_dict.py +++ b/ckanext/odsh/helper_pkg_dict.py @@ -3,9 +3,6 @@ import re import ckanext.odsh.helpers as helpers_odsh import datetime -import ckanext.odsh.helpers_tpsh as helpers_tpsh -import ckanext.odsh.collection.helpers as helpers_collection - import ckanext.odsh.uri_store as uri_store from ckanext.odsh.pretty_daterange.date_range_formatter import DateRangeFormatter @@ -48,7 +45,7 @@ class HelperPgkDict(object): uris_collection_members = self.get_uris_collection_members() ckan_ids_collection_members = [self.get_id_from_store(uri) for uri in uris_collection_members] for id_pkg in ckan_ids_collection_members: - helpers_tpsh.add_pkg_to_collection(id_pkg, id_collection) + helpers_odsh.add_pkg_to_collection(id_pkg, id_collection) log.info('Added package with id {} to collection with id {}'.format(id_pkg, id_collection)) def get_uris_collection_members(self): @@ -80,7 +77,7 @@ class HelperPgkDict(object): id_pkg = self.pkg_dict.get('id') uri_collection = self.get_collection_uri() id_collection = uri_store.get_id_from_uri(uri_collection) - helpers_tpsh.add_pkg_to_collection(id_pkg, id_collection) + helpers_odsh.add_pkg_to_collection(id_pkg, id_collection) log.info('Added package with id {} to collection with id {}'.format(id_pkg, id_collection)) diff --git a/ckanext/odsh/helpers.py b/ckanext/odsh/helpers.py index 785e9c2d0b46ec8ed7c5bbd3e76eb3b6fd6d1fa7..54940abe69bd28ac233194289b2b5f6a20b9019d 100644 --- a/ckanext/odsh/helpers.py +++ b/ckanext/odsh/helpers.py @@ -6,7 +6,6 @@ import ast import ckan.plugins.toolkit as toolkit import ckan.logic as logic import ckan.model as model -import ckan.logic.action as action import ckan.lib.helpers as helpers import json from ckan.common import c @@ -19,12 +18,13 @@ import re import csv import urllib.request, urllib.error, urllib.parse from ckan.common import request -import pdb from urllib.parse import urlsplit, urlunsplit -import subprocess import ckan.lib.helpers as helpers -import os.path from collections import OrderedDict +import pkg_resources + + +CKAN_TYPES = {'http://dcat-ap.de/def/datasetTypes/collection': 'collection'} get_action = logic.get_action log = logging.getLogger(__name__) @@ -150,10 +150,45 @@ def odsh_render_datetime(datetime_, fromIso=True): except: return '' -def odsh_upload_known_formats(): - value = config.get('ckanext.odsh.upload_formats', []) - value = toolkit.aslist(value) - return value + +def odsh_resource_formats(as_simple_list = False): + """ + Retrieves a list of file formats from an RDF file using string manipulation and sorts them alphabetically. + + Returns: + A list of dictionaries containing key-value pairs for each file format. + """ + + # Path to the RDF file with resource formats + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + filepath = config.get( + 'ckanext.odsh.resource_formats_fallback_filepath', extension_path + '/resources/fileformats.rdf') + + # Read the contents of the RDF file + with open(filepath, 'r', encoding='utf-8') as file: + rdf_content = file.read() + + # Regular expression pattern to extract the file format values + pattern = r'<rdf:Description rdf:about="http:\/\/publications.europa.eu\/resource\/authority\/file-type\/(\w+)">' + + # List to store the key-value pairs + file_formats = [] + + # Find all matches of the pattern in the RDF content + matches = re.findall(pattern, rdf_content) + + # Iterate over the matches and add key-value pairs to the list + for match in matches: + file_formats.append({'key': match, 'value': match}) + + # Sort the list alphabetically based on the file format values + file_formats = sorted(file_formats, key=lambda x: x['value']) + + if(as_simple_list): + file_formats = [obj['value'] for obj in file_formats] + + return file_formats + def odsh_encodeurl(url): return urllib.parse.quote(url, safe='') @@ -226,10 +261,11 @@ def odsh_public_url(): return config.get('ckanext.odsh.public_url') def spatial_extends_available(): + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + file_path = config.get('ckanext.odsh.spatial.mapping', extension_path + '/resources/schleswig-holstein_geojson.csv') - mapping_file = config.get('ckanext.odsh.spatial.mapping') try: - mapping_file = urllib.request.urlopen(mapping_file) + mapping_file = urllib.request.urlopen(file_path) except Exception: raise Exception("Could not load spatial mapping file!") @@ -251,21 +287,8 @@ def odsh_public_resource_url(res): return res['url'] -def odsh_get_version_id(): - try: - home = config.get('ckanext.odsh.home', None) - if home: - if home[-1] == '/': - home = home[:-1] - home += '/.git' - return subprocess.check_output(["git", "--git-dir", home, "rev-parse", "HEAD"]).strip() - except: - return 'unknown' - return 'unknown' - - def odsh_show_testbanner(): - return config.get('ckanext.odsh.showtestbanner', 'False') == 'True' + return config.get('ckanext.odsh.showtestbanner', False) == True def odsh_get_facet_items_dict(name, limit=None): @@ -347,7 +370,7 @@ def is_within_last_month(date, date_ref=None): return True return False -def tpsh_get_all_datasets_belonging_to_collection(context, collection_name): +def get_all_datasets_belonging_to_collection(context, collection_name): rel_collection_dict = dict({"id": collection_name}) name_list = list() try: @@ -360,14 +383,14 @@ def tpsh_get_all_datasets_belonging_to_collection(context, collection_name): name_list.append(item_object) return name_list -def tpsh_get_all_datasets_belonging_to_collection_by_dataset(context, dataset_name): - collection_name = tpsh_get_collection_name_by_dataset(context, dataset_name) +def get_all_datasets_belonging_to_collection_by_dataset(context, dataset_name): + collection_name = get_collection_name_by_dataset(context, dataset_name) if collection_name: - name_list = tpsh_get_all_datasets_belonging_to_collection(context, collection_name) + name_list = get_all_datasets_belonging_to_collection(context, collection_name) return name_list return list() -def tpsh_get_collection_name_by_dataset(context, dataset_name): +def get_collection_name_by_dataset(context, dataset_name): rel_dataset_dict = dict({"id" : dataset_name}) list_rel_dataset = toolkit.get_action('package_relationships_list')(context, rel_dataset_dict) if not len(list_rel_dataset): @@ -375,7 +398,7 @@ def tpsh_get_collection_name_by_dataset(context, dataset_name): collection_name = list_rel_dataset[0]['object'] return collection_name -def tpsh_get_successor_and_predecessor_dataset(context, pkg_dict): +def get_successor_and_predecessor_dataset(context, pkg_dict): dataset_name = pkg_dict.get('name') siblings_dicts_with_access = _get_siblings_dicts_with_access(context, pkg_dict) if siblings_dicts_with_access: @@ -397,7 +420,7 @@ def tpsh_get_successor_and_predecessor_dataset(context, pkg_dict): def _get_siblings_dicts_with_access(context, pkg_dict): dataset_name = pkg_dict.get('name') - list_of_siblings = tpsh_get_all_datasets_belonging_to_collection_by_dataset(context, dataset_name) + list_of_siblings = get_all_datasets_belonging_to_collection_by_dataset(context, dataset_name) n_siblings = len(list_of_siblings) if n_siblings>0: siblings_dicts = [get_package_dict(name) for name in list_of_siblings] @@ -421,8 +444,8 @@ def _sort_siblings_by_name_and_date(siblings_dicts): def get_package_dict(name): return model.Package.get(name).as_dict() -def tpsh_get_successor_and_predecessor_urls(context, pkg_dict): - successor_name, predecessor_name = tpsh_get_successor_and_predecessor_dataset(context, pkg_dict) +def get_successor_and_predecessor_urls(context, pkg_dict): + successor_name, predecessor_name = get_successor_and_predecessor_dataset(context, pkg_dict) successor_url, predecessor_url = ( helpers.url_for('dataset.read', id=name) if name is not None @@ -457,8 +480,8 @@ def odsh_load_mdk_sample_dataset(): and corresponding mapping in mdk_mapping.json file. ''' - path = os.path.abspath(os.path.dirname(__file__)) - default_sample_data_file_path = os.path.join(path, "../../mdk_mapping.json") + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + default_sample_data_file_path = extension_path + '/resources/mdk_mapping.json' sample_data_file_path = config.get( 'ckanext.odsh.sample_data_file_path', default_sample_data_file_path) @@ -490,8 +513,8 @@ def odsh_load_raw_mdk_sample_dataset(): and corresponding mapping in mdk_mapping.json file. ''' - path = os.path.abspath(os.path.dirname(__file__)) - default_sample_data_file_path = os.path.join(path, "../../mdk_mapping.json") + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + default_sample_data_file_path = extension_path + '/resources/mdk_mapping.json' sample_data_file_path = config.get( 'ckanext.odsh.sample_data_file_path', default_sample_data_file_path) @@ -511,3 +534,185 @@ def odsh_load_raw_mdk_sample_dataset(): ) raise return result + + +def map_dct_type_to_ckan_type(dct_type): + ''' + matches the field dct:type from a harvested rdf file + to the corresponding ckan package type + ''' + ckan_type = CKAN_TYPES.get(dct_type) + return ckan_type + +def map_ckan_type_to_dct_type(ckan_type): + DCT_TYPES = _revert_dict(CKAN_TYPES) + dct_type = DCT_TYPES.get(ckan_type) + return dct_type + +def _revert_dict(d): + d_inverse = {v: k for k, v in d.items()} + return d_inverse + +def add_pkg_to_collection(id_pkg, id_collection): + if id_pkg and id_collection: + relationship_dict = { + 'subject': id_pkg, + 'object': id_collection, + 'type': 'child_of', + } + toolkit.get_action('package_relationship_create')(None, relationship_dict) + +def correct_missing_relationship(pkg_dict, pkg_relationships_from_model): + ''' + This function corrects missing relationship in show package. + Note this fix is only good with one or non relationship. + This error is well known but was not fixed. https://github.com/ckan/ckan/issues/3114 + The error causes the deletation of relationships, because package_show is + used in resource_create to get the package. + ''' + if pkg_relationships_from_model: + relationship_from_model = pkg_relationships_from_model[0] + relationship_list_from_dict = pkg_dict.get('relationships_as_subject') + type_pkg = pkg_dict.get('type') + needs_update = type_pkg == 'dataset' and not relationship_list_from_dict + if needs_update: + relationship_for_package = { + '__extras': { + 'object_package_id': relationship_from_model.object_package_id, + 'subject_package_id': relationship_from_model.subject_package_id, + }, + 'comment': relationship_from_model.subject_package_id, + 'id': relationship_from_model.id, + 'type': relationship_from_model.type, + } + pkg_dict['relationships_as_subject'].append(relationship_for_package) + return pkg_dict + +def get_pkg_relationships_from_model(pkg_dict): + pkg_id = pkg_dict.get('id') + return model.Package.get(pkg_id).get_relationships() + +def load_language_mapping(): + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + file_path = config.get('ckanext.odsh.language_mapping', extension_path + '/resources/language_mapping.json') + with open(file_path) as language_mapping_json: + LANGUAGE_MAPPING = json.loads(language_mapping_json.read()) + return LANGUAGE_MAPPING + +def load_json_to_ordered_dict(json_str): + return json.loads(json_str, object_pairs_hook=OrderedDict) + +def get_language_of_package(pkg_dict): + LANGUAGE_MAPPING = load_language_mapping() + language_id = _get_language_id(pkg_dict) + if not language_id: + return None + language = LANGUAGE_MAPPING.get(language_id) + return language + +def get_language_icon(pkg_dict): + ICONS = { + "http://publications.europa.eu/resource/authority/language/DAN": '/base/images/icon_lang_danish.png', + "http://publications.europa.eu/resource/authority/language/ENG": '/base/images/icon_lang_english.png', + } + language_id = _get_language_id(pkg_dict) + if not language_id: + return None + return ICONS.get(language_id) + +def _get_language_id(pkg_dict): + language_id = odsh_extract_value_from_extras(pkg_dict.get('extras'), 'language') + language_id = pkg_dict.get('language') + if not language_id: + language_id = odsh_extract_value_from_extras( + pkg_dict.get('extras'), 'language' + ) + if not language_id: + return None + language_id_cleaned = re.sub('[\[\]\"]', '', language_id) + return language_id_cleaned + +def get_spatial_for_selection(): + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + file_path = config.get('ckanext.odsh.spatial.mapping', extension_path + '/resources/schleswig-holstein_geojson.csv') + with open(file_path, newline='') as mapping_file: + cr = csv.reader(mapping_file, delimiter="\t") + spatial_mapping = list(cr) + + unique_mapping = [] + seen_values = set() + for key, value, _ in spatial_mapping: + if value in seen_values: + continue # Skip if the value has already been seen + + if "municipalityKey" in key: + unique_mapping.append({'key': key, 'value': value}) + else: + # Check if there is a municipality key entry for the value + municipality_entry = next( + (entry for entry in spatial_mapping if entry[1] == value and "municipalityKey" in entry[0]), + None + ) + + if municipality_entry: + # If a municipality key entry exists, use it instead of the current key + unique_mapping.append({'key': municipality_entry[0], 'value': value}) + else: + # Otherwise, use the current key + unique_mapping.append({'key': key, 'value': value}) + + seen_values.add(value) + + unique_mapping.append({'key': '', 'value': ''}) + return unique_mapping + + +def get_language_for_selection(): + LANGUAGE_MAPPING = load_language_mapping() + dict_for_select_box = [{'key': key, 'value': LANGUAGE_MAPPING[key]} for key in LANGUAGE_MAPPING] + return dict_for_select_box + +def get_package_dict(name): + ''' + raises ckan.logic.NotFound if not found + ''' + package_dict = toolkit.get_action('package_show')(None, {'id': name}) + return package_dict + +def size_of_fmt(num, suffix='B'): + for unit in ['',' k',' M',' G',' T',' P',' E',' Z']: + if abs(num) < 1000.0: + return "%3.1f%s%s" % (num, unit, suffix) + num /= 1000.0 + return "%.1f%s%s" % (num, 'Y', suffix) + +def get_resource_size(resource): + resource_size = resource.get('size') + if resource_size: + return size_of_fmt(resource_size) + + +def get_address_org(organization): + list_extras = organization.get('extras') + address = dict() + if not list_extras: + return address + for extra in list_extras: + address.update({extra.get('key'):extra.get('value')}) + web = address.get('web') + if web and not web.startswith('http'): + web = 'http://' + web + address.update({'web':web}) + return address + + +def get_body_mail(organization, package): + package_name = package.get('name') + url = helpers.url_for('dataset.read', id=package_name, qualified = True) + title = package.get('title') + anrede = "Sehr geehrte Damen und Herren," + "%0D%0A" + "%0D%0A" + "zu folgendem Eintrag habe ich eine Anmerkung/Frage:" + "%0D%0A" + "%0D%0A" + mail_titel = "Titel: " + title + "%0D%0A" + mail_document = "Dokument-ID: " + package_name + "%0D%0A" + mail_url = "URL: " + url + "%0D%0A" + "%0D%0A" + message = mail_titel + mail_document + mail_url + "Mein Kommentar:" + "%0D%0A" + "%0D%0A" + "%0D%0A" + "%0D%0A" + return anrede + message diff --git a/ckanext/odsh/helpers_tpsh.py b/ckanext/odsh/helpers_tpsh.py deleted file mode 100644 index 64b49aab49525f6a4d4304de26988ca78be40fab..0000000000000000000000000000000000000000 --- a/ckanext/odsh/helpers_tpsh.py +++ /dev/null @@ -1,194 +0,0 @@ -# encoding: utf-8 - -import csv -import datetime -import logging -import json -import re -import urllib.request, urllib.error, urllib.parse -from collections import OrderedDict -import subprocess -import os - -from ckan.common import config -import ckan.lib.helpers as helpers -import ckan.logic.action.create as create -import ckan.model as model -import ckan.plugins.toolkit as toolkit - - -import ckanext.odsh.helpers as odsh_helpers - -log = logging.getLogger(__name__) - -CKAN_TYPES = {'http://dcat-ap.de/def/datasetTypes/collection': 'collection'} - - -def map_dct_type_to_ckan_type(dct_type): - ''' - matches the field dct:type from a harvested rdf file - to the corresponding ckan package type - ''' - ckan_type = CKAN_TYPES.get(dct_type) - return ckan_type - -def map_ckan_type_to_dct_type(ckan_type): - DCT_TYPES = _revert_dict(CKAN_TYPES) - dct_type = DCT_TYPES.get(ckan_type) - return dct_type - -def _revert_dict(d): - d_inverse = {v: k for k, v in d.items()} - return d_inverse - -def add_pkg_to_collection(id_pkg, id_collection): - if id_pkg and id_collection: - relationship_dict = { - 'subject': id_pkg, - 'object': id_collection, - 'type': 'child_of', - } - toolkit.get_action('package_relationship_create')(None, relationship_dict) - -def correct_missing_relationship(pkg_dict, pkg_relationships_from_model): - ''' - This function corrects missing relationship in show package. - Note this fix is only good with one or non relationship. - This error is well known but was not fixed. https://github.com/ckan/ckan/issues/3114 - The error causes the deletation of relationships, because package_show is - used in resource_create to get the package. - ''' - if pkg_relationships_from_model: - relationship_from_model = pkg_relationships_from_model[0] - relationship_list_from_dict = pkg_dict.get('relationships_as_subject') - type_pkg = pkg_dict.get('type') - needs_update = type_pkg == 'dataset' and not relationship_list_from_dict - if needs_update: - relationship_for_package = { - '__extras': { - 'object_package_id': relationship_from_model.object_package_id, - 'subject_package_id': relationship_from_model.subject_package_id, - }, - 'comment': relationship_from_model.subject_package_id, - 'id': relationship_from_model.id, - 'type': relationship_from_model.type, - } - pkg_dict['relationships_as_subject'].append(relationship_for_package) - return pkg_dict - -def get_pkg_relationships_from_model(pkg_dict): - pkg_id = pkg_dict.get('id') - return model.Package.get(pkg_id).get_relationships() - -def load_language_mapping(): - with open(config.get('ckanext.odsh.language_mapping')) as language_mapping_json: - LANGUAGE_MAPPING = json.loads(language_mapping_json.read()) - return LANGUAGE_MAPPING - -def load_json_to_ordered_dict(json_str): - return json.loads(json_str, object_pairs_hook=OrderedDict) - -def load_subject_mapping(): - with open(config.get('ckanext.odsh.subject_mapping')) as subject_mapping_json: - SUBJECT_MAPPING = load_json_to_ordered_dict(subject_mapping_json.read()) - return SUBJECT_MAPPING - -def get_language_of_package(pkg_dict): - LANGUAGE_MAPPING = load_language_mapping() - language_id = _get_language_id(pkg_dict) - if not language_id: - return None - language = LANGUAGE_MAPPING.get(language_id) - return language - -def get_language_icon(pkg_dict): - ICONS = { - "http://publications.europa.eu/resource/authority/language/DAN": '/base/images/icon_lang_danish.png', - "http://publications.europa.eu/resource/authority/language/ENG": '/base/images/icon_lang_english.png', - } - language_id = _get_language_id(pkg_dict) - if not language_id: - return None - return ICONS.get(language_id) - -def _get_language_id(pkg_dict): - language_id = odsh_helpers.odsh_extract_value_from_extras(pkg_dict.get('extras'), 'language') - language_id = pkg_dict.get('language') - if not language_id: - language_id = odsh_helpers.odsh_extract_value_from_extras( - pkg_dict.get('extras'), 'language' - ) - if not language_id: - return None - language_id_cleaned = re.sub('[\[\]\"]', '', language_id) - return language_id_cleaned - -def get_spatial_for_selection(): - mapping_path = config.get('ckanext.odsh.spatial.mapping') - with open(mapping_path, newline='') as mapping_file: - cr = csv.reader(mapping_file, delimiter="\t") - spatial_mapping = list() - for row in cr: - key = row[0] - value = row[1] - spatial_mapping.append({'key':key, 'value':value}) - spatial_mapping.append({'key':'', 'value':''}) - return spatial_mapping - -def get_subject_for_selection(): - SUBJECT_MAPPING = load_subject_mapping() - dict_for_select_box = [{'key': 'empty', 'value':' '}, ] - dict_for_select_box.extend( - [{'key': key, 'value': SUBJECT_MAPPING[key]} for key in SUBJECT_MAPPING] - ) - return dict_for_select_box - -def get_language_for_selection(): - LANGUAGE_MAPPING = load_language_mapping() - dict_for_select_box = [{'key': key, 'value': LANGUAGE_MAPPING[key]} for key in LANGUAGE_MAPPING] - return dict_for_select_box - -def get_package_dict(name): - ''' - raises ckan.logic.NotFound if not found - ''' - package_dict = toolkit.get_action('package_show')(None, {'id': name}) - return package_dict - -def size_of_fmt(num, suffix='B'): - for unit in ['',' k',' M',' G',' T',' P',' E',' Z']: - if abs(num) < 1000.0: - return "%3.1f%s%s" % (num, unit, suffix) - num /= 1000.0 - return "%.1f%s%s" % (num, 'Y', suffix) - -def get_resource_size(resource): - resource_size = resource.get('size') - if resource_size: - return size_of_fmt(resource_size) - - -def get_address_org(organization): - list_extras = organization.get('extras') - address = dict() - if not list_extras: - return address - for extra in list_extras: - address.update({extra.get('key'):extra.get('value')}) - web = address.get('web') - if web and not web.startswith('http'): - web = 'http://' + web - address.update({'web':web}) - return address - - -def get_body_mail(organization, package): - package_name = package.get('name') - url = helpers.url_for('dataset.read', id=package_name, qualified = True) - title = package.get('title') - anrede = "Sehr geehrte Damen und Herren," + "%0D%0A" + "%0D%0A" + "zu folgendem Eintrag habe ich eine Anmerkung/Frage:" + "%0D%0A" + "%0D%0A" - mail_titel = "Titel: " + title + "%0D%0A" - mail_document = "Dokument-ID: " + package_name + "%0D%0A" - mail_url = "URL: " + url + "%0D%0A" + "%0D%0A" - message = mail_titel + mail_document + mail_url + "Mein Kommentar:" + "%0D%0A" + "%0D%0A" + "%0D%0A" + "%0D%0A" - return anrede + message diff --git a/ckanext/odsh/i18n/ckanext-odsh.pot b/ckanext/odsh/i18n/ckanext-odsh.pot index 89f1cba3888edd1b441631682a3c7c31b2f9f928..fdc2d33ba591d46e6351dab6bf3389e16dde46a2 100644 --- a/ckanext/odsh/i18n/ckanext-odsh.pot +++ b/ckanext/odsh/i18n/ckanext-odsh.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: ckanext-odsh 2.0.0\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-06-05 10:29+0200\n" +"POT-Creation-Date: 2023-06-16 12:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.7.0\n" -#: ckanext/odsh/plugin.py:227 ckanext/odsh/plugin.py:236 ckanext/odsh/plugin.py:242 +#: ckanext/odsh/plugin.py:222 ckanext/odsh/plugin.py:231 ckanext/odsh/plugin.py:237 #: ckanext/odsh/templates/header.html:45 #: ckanext/odsh/templates/organization/index.html:3 #: ckanext/odsh/templates/organization/index.html:6 @@ -28,15 +28,15 @@ msgstr "" msgid "Organizations" msgstr "" -#: ckanext/odsh/plugin.py:228 ckanext/odsh/plugin.py:239 ckanext/odsh/plugin.py:245 +#: ckanext/odsh/plugin.py:223 ckanext/odsh/plugin.py:234 ckanext/odsh/plugin.py:240 msgid "Category" msgstr "" -#: ckanext/odsh/plugin.py:229 ckanext/odsh/plugin.py:237 ckanext/odsh/plugin.py:243 +#: ckanext/odsh/plugin.py:224 ckanext/odsh/plugin.py:232 ckanext/odsh/plugin.py:238 msgid "File format" msgstr "" -#: ckanext/odsh/plugin.py:230 ckanext/odsh/plugin.py:238 ckanext/odsh/plugin.py:244 +#: ckanext/odsh/plugin.py:225 ckanext/odsh/plugin.py:233 ckanext/odsh/plugin.py:239 #: ckanext/odsh/templates/package/resource_read.html:170 #: ckanext/odsh/templates/package/snippets/info.html:75 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:91 @@ -44,24 +44,11 @@ msgstr "" msgid "License" msgstr "" -#: ckanext/odsh/plugin.py:232 +#: ckanext/odsh/plugin.py:227 msgid "Open-Data-Eigenschaften" msgstr "" -#: ckanext/odsh/validation.py:275 -#, python-format -msgid "Tag \"%s\" must be alphanumeric characters or symbols: -_.:()" -msgstr "" - -#: ckanext/odsh/validation.py:330 -msgid "Subject must be a known URI." -msgstr "" - -#: ckanext/odsh/validation.py:352 -msgid "Subject must not be empty." -msgstr "" - -#: ckanext/odsh/validation.py:367 +#: ckanext/odsh/validation.py:311 msgid "Only formats on the list of the EU Publications Office are allowed." msgstr "" @@ -444,7 +431,7 @@ msgstr "" #: ckanext/odsh/templates/organization/snippets/organization_form.html:53 #: ckanext/odsh/templates/package/edit_view.html:19 #: ckanext/odsh/templates/package/snippets/package_form.html:33 -#: ckanext/odsh/templates/package/snippets/resource_form.html:96 +#: ckanext/odsh/templates/package/snippets/resource_form.html:91 #: ckanext/odsh/templates/user/edit_user_form.html:46 msgid "Delete" msgstr "" @@ -553,7 +540,7 @@ msgid "Issued Descending" msgstr "" #: ckanext/odsh/templates/organization/read.html:31 -#: ckanext/odsh/templates/snippets/package_item.html:84 +#: ckanext/odsh/templates/snippets/package_item.html:89 #: ckanext/odsh/templates/snippets/search_form.html:20 msgid "Popular" msgstr "" @@ -604,7 +591,7 @@ msgid "Save Organization" msgstr "" #: ckanext/odsh/templates/organization/snippets/organization_item.html:15 -#: ckanext/odsh/templates/snippets/package_item.html:70 +#: ckanext/odsh/templates/snippets/package_item.html:75 msgid "View {organization_name}" msgstr "" @@ -623,7 +610,7 @@ msgstr "" #: ckanext/odsh/templates/package/edit_base.html:23 #: ckanext/odsh/templates/package/resource_edit_base.html:28 -#: ckanext/odsh/templates/package/snippets/resource_form.html:81 +#: ckanext/odsh/templates/package/snippets/resource_form.html:77 msgid "Back" msgstr "" @@ -682,19 +669,19 @@ msgid "" msgstr "" #: ckanext/odsh/templates/package/new_view.html:32 -#: ckanext/odsh/templates/package/snippets/resource_form.html:117 +#: ckanext/odsh/templates/package/snippets/resource_form.html:112 msgid "Add" msgstr "" #: ckanext/odsh/templates/package/read.html:37 -#: ckanext/odsh/templates/snippets/package_item.html:74 +#: ckanext/odsh/templates/snippets/package_item.html:79 msgid "Draft" msgstr "" #: ckanext/odsh/templates/package/read.html:40 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:275 #: ckanext/odsh/templates/snippets/organization.html:24 -#: ckanext/odsh/templates/snippets/package_item.html:76 +#: ckanext/odsh/templates/snippets/package_item.html:81 msgid "Deleted" msgstr "" @@ -704,7 +691,7 @@ msgstr "" #: ckanext/odsh/templates/package/read.html:53 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:251 -#: ckanext/odsh/templates/snippets/package_item.html:65 +#: ckanext/odsh/templates/snippets/package_item.html:70 msgid "Private" msgstr "" @@ -827,7 +814,7 @@ msgid "Created" msgstr "" #: ckanext/odsh/templates/package/resource_read.html:166 -#: ckanext/odsh/templates/package/snippets/resource_form.html:70 +#: ckanext/odsh/templates/package/snippets/resource_form.html:68 #: ckanext/odsh/templates/package/snippets/resource_info.html:26 msgid "Format" msgstr "" @@ -894,14 +881,14 @@ msgid "Filterdialog schließen" msgstr "" #: ckanext/odsh/templates/package/snippets/info.html:28 -#: ckanext/odsh/templates/snippets/package_item.html:92 +#: ckanext/odsh/templates/snippets/package_item.html:97 msgid "Category:" msgid_plural "Categories:" msgstr[0] "" msgstr[1] "" #: ckanext/odsh/templates/package/snippets/info.html:63 -#: ckanext/odsh/templates/snippets/package_item.html:138 +#: ckanext/odsh/templates/snippets/package_item.html:143 msgid "Issued" msgstr "" @@ -1003,7 +990,7 @@ msgid "Next: Add Data" msgstr "" #: ckanext/odsh/templates/package/snippets/package_form.html:46 -#: ckanext/odsh/templates/package/snippets/resource_form.html:123 +#: ckanext/odsh/templates/package/snippets/resource_form.html:118 msgid "Required information" msgstr "" @@ -1062,25 +1049,19 @@ msgid "" " application/json" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_form.html:68 +#: ckanext/odsh/templates/package/snippets/resource_form.html:66 msgid "odsh_resource_format_error_label" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_form.html:70 -msgid "eg. CSV, XML or JSON" +#: ckanext/odsh/templates/package/snippets/resource_form.html:80 +msgid "Another dataset" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_form.html:84 -msgid "" -"Another\n" -" dataset" -msgstr "" - -#: ckanext/odsh/templates/package/snippets/resource_form.html:93 +#: ckanext/odsh/templates/package/snippets/resource_form.html:88 msgid "Are you sure you want to delete this resource?" msgstr "" -#: ckanext/odsh/templates/package/snippets/resource_form.html:110 +#: ckanext/odsh/templates/package/snippets/resource_form.html:105 msgid "Upload dataset" msgstr "" @@ -1221,7 +1202,11 @@ msgstr "" msgid "Documents" msgstr "" -#: ckanext/odsh/templates/snippets/package_item.html:60 +#: ckanext/odsh/templates/snippets/package_item.html:41 +msgid "Data series" +msgstr "" + +#: ckanext/odsh/templates/snippets/package_item.html:65 msgid "NEW" msgstr "" diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo index 317f4421d04094318eb4477668030b23227deeae..4d7d3d2b5a2703899384387ddc5de455906a3af7 100644 Binary files a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo and b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.mo differ diff --git a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po index d1919ee160d3f97f37a76aa6b422f62696b83f6f..badba331a009dc6f673dea2a4e4f0b988dd0d8a3 100644 --- a/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po +++ b/ckanext/odsh/i18n/de/LC_MESSAGES/ckanext-odsh.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: ckanext-odsh 2.0.0\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2023-06-05 10:29+0200\n" -"PO-Revision-Date: 2023-06-05 10:32+0200\n" +"POT-Creation-Date: 2023-06-16 12:18+0200\n" +"PO-Revision-Date: 2023-06-16 12:23+0200\n" "Last-Translator: \n" "Language-Team: de <LL@li.org>\n" "Language: de\n" @@ -20,8 +20,8 @@ msgstr "" "Generated-By: Babel 2.3.4\n" "X-Generator: Poedit 2.3\n" -#: ckanext/odsh/plugin.py:227 ckanext/odsh/plugin.py:236 -#: ckanext/odsh/plugin.py:242 ckanext/odsh/templates/header.html:45 +#: ckanext/odsh/plugin.py:222 ckanext/odsh/plugin.py:231 +#: ckanext/odsh/plugin.py:237 ckanext/odsh/templates/header.html:45 #: ckanext/odsh/templates/organization/index.html:3 #: ckanext/odsh/templates/organization/index.html:6 #: ckanext/odsh/templates/organization/index.html:33 @@ -31,18 +31,18 @@ msgstr "" msgid "Organizations" msgstr "Herausgeber" -#: ckanext/odsh/plugin.py:228 ckanext/odsh/plugin.py:239 -#: ckanext/odsh/plugin.py:245 +#: ckanext/odsh/plugin.py:223 ckanext/odsh/plugin.py:234 +#: ckanext/odsh/plugin.py:240 msgid "Category" msgstr "Kategorie" -#: ckanext/odsh/plugin.py:229 ckanext/odsh/plugin.py:237 -#: ckanext/odsh/plugin.py:243 +#: ckanext/odsh/plugin.py:224 ckanext/odsh/plugin.py:232 +#: ckanext/odsh/plugin.py:238 msgid "File format" msgstr "Dateiformat" -#: ckanext/odsh/plugin.py:230 ckanext/odsh/plugin.py:238 -#: ckanext/odsh/plugin.py:244 +#: ckanext/odsh/plugin.py:225 ckanext/odsh/plugin.py:233 +#: ckanext/odsh/plugin.py:239 #: ckanext/odsh/templates/package/resource_read.html:170 #: ckanext/odsh/templates/package/snippets/info.html:75 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:91 @@ -50,26 +50,11 @@ msgstr "Dateiformat" msgid "License" msgstr "Lizenz" -#: ckanext/odsh/plugin.py:232 +#: ckanext/odsh/plugin.py:227 msgid "Open-Data-Eigenschaften" msgstr "Open-Data-Eigenschaften" -#: ckanext/odsh/validation.py:275 -#, python-format -msgid "Tag \"%s\" must be alphanumeric characters or symbols: -_.:()" -msgstr "" -"Tags \"%s\" müssen aus alphnummerischen Zeichen oder diesen Symbolen " -"bestehen: -_.:()" - -#: ckanext/odsh/validation.py:330 -msgid "Subject must be a known URI." -msgstr "Bitte geben Sie einen Informationsgegenstand an" - -#: ckanext/odsh/validation.py:352 -msgid "Subject must not be empty." -msgstr "Bitte geben Sie einen Informationsgegenstand ein." - -#: ckanext/odsh/validation.py:367 +#: ckanext/odsh/validation.py:311 msgid "Only formats on the list of the EU Publications Office are allowed." msgstr "" "Es sind nur Formate zulässig, die in der Liste des EU Publications Office " @@ -460,7 +445,7 @@ msgstr "Sind Sie sicher, dass Sie diese Datenabfrage löschen möchten?" #: ckanext/odsh/templates/organization/snippets/organization_form.html:53 #: ckanext/odsh/templates/package/edit_view.html:19 #: ckanext/odsh/templates/package/snippets/package_form.html:33 -#: ckanext/odsh/templates/package/snippets/resource_form.html:96 +#: ckanext/odsh/templates/package/snippets/resource_form.html:91 #: ckanext/odsh/templates/user/edit_user_form.html:46 msgid "Delete" msgstr "Löschen" @@ -569,7 +554,7 @@ msgid "Issued Descending" msgstr "Veröffentlichungsdatum: Neueste zuerst" #: ckanext/odsh/templates/organization/read.html:31 -#: ckanext/odsh/templates/snippets/package_item.html:84 +#: ckanext/odsh/templates/snippets/package_item.html:89 #: ckanext/odsh/templates/snippets/search_form.html:20 msgid "Popular" msgstr "Beliebt" @@ -627,7 +612,7 @@ msgid "Save Organization" msgstr "Herausgeber speichern" #: ckanext/odsh/templates/organization/snippets/organization_item.html:15 -#: ckanext/odsh/templates/snippets/package_item.html:70 +#: ckanext/odsh/templates/snippets/package_item.html:75 msgid "View {organization_name}" msgstr "{organization_name} anzeigen" @@ -646,7 +631,7 @@ msgstr "Bearbeiten" #: ckanext/odsh/templates/package/edit_base.html:23 #: ckanext/odsh/templates/package/resource_edit_base.html:28 -#: ckanext/odsh/templates/package/snippets/resource_form.html:81 +#: ckanext/odsh/templates/package/snippets/resource_form.html:77 msgid "Back" msgstr "Zurück" @@ -709,19 +694,19 @@ msgstr "" "Explorer Dokumentation</a>." #: ckanext/odsh/templates/package/new_view.html:32 -#: ckanext/odsh/templates/package/snippets/resource_form.html:117 +#: ckanext/odsh/templates/package/snippets/resource_form.html:112 msgid "Add" msgstr "Hinzufügen" #: ckanext/odsh/templates/package/read.html:37 -#: ckanext/odsh/templates/snippets/package_item.html:74 +#: ckanext/odsh/templates/snippets/package_item.html:79 msgid "Draft" msgstr "Entwurf" #: ckanext/odsh/templates/package/read.html:40 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:275 #: ckanext/odsh/templates/snippets/organization.html:24 -#: ckanext/odsh/templates/snippets/package_item.html:76 +#: ckanext/odsh/templates/snippets/package_item.html:81 msgid "Deleted" msgstr "Gelöscht" @@ -731,7 +716,7 @@ msgstr "Datensatz bearbeiten" #: ckanext/odsh/templates/package/read.html:53 #: ckanext/odsh/templates/package/snippets/package_basic_fields.html:251 -#: ckanext/odsh/templates/snippets/package_item.html:65 +#: ckanext/odsh/templates/snippets/package_item.html:70 msgid "Private" msgstr "Privat" @@ -862,7 +847,7 @@ msgid "Created" msgstr "Erstellt" #: ckanext/odsh/templates/package/resource_read.html:166 -#: ckanext/odsh/templates/package/snippets/resource_form.html:70 +#: ckanext/odsh/templates/package/snippets/resource_form.html:68 #: ckanext/odsh/templates/package/snippets/resource_info.html:26 msgid "Format" msgstr "Format" @@ -929,14 +914,14 @@ msgid "Filterdialog schließen" msgstr "Close filters" #: ckanext/odsh/templates/package/snippets/info.html:28 -#: ckanext/odsh/templates/snippets/package_item.html:92 +#: ckanext/odsh/templates/snippets/package_item.html:97 msgid "Category:" msgid_plural "Categories:" msgstr[0] "Kategorie:" msgstr[1] "Kategorien:" #: ckanext/odsh/templates/package/snippets/info.html:63 -#: ckanext/odsh/templates/snippets/package_item.html:138 +#: ckanext/odsh/templates/snippets/package_item.html:143 msgid "Issued" msgstr "Veröffentlicht" @@ -1038,7 +1023,7 @@ msgid "Next: Add Data" msgstr "Weiter: Daten hinzufügen" #: ckanext/odsh/templates/package/snippets/package_form.html:46 -#: ckanext/odsh/templates/package/snippets/resource_form.html:123 +#: ckanext/odsh/templates/package/snippets/resource_form.html:118 msgid "Required information" msgstr "Pflichtangabe" @@ -1101,27 +1086,21 @@ msgid "" " application/json" msgstr "z.B. application/json" -#: ckanext/odsh/templates/package/snippets/resource_form.html:68 +#: ckanext/odsh/templates/package/snippets/resource_form.html:66 msgid "odsh_resource_format_error_label" msgstr "Bitte geben Sie ein Format an" -#: ckanext/odsh/templates/package/snippets/resource_form.html:70 -msgid "eg. CSV, XML or JSON" -msgstr "z.B. CSV, XML or JSON" - -#: ckanext/odsh/templates/package/snippets/resource_form.html:84 +#: ckanext/odsh/templates/package/snippets/resource_form.html:80 #, fuzzy #| msgid "Another dataset" -msgid "" -"Another\n" -" dataset" +msgid "Another dataset" msgstr "weitere Distribution" -#: ckanext/odsh/templates/package/snippets/resource_form.html:93 +#: ckanext/odsh/templates/package/snippets/resource_form.html:88 msgid "Are you sure you want to delete this resource?" msgstr "Sind Sie sicher, dass Sie diese Ressource löschen wollen?" -#: ckanext/odsh/templates/package/snippets/resource_form.html:110 +#: ckanext/odsh/templates/package/snippets/resource_form.html:105 msgid "Upload dataset" msgstr "Hochladen" @@ -1267,7 +1246,11 @@ msgstr "Abonennten" msgid "Documents" msgstr "Dokumente" -#: ckanext/odsh/templates/snippets/package_item.html:60 +#: ckanext/odsh/templates/snippets/package_item.html:41 +msgid "Data series" +msgstr "Datenserie" + +#: ckanext/odsh/templates/snippets/package_item.html:65 msgid "NEW" msgstr "NEU" @@ -1529,6 +1512,20 @@ msgstr "Passwort merken" msgid "do Login" msgstr "Einloggen" +#~ msgid "Tag \"%s\" must be alphanumeric characters or symbols: -_.:()" +#~ msgstr "" +#~ "Tags \"%s\" müssen aus alphnummerischen Zeichen oder diesen Symbolen " +#~ "bestehen: -_.:()" + +#~ msgid "Subject must be a known URI." +#~ msgstr "Bitte geben Sie einen Informationsgegenstand an" + +#~ msgid "Subject must not be empty." +#~ msgstr "Bitte geben Sie einen Informationsgegenstand ein." + +#~ msgid "eg. CSV, XML or JSON" +#~ msgstr "z.B. CSV, XML or JSON" + #~ msgid "" #~ "Search\n" #~ "datasets..." diff --git a/ckanext/odsh/lib/uploader.py b/ckanext/odsh/lib/uploader.py index 3ef936af83fb3b167f0098a34bd8d8f95ebc72d9..2c6db29da930f05f0b06a1e5b7ed55906a80a513 100644 --- a/ckanext/odsh/lib/uploader.py +++ b/ckanext/odsh/lib/uploader.py @@ -1,7 +1,5 @@ import ckan.logic as logic from ckan.lib.uploader import ResourceUpload, Upload -import ckan.plugins.toolkit as toolkit -import ckan.plugins.toolkit as tk import logging import hashlib diff --git a/ckanext/odsh/logic/action.py b/ckanext/odsh/logic/action.py index bf1333c3efda9a8a528024828066d998d5eb914b..36d6b9782d7ad496fef3eeea5d53fedfeabbf00e 100644 --- a/ckanext/odsh/logic/action.py +++ b/ckanext/odsh/logic/action.py @@ -17,7 +17,7 @@ log = logging.getLogger(__name__) from ckanext.odsh.setup_proxy import setup_proxy, clear_proxy from ckanext.odsh.collection.helpers import get_collection_id, get_package_dict -from ckanext.odsh.helpers_tpsh import add_pkg_to_collection +from ckanext.odsh.helpers import add_pkg_to_collection from ckanext.odsh.helpers import odsh_extract_value_from_extras @@ -117,7 +117,7 @@ def odsh_user_create(context, data_dict): raise logic.ValidationError(PASSWORD_ERROR_MESSAGE) -def tpsh_user_update(context, data_dict): +def odsh_user_update(context, data_dict): password = data_dict.get('password') if not password: password = data_dict.get('password1') @@ -156,7 +156,7 @@ def autocomplete(context, data_dict): def odsh_resource_create(context, data_dict): copy_remote_resources = toolkit.asbool( - tk.config.get('ckanext.odsh.copy_remote_resources', 'False') + tk.config.get('ckanext.odsh.copy_remote_resources', False) ) if copy_remote_resources: is_linked_resource = ( not 'upload' in data_dict ) or ( not isinstance(data_dict['upload'], cgi.FieldStorage)) diff --git a/ckanext/odsh/odsh_logger.py b/ckanext/odsh/odsh_logger.py index 54eea1b0bd88889c57c8b9d761580e83f654ff34..3235817b2e75a93ae061b7ce74f74e82ea284e4b 100644 --- a/ckanext/odsh/odsh_logger.py +++ b/ckanext/odsh/odsh_logger.py @@ -1,6 +1,4 @@ from multiline_formatter.formatter import MultilineMessagesFormatter -import ckan.plugins as plugins -import ckan.plugins.toolkit as toolkit class OdshLogger(MultilineMessagesFormatter): diff --git a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py index bf5199803e8959dd6a6a52b821b4938c90f9b97e..25067f73e42c669c15593b929698b3b13fec6c0e 100644 --- a/ckanext/odsh/pdf_to_thumbnail/thumbnail.py +++ b/ckanext/odsh/pdf_to_thumbnail/thumbnail.py @@ -1,17 +1,13 @@ import os -import tempfile import magic from pdf2image import convert_from_bytes import logging from ckan.common import config import urllib.request, urllib.error, urllib.parse -import requests from binascii import b2a_hex import ckan.plugins.toolkit as toolkit -import ckan.logic as logic -#from extension -#from ckanext.odsh.lib.uploader import raise_validation_error_if_virus_found + log = logging.getLogger(__name__) diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 45341ea9a59622cdbd8b81222ab1b223951534cf..6bf68dc9f93013febed9691bc5448405092fffb9 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -11,8 +11,7 @@ import ckan.plugins as plugins import ckan.plugins.toolkit as toolkit # imports from this extension -import ckanext.odsh.helpers as odsh_helpers -import ckanext.odsh.helpers_tpsh as helpers_tpsh +import ckanext.odsh.helpers as helpers_odsh import ckanext.odsh.helper_pkg_dict as helper_pkg_dict from .helper_pkg_dict import HelperPgkDict import ckanext.odsh.logic.action as action @@ -46,7 +45,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm # IBlueprint def get_blueprint(self): - log.info("OdshPlugin::get_blueprint") + log.debug("OdshPlugin::get_blueprint") # Default bp_default = default.blueprint @@ -60,7 +59,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm # DCAT # if toolkit.asbool(toolkit.config.get('ckanext.dcat.enable_rdf_endpoints', True)): - # odsh_helpers.odsh_remove_route(map, 'dcat_catalog') + # helpers_odsh.odsh_remove_route(map, 'dcat_catalog') # bp_default.add_url_rule('/catalog.<any("xml", "rdf", "n3", "ttl", "jsonld"):_format>', view_func=dcat_view.read_catalog, defaults={'_format': 'xml'}, methods=['GET']) # Package @@ -106,7 +105,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm def get_actions(self): return {'package_create': action.odsh_package_create, - 'user_update': action.tpsh_user_update, + 'user_update': action.odsh_user_update, 'user_create': action.odsh_user_create, 'resource_create': action.odsh_resource_create, } @@ -132,18 +131,18 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm def create_package_schema(self): schema = super(OdshPlugin, self).create_package_schema() self._update_schema(schema) - self._tpsh_update_create_or_update_package_schema(schema) + self._update_create_or_update_package_schema(schema) return schema def update_package_schema(self): schema = super(OdshPlugin, self).update_package_schema() self._update_schema(schema) - self._tpsh_update_create_or_update_package_schema(schema) + self._update_create_or_update_package_schema(schema) return schema def show_package_schema(self): schema = super(OdshPlugin, self).show_package_schema() - self._tpsh_update_show_package_schema(schema) + self._update_show_package_schema(schema) return schema def _update_schema(self, schema): @@ -157,10 +156,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ] }) - for i, item in enumerate(schema['tags']['name']): - if item == toolkit.get_validator('tag_name_validator'): - schema['tags']['name'][i] = toolkit.get_validator( - 'odsh_tag_name_validator') for i, item in enumerate(schema['tag_string']): if item == tag_string_convert: schema['tag_string'][i] = validation.tag_string_convert @@ -179,7 +174,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm schema.update( {'__extras': [toolkit.get_converter('odsh_validate_extras')]}) - def _tpsh_update_create_or_update_package_schema(self, schema): + def _update_create_or_update_package_schema(self, schema): schema.update({ 'language': [ toolkit.get_validator('ignore_missing'), @@ -190,7 +185,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm toolkit.get_converter('convert_to_extras') ], 'relatedPackage': [ - toolkit.get_validator('tpsh_validate_relatedPackage'), + toolkit.get_validator('validate_relatedPackage'), toolkit.get_converter('convert_to_extras') ], 'accessibility': [ @@ -200,7 +195,7 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm }) return schema - def _tpsh_update_show_package_schema(self, schema): + def _update_show_package_schema(self, schema): schema.update({ 'language': [ toolkit.get_converter('convert_from_extras'), @@ -252,9 +247,9 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm adds the following key-value-pairs to pkg_dict: # key: 'is_new', value: True if the dataset has been created within the last month ''' - pkg_dict = helpers_tpsh.correct_missing_relationship( + pkg_dict = helpers_odsh.correct_missing_relationship( pkg_dict, - helpers_tpsh.get_pkg_relationships_from_model(pkg_dict) + helpers_odsh.get_pkg_relationships_from_model(pkg_dict) ) self._update_is_new_in_pkg_dict(pkg_dict) @@ -302,41 +297,39 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm # extension they belong to, to avoid clashing with functions from # other extensions. return { - 'odsh_main_groups': odsh_helpers.odsh_main_groups, - 'odsh_now': odsh_helpers.odsh_now, - 'odsh_group_id_selected': odsh_helpers.odsh_group_id_selected, - 'odsh_get_facet_items_dict': odsh_helpers.odsh_get_facet_items_dict, - 'odsh_openness_score_dataset_html': odsh_helpers.odsh_openness_score_dataset_html, - 'odsh_get_resource_details': odsh_helpers.odsh_get_resource_details, - 'odsh_get_resource_views': odsh_helpers.odsh_get_resource_views, - 'odsh_get_bounding_box': odsh_helpers.odsh_get_bounding_box, - 'odsh_get_spatial_text': odsh_helpers.odsh_get_spatial_text, - 'odsh_render_datetime': odsh_helpers.odsh_render_datetime, - 'odsh_upload_known_formats': odsh_helpers.odsh_upload_known_formats, - 'odsh_encodeurl': odsh_helpers.odsh_encodeurl, - 'odsh_extract_error': odsh_helpers.odsh_extract_error, - 'odsh_extract_error_new': odsh_helpers.odsh_extract_error_new, - 'odsh_extract_value_from_extras': odsh_helpers.odsh_extract_value_from_extras, - 'odsh_create_checksum': odsh_helpers.odsh_create_checksum, - 'presorted_license_options': odsh_helpers.presorted_license_options, - 'odsh_has_more_facets': odsh_helpers.odsh_has_more_facets, - 'odsh_public_url': odsh_helpers.odsh_public_url, - 'odsh_spatial_extends_available': odsh_helpers.spatial_extends_available, - 'odsh_public_resource_url': odsh_helpers.odsh_public_resource_url, - 'odsh_get_version_id': odsh_helpers.odsh_get_version_id, - 'odsh_show_testbanner': odsh_helpers.odsh_show_testbanner, - 'tpsh_get_daterange_prettified': helper_pkg_dict.get_daterange_prettified, - 'tpsh_get_language_of_package': helpers_tpsh.get_language_of_package, - 'get_language_icon': helpers_tpsh.get_language_icon, - 'short_name_for_category': odsh_helpers.short_name_for_category, - 'get_spatial_for_selection': helpers_tpsh.get_spatial_for_selection, - 'get_subject_for_selection': helpers_tpsh.get_subject_for_selection, - 'get_language_for_selection': helpers_tpsh.get_language_for_selection, - 'tpsh_get_resource_size': helpers_tpsh.get_resource_size, - 'tpsh_get_address_org':helpers_tpsh.get_address_org, - 'tpsh_get_body_mail':helpers_tpsh.get_body_mail, - 'odsh_load_mdk_sample_dataset': odsh_helpers.odsh_load_mdk_sample_dataset, - 'odsh_load_raw_mdk_sample_dataset': odsh_helpers.odsh_load_raw_mdk_sample_dataset, + 'odsh_main_groups': helpers_odsh.odsh_main_groups, + 'odsh_now': helpers_odsh.odsh_now, + 'odsh_group_id_selected': helpers_odsh.odsh_group_id_selected, + 'odsh_get_facet_items_dict': helpers_odsh.odsh_get_facet_items_dict, + 'odsh_openness_score_dataset_html': helpers_odsh.odsh_openness_score_dataset_html, + 'odsh_get_resource_details': helpers_odsh.odsh_get_resource_details, + 'odsh_get_resource_views': helpers_odsh.odsh_get_resource_views, + 'odsh_get_bounding_box': helpers_odsh.odsh_get_bounding_box, + 'odsh_get_spatial_text': helpers_odsh.odsh_get_spatial_text, + 'odsh_render_datetime': helpers_odsh.odsh_render_datetime, + 'odsh_resource_formats': helpers_odsh.odsh_resource_formats, + 'odsh_encodeurl': helpers_odsh.odsh_encodeurl, + 'odsh_extract_error': helpers_odsh.odsh_extract_error, + 'odsh_extract_error_new': helpers_odsh.odsh_extract_error_new, + 'odsh_extract_value_from_extras': helpers_odsh.odsh_extract_value_from_extras, + 'odsh_create_checksum': helpers_odsh.odsh_create_checksum, + 'presorted_license_options': helpers_odsh.presorted_license_options, + 'odsh_has_more_facets': helpers_odsh.odsh_has_more_facets, + 'odsh_public_url': helpers_odsh.odsh_public_url, + 'odsh_spatial_extends_available': helpers_odsh.spatial_extends_available, + 'odsh_public_resource_url': helpers_odsh.odsh_public_resource_url, + 'odsh_show_testbanner': helpers_odsh.odsh_show_testbanner, + 'get_daterange_prettified': helper_pkg_dict.get_daterange_prettified, + 'get_language_of_package': helpers_odsh.get_language_of_package, + 'get_language_icon': helpers_odsh.get_language_icon, + 'short_name_for_category': helpers_odsh.short_name_for_category, + 'get_spatial_for_selection': helpers_odsh.get_spatial_for_selection, + 'get_language_for_selection': helpers_odsh.get_language_for_selection, + 'get_resource_size': helpers_odsh.get_resource_size, + 'get_address_org':helpers_odsh.get_address_org, + 'get_body_mail':helpers_odsh.get_body_mail, + 'odsh_load_mdk_sample_dataset': helpers_odsh.odsh_load_mdk_sample_dataset, + 'odsh_load_raw_mdk_sample_dataset': helpers_odsh.odsh_load_raw_mdk_sample_dataset, } diff --git a/ckanext/odsh/precondition.py b/ckanext/odsh/precondition.py deleted file mode 100644 index 5314133f7735723645ebc99ebc8bf2f19a0f94eb..0000000000000000000000000000000000000000 --- a/ckanext/odsh/precondition.py +++ /dev/null @@ -1,5 +0,0 @@ -import ckan.plugins.toolkit as tk - -class PreconditionViolated(Exception): - def __init__(self, message): - super(PreconditionViolated, self).__init__(message) diff --git a/ckanext/odsh/profiles/odsh_dcat_de_profile.py b/ckanext/odsh/profiles/odsh_dcat_de_profile.py index e5986f812b941a13dca6a1dd3dd0603ef945cac6..7e2026c69a5becb95103e1b4da5d35382f4d26e4 100644 --- a/ckanext/odsh/profiles/odsh_dcat_de_profile.py +++ b/ckanext/odsh/profiles/odsh_dcat_de_profile.py @@ -8,8 +8,7 @@ from ckanext.dcat.utils import resource_uri import ckanext.dcatde.dataset_utils as ds_utils from ckanext.dcatde.profiles import DCATdeProfile, DCATDE, DCAT, DCATDE_1_0, DCATDE_1_0_1 -import ckanext.odsh.helpers as odsh_helpers -import ckanext.odsh.helpers_tpsh as helpers_tpsh +import ckanext.odsh.helpers as helpers_odsh import ckanext.odsh.collection.helpers as helpers_collection @@ -49,7 +48,7 @@ class ODSHDCATdeProfile(DCATdeProfile): def _parse_type(self, dataset_dict, dataset_ref): dct_type = self._object(dataset_ref, DCT.type) if dct_type: - ckan_type = helpers_tpsh.map_dct_type_to_ckan_type(str(dct_type)) + ckan_type = helpers_odsh.map_dct_type_to_ckan_type(str(dct_type)) dataset_dict.update({'type': ckan_type}) def _parse_references(self, dataset_dict, dataset_ref): @@ -114,7 +113,7 @@ class ODSHDCATdeProfile(DCATdeProfile): Adds reference (Musterdatenkatalog/Musterdatensatz) extra field to dcat:references. ''' - sample_dataset_uri = odsh_helpers.odsh_extract_value_from_extras(dataset_dict.get('extras'), 'reference') + sample_dataset_uri = helpers_odsh.odsh_extract_value_from_extras(dataset_dict.get('extras'), 'reference') if sample_dataset_uri: self.g.set( (dataset_ref, DCT.references, @@ -150,7 +149,7 @@ class ODSHDCATdeProfile(DCATdeProfile): dct:type ''' ckan_type = self._get_ckan_type(dataset_dict) - dct_type = helpers_tpsh.map_ckan_type_to_dct_type(ckan_type) + dct_type = helpers_odsh.map_ckan_type_to_dct_type(ckan_type) if dct_type: self.g.set( (dataset_ref, DCT.type, diff --git a/ckanext/odsh/profiles/odsh_european_dcatap_profile.py b/ckanext/odsh/profiles/odsh_european_dcatap_profile.py index 4b56438b46cac14fd2b2261c490f2e25ec6950e1..2f73bd09d75659ce7ea63f10acc61ff52fea0d60 100644 --- a/ckanext/odsh/profiles/odsh_european_dcatap_profile.py +++ b/ckanext/odsh/profiles/odsh_european_dcatap_profile.py @@ -5,6 +5,7 @@ from ckan.common import config, json from ckan.model.license import LicenseRegister from ckanext.dcat.profiles import EuropeanDCATAPProfile, DCT, URIRefOrLiteral from ckanext.dcatde.profiles import DCAT +import pkg_resources log = logging.getLogger(__name__) DCT = rdflib.namespace.Namespace("http://purl.org/dc/terms/") @@ -77,8 +78,9 @@ def resource_formats(): g = rdflib.Graph() # Something went wrong with trying to get the file formats online, try to use backup instead try: + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') fallback_filepath = config.get( - 'ckanext.odsh.resource_formats_fallback_filepath') + 'ckanext.odsh.resource_formats_fallback_filepath', extension_path + '/resources/fileformats.rdf') g.parse(fallback_filepath) assert len(set([s for s in g.subjects()])) > 120 except: @@ -120,11 +122,12 @@ def get_language(): global _LANGUAGES if not _LANGUAGES: _LANGUAGES = {} - languages_file_path = config.get('ckanext.odsh.language.mapping') + languages_file_path = config.get('ckanext.odsh.language_mapping') if not languages_file_path: log.warning( - "Could not find config setting: 'ckanext.odsh.language.mapping', using fallback instead.") - languages_file_path = '/usr/lib/ckan/default/src/ckanext-odsh/languages.json' + "Could not find config setting: 'ckanext.odsh.language_mapping', using fallback instead.") + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + languages_file_path = extension_path + '/resources/languages.json' with open(languages_file_path) as languages_file: try: language_mapping_table = json.loads(languages_file.read()) diff --git a/fileformats.rdf b/ckanext/odsh/resources/fileformats.rdf similarity index 100% rename from fileformats.rdf rename to ckanext/odsh/resources/fileformats.rdf diff --git a/language_mapping.json b/ckanext/odsh/resources/language_mapping.json similarity index 100% rename from language_mapping.json rename to ckanext/odsh/resources/language_mapping.json diff --git a/languages.json b/ckanext/odsh/resources/languages.json similarity index 100% rename from languages.json rename to ckanext/odsh/resources/languages.json diff --git a/licenses.json b/ckanext/odsh/resources/licenses.json similarity index 100% rename from licenses.json rename to ckanext/odsh/resources/licenses.json diff --git a/mdk_mapping.json b/ckanext/odsh/resources/mdk_mapping.json similarity index 100% rename from mdk_mapping.json rename to ckanext/odsh/resources/mdk_mapping.json diff --git a/ckanext/odsh/resource_format_openness_scores.json b/ckanext/odsh/resources/resource_format_openness_scores.json similarity index 100% rename from ckanext/odsh/resource_format_openness_scores.json rename to ckanext/odsh/resources/resource_format_openness_scores.json diff --git a/schleswig-holstein_geojson.csv b/ckanext/odsh/resources/schleswig-holstein_geojson.csv similarity index 100% rename from schleswig-holstein_geojson.csv rename to ckanext/odsh/resources/schleswig-holstein_geojson.csv diff --git a/sh_bb.csv b/ckanext/odsh/resources/sh_bb.csv similarity index 100% rename from sh_bb.csv rename to ckanext/odsh/resources/sh_bb.csv diff --git a/subject_mapping.json b/ckanext/odsh/resources/subject_mapping.json similarity index 100% rename from subject_mapping.json rename to ckanext/odsh/resources/subject_mapping.json diff --git a/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html b/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html deleted file mode 100644 index 2ba851cb4e2ed79b62c69633d4e945a3d5b0bce5..0000000000000000000000000000000000000000 --- a/ckanext/odsh/templates/api/resource_qv4yAI2rgotamXGk98gJ.html +++ /dev/null @@ -1 +0,0 @@ -{{ h.odsh_get_version_id()}} \ No newline at end of file diff --git a/ckanext/odsh/templates/header.html b/ckanext/odsh/templates/header.html index 708d0a572b31f637fe6276466cdb759b2c8d3dc1..85f97274022d38dc50fbf15d15e2f7b325883e4c 100644 --- a/ckanext/odsh/templates/header.html +++ b/ckanext/odsh/templates/header.html @@ -1,5 +1,5 @@ {% block scripts %} -{% asset 'ckanext-odsh/tpsh_toggle_menu' %} +{% asset 'ckanext-odsh/odsh_toggle_menu' %} {% endblock scripts %} {% block header_wrapper %} @@ -24,7 +24,7 @@ </div> <h1 class='site-title'> {{ g.site_title }} </h1> </div> - <div id="menu-button-and-title" data-module="tpsh_toggle_menu"> + <div id="menu-button-and-title" data-module="odsh_toggle_menu"> <span class="fa fa-bars"></span> <h1 class='site-title-mobile'> {{ g.site_title }} </h1> </div> @@ -34,7 +34,7 @@ <div class='row navigation-row'> <nav class="section navigation"> <ul class="nav nav-pills"> - <li class="header-menu-mobile" data-module="tpsh_toggle_menu"> + <li class="header-menu-mobile" data-module="odsh_toggle_menu"> <a>{{ _('Menu') }}</a> <img src="/base/images/icon_close_white.svg" alt="Menü schließen" aria-label="Menü schließen" /> </li> diff --git a/ckanext/odsh/templates/macros/form.html b/ckanext/odsh/templates/macros/form.html index 5cd97c690c3a28e0af88db0757287fa341f49b30..57a5c2a15e205d18abfc7442b36b63a8047a692c 100644 --- a/ckanext/odsh/templates/macros/form.html +++ b/ckanext/odsh/templates/macros/form.html @@ -134,7 +134,7 @@ Examples: selected=2011, error=errors.year) }} #} -{% macro tpsh_select(name, id='', label='', options='', selected='', error='', classes=[], attrs={}, +{% macro odsh_select(name, id='', label='', options='', selected='', error='', classes=[], attrs={}, is_required=false) %} {% set classes = (classes|list) %} {% do classes.append('control-select') %} diff --git a/ckanext/odsh/templates/organization/snippets/organization_form.html b/ckanext/odsh/templates/organization/snippets/organization_form.html index 1f8f80a564586a5d99e1442667873f3f2915ccb7..c0bf3069cf2826c1873480c3692c12954b297d82 100644 --- a/ckanext/odsh/templates/organization/snippets/organization_form.html +++ b/ckanext/odsh/templates/organization/snippets/organization_form.html @@ -29,7 +29,7 @@ - {% set extras = h.tpsh_get_address_org(data) %} + {% set extras = h.get_address_org(data) %} {{ form.input_address('person','Ansprechpartner', value= extras.person , index=0, placeholder='', type='text', attrs={}) }} diff --git a/ckanext/odsh/templates/package/snippets/info.html b/ckanext/odsh/templates/package/snippets/info.html index e32c0634afa161c13fd16c7d4d3115359f794869..927f32942a7faa67e1154f94ccaaacbb1107d5b7 100644 --- a/ckanext/odsh/templates/package/snippets/info.html +++ b/ckanext/odsh/templates/package/snippets/info.html @@ -9,7 +9,7 @@ Example: #} -{% set daterange = h.tpsh_get_daterange_prettified(pkg) %} +{% set daterange = h.get_daterange_prettified(pkg) %} {% set license_attribution_by_text = h.odsh_extract_value_from_extras(pkg.extras, 'licenseAttributionByText') %} {% block package_info %} diff --git a/ckanext/odsh/templates/package/snippets/package_basic_fields.html b/ckanext/odsh/templates/package/snippets/package_basic_fields.html index 505186a55ee714b97a487f99ec191b3c469b8d26..f497f0bb4ce1774c60ab8e27444a1d18c985167c 100644 --- a/ckanext/odsh/templates/package/snippets/package_basic_fields.html +++ b/ckanext/odsh/templates/package/snippets/package_basic_fields.html @@ -230,7 +230,7 @@ dataset_is_draft)) %} {# field language #} {% set before_selected = data.get('language') or h.odsh_extract_value_from_extras(data.extras, 'language') or 'http://publications.europa.eu/resource/authority/language/DEU' %} -{{ form.tpsh_select('language', label=_('language'), options=h.get_language_for_selection(), selected=before_selected , error=errors.language, is_required=False, classes=['control-full']) }} +{{ form.odsh_select('language', label=_('language'), options=h.get_language_for_selection(), selected=before_selected , error=errors.language, is_required=False, classes=['control-full']) }} {# field spatial_uri #} diff --git a/ckanext/odsh/templates/package/snippets/resource_form.html b/ckanext/odsh/templates/package/snippets/resource_form.html index 81983e4bdbe12c55a85057acef83cc2614de70ba..fb3f99da26600dad2dde9bea8327f385ae176a6c 100644 --- a/ckanext/odsh/templates/package/snippets/resource_form.html +++ b/ckanext/odsh/templates/package/snippets/resource_form.html @@ -61,16 +61,12 @@ {% endif %} - {% block basic_fields_format %} + {% block basic_fields_format %} - {% set format_attrs = {'data-module': 'odsh_guessformat', 'data-module-formats':h.odsh_upload_known_formats()} %} - {% set format_attrs = {} %} - {% set error_string = _('odsh_resource_format_error_label') if errors.format %} - - {% call form.input('format', id='field-format', label=_('Format'), placeholder=_('eg. CSV, XML or JSON'), - value=data.format, error=error_string, is_required=true, classes=['control-full'],attrs=format_attrs) %} - {% endcall %} - {% endblock %} + {% set error_string = _('odsh_resource_format_error_label') if errors.format %} + {% set format_attrs = {'data-module': 'odsh_guessformat', 'data-module-formats':h.odsh_resource_formats(true)} %} + {{ form.odsh_select('format', id='field-format', label=_('Format'), selected=data.format, options=h.odsh_resource_formats(), is_required=True, error=error_string, attrs=format_attrs, classes=['control-full'])}} + {% endblock %} {% endblock %} <div class='row-fluid'> <div class="span6"> @@ -81,8 +77,7 @@ <button class="btn btn-arrow-right" name="save" value="go-dataset" type="submit">{{ _('Back') }}</button> {% endblock %} {% block again_button %} - <button class="btn float-right btn-arrow-right" name="save" value="again" type="submit">{{_('Another - dataset')}}</button> + <button class="btn float-right btn-arrow-right" name="save" value="again" type="submit">{{_('Another dataset')}}</button> {% endblock %} {% endif %} </div> diff --git a/ckanext/odsh/templates/package/snippets/resource_item.html b/ckanext/odsh/templates/package/snippets/resource_item.html index b08e58bdbaaf4a5afc1f9ca6191556ddf58a0f40..b6f438c0499de0ff52cbaed5d1eb8671582f166a 100644 --- a/ckanext/odsh/templates/package/snippets/resource_item.html +++ b/ckanext/odsh/templates/package/snippets/resource_item.html @@ -5,7 +5,7 @@ {% set download = h.odsh_public_resource_url(res) or url %} {% set rtitle=h.resource_display_name(res) if res.name else ' '%} -{% set resource_size = h.tpsh_get_resource_size(res) %} +{% set resource_size = h.get_resource_size(res) %} {% set res_format = res.format.replace('_SRVC','') %} <li class="resource-item" data-id="{{ res.id }}"> diff --git a/ckanext/odsh/templates/snippets/organization.html b/ckanext/odsh/templates/snippets/organization.html index 3465d5cd16a241ea896ad76ae02db4a96479c4af..86e9203407ce2d9c79d58d40c9040059232172ce 100644 --- a/ckanext/odsh/templates/snippets/organization.html +++ b/ckanext/odsh/templates/snippets/organization.html @@ -34,7 +34,7 @@ Example: </div> <div class="information-organisation"> - {% set address = h.tpsh_get_address_org(organization) %} + {% set address = h.get_address_org(organization) %} {% set street = address.get('street') %} {% set location = address.get('location') %} {% set mail = address.get('mail') %} @@ -56,7 +56,7 @@ Example: {% if package %} {% set package_name = package.get('name') %} {% set betreff = "Open-Data-Portal Datensatz: "+ package_name%} - {% set body_mail = h.tpsh_get_body_mail(organization, package) %} + {% set body_mail = h.get_body_mail(organization, package) %} {% else %} {% set betreff = "Transparenzportal" %} {% endif %} {# package #} diff --git a/ckanext/odsh/templates/snippets/package_item.html b/ckanext/odsh/templates/snippets/package_item.html index 7130ddce2dbb567275c5259d1d1c2858a5aa451d..4c2c1a67774a79dfbd30da731d5638bcef9e90a1 100644 --- a/ckanext/odsh/templates/snippets/package_item.html +++ b/ckanext/odsh/templates/snippets/package_item.html @@ -26,8 +26,8 @@ Example: {% set access_count=(package.tracking_summary.total if package.tracking_summary) or '-' %} {% set issued_extra = h.odsh_extract_value_from_extras(package.extras,'issued') %} {% set issued = h.odsh_render_datetime(issued_extra) if issued_extra else h.odsh_render_datetime(package.metadata_created)%} -{% set daterange = h.tpsh_get_daterange_prettified(package) %} -{% set language_of_package = h.tpsh_get_language_of_package(package) %} +{% set daterange = h.get_daterange_prettified(package) %} +{% set language_of_package = h.get_language_of_package(package) %} {% set language_icon = h.get_language_icon(package) %} {% set thumbnail = package.get('thumbnail') %} @@ -36,6 +36,11 @@ Example: {% block content %} <div class="dataset-content"> {% block heading %} + {% if package.get('type') == 'collection' %} + <div class='package-info-pill'> + {{ _('Data series') }} + </div> + {% endif %} {%if daterange %} <div class='package-info-pill'> {{ daterange }} diff --git a/ckanext/odsh/templates/user/edit_user_form.html b/ckanext/odsh/templates/user/edit_user_form.html index 057a29155668ff269d187f13631828f1dc7cafca..3ed5777bdcc949c347d79c70391f12a5b9560b32 100644 --- a/ckanext/odsh/templates/user/edit_user_form.html +++ b/ckanext/odsh/templates/user/edit_user_form.html @@ -35,7 +35,7 @@ ) }} {{ form.input( - 'password1', type='password', label=_('Password'), id='field-password', value=data.password1, error=errors.password1, classes=['control-medium'], attrs={'autocomplete': 'off', 'data-module': 'tpsh_validate_password'} ) }} + 'password1', type='password', label=_('Password'), id='field-password', value=data.password1, error=errors.password1, classes=['control-medium'], attrs={'autocomplete': 'off', 'data-module': 'odsh_validate_password'} ) }} {{ form.input('password2', type='password', label=_('Confirm Password'), id='field-password-confirm', value=data.password2, error=errors.password2, classes=['control-medium'], attrs={'autocomplete': 'off'}) }} </fieldset> @@ -57,5 +57,5 @@ </form> {% block scripts %} - {% asset 'ckanext-odsh/tpsh_validate_password' %} + {% asset 'ckanext-odsh/odsh_validate_password' %} {% endblock scripts %} \ No newline at end of file diff --git a/ckanext/odsh/tests_tpsh/__init__.py b/ckanext/odsh/tests/resources/__init__.py similarity index 100% rename from ckanext/odsh/tests_tpsh/__init__.py rename to ckanext/odsh/tests/resources/__init__.py diff --git a/ckanext/odsh/tests_tpsh/resources/collection1.rdf b/ckanext/odsh/tests/resources/collection1.rdf similarity index 100% rename from ckanext/odsh/tests_tpsh/resources/collection1.rdf rename to ckanext/odsh/tests/resources/collection1.rdf diff --git a/ckanext/odsh/tests_tpsh/resources/org_dicts.py b/ckanext/odsh/tests/resources/org_dicts.py similarity index 100% rename from ckanext/odsh/tests_tpsh/resources/org_dicts.py rename to ckanext/odsh/tests/resources/org_dicts.py diff --git a/ckanext/odsh/tests_tpsh/resources/test.pdf b/ckanext/odsh/tests/resources/test.pdf similarity index 100% rename from ckanext/odsh/tests_tpsh/resources/test.pdf rename to ckanext/odsh/tests/resources/test.pdf diff --git a/ckanext/odsh/tests_tpsh/test_checksum.py b/ckanext/odsh/tests/test_checksum.py similarity index 99% rename from ckanext/odsh/tests_tpsh/test_checksum.py rename to ckanext/odsh/tests/test_checksum.py index 1d4dda63b9d19d656db07c601a5a127e084a7f87..147d76581e432cc146b6e991335648b42e53f7d3 100644 --- a/ckanext/odsh/tests_tpsh/test_checksum.py +++ b/ckanext/odsh/tests/test_checksum.py @@ -1,6 +1,5 @@ from mock import patch, mock_open from ckanext.odsh.lib.uploader import _raise_validation_error_if_hash_values_differ, calculate_hash -import ckantoolkit as ct import ckan.logic as logic import hashlib import unittest diff --git a/ckanext/odsh/tests_tpsh/test_date_range.py b/ckanext/odsh/tests/test_date_range.py similarity index 100% rename from ckanext/odsh/tests_tpsh/test_date_range.py rename to ckanext/odsh/tests/test_date_range.py diff --git a/ckanext/odsh/tests_tpsh/test_date_range_formatter.py b/ckanext/odsh/tests/test_date_range_formatter.py similarity index 100% rename from ckanext/odsh/tests_tpsh/test_date_range_formatter.py rename to ckanext/odsh/tests/test_date_range_formatter.py diff --git a/ckanext/odsh/tests_tpsh/test_helper_pkg_dict.py b/ckanext/odsh/tests/test_helper_pkg_dict.py similarity index 96% rename from ckanext/odsh/tests_tpsh/test_helper_pkg_dict.py rename to ckanext/odsh/tests/test_helper_pkg_dict.py index 504966e83d62d42f8caa05914bdf3fe6cd4d660e..6e5b3267ee2947bae45c3df51589244869cffa08 100644 --- a/ckanext/odsh/tests_tpsh/test_helper_pkg_dict.py +++ b/ckanext/odsh/tests/test_helper_pkg_dict.py @@ -3,7 +3,7 @@ from mock import patch, call import unittest from ckanext.odsh.helper_pkg_dict import HelperPgkDict -import ckanext.odsh.helpers_tpsh as helpers_tpsh +import ckanext.odsh.helpers as helpers_odsh import ckanext.odsh.uri_store as uri_store class TestHelperPkgDict(unittest.TestCase): @@ -46,7 +46,7 @@ class TestHelperPkgDict(unittest.TestCase): assert not (shall_be_part_of_collection) def test_update_relations_to_collection_members_leads_to_correct_call_of_add_to_collection(self): - with patch.object(helpers_tpsh, 'add_pkg_to_collection') as patch_add_package_to_collection: + with patch.object(helpers_odsh, 'add_pkg_to_collection') as patch_add_package_to_collection: # arange # taken from debugging _update_relations_to_collection_members: dataset_dict_collection = { @@ -72,7 +72,7 @@ class TestHelperPkgDict(unittest.TestCase): uri_store._set_uri_to_id({}) def test_update_relation_to_collection_leads_to_correct_call_of_add_to_collection(self): - with patch.object(helpers_tpsh, 'add_pkg_to_collection') as patch_add_package_to_collection: + with patch.object(helpers_odsh, 'add_pkg_to_collection') as patch_add_package_to_collection: # arange # taken from debugging _update_relations_to_collection_members: dataset_dict_collection_member = { @@ -141,7 +141,6 @@ class Test_get_date_start_and_end_from_pkg_dict(unittest.TestCase): {'key': 'groups', 'value': ''}, {'key': 'issued', 'value': '2019-07-06T00:00:00'}, {'key': 'licenseAttributionByText', 'value': ''}, - {'key': 'subject_text', 'value': ''}, {'key': 'temporal_end', 'value': '2019-08-31T00:00:00'}, {'key': 'temporal_start', 'value': '2019-08-01T00:00:00'} ], @@ -151,7 +150,6 @@ class Test_get_date_start_and_end_from_pkg_dict(unittest.TestCase): {'key': 'groups', 'value': ''}, {'key': 'issued', 'value': '2019-07-06T00:00:00'}, {'key': 'licenseAttributionByText', 'value': ''}, - {'key': 'subject_text', 'value': ''}, {'key': 'temporal_end', 'value': '2019-08-31T00:00:00'}, {'key': 'temporal_start', 'value': ''} ], @@ -161,7 +159,6 @@ class Test_get_date_start_and_end_from_pkg_dict(unittest.TestCase): {'key': 'groups', 'value': ''}, {'key': 'issued', 'value': '2019-07-06T00:00:00'}, {'key': 'licenseAttributionByText', 'value': ''}, - {'key': 'subject_text', 'value': ''}, {'key': 'temporal_end', 'value': ''}, {'key': 'temporal_start', 'value': '2019-08-01T00:00:00'} ], diff --git a/ckanext/odsh/tests_tpsh/test_helpers_tpsh.py b/ckanext/odsh/tests/test_helpers_tpsh.py similarity index 78% rename from ckanext/odsh/tests_tpsh/test_helpers_tpsh.py rename to ckanext/odsh/tests/test_helpers_tpsh.py index 7af9b58967175bac75c0c918c941e040c60fe58c..3c3f4ca3c30322bcbeffd2b9940d51b84046c3fa 100644 --- a/ckanext/odsh/tests_tpsh/test_helpers_tpsh.py +++ b/ckanext/odsh/tests/test_helpers_tpsh.py @@ -1,25 +1,19 @@ # encoding: utf-8 -import os from collections import namedtuple, OrderedDict -import datetime from mock import patch from ckan.common import config -import ckan.logic.action.create as create -from ckanext.odsh.tests_tpsh.resources import org_dicts +from ckanext.odsh.tests.resources import org_dicts import unittest -from ckanext.odsh.helpers_tpsh import ( +from ckanext.odsh.helpers import ( map_dct_type_to_ckan_type, map_ckan_type_to_dct_type, - add_pkg_to_collection, correct_missing_relationship, get_language_of_package, get_address_org, load_json_to_ordered_dict, - load_subject_mapping, - get_subject_for_selection ) @@ -156,7 +150,7 @@ class Test_correct_missing_relationship(unittest.TestCase): class Test_get_language_of_package(unittest.TestCase): def setUp(self): - config.update({'ckanext.odsh.language_mapping': '/usr/lib/ckan/default/src/ckanext-odsh/language_mapping.json'}) + config.update({'ckanext.odsh.language_mapping': '/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/resources/language_mapping.json'}) def tearDown(self): config.clear() @@ -202,11 +196,6 @@ class Test_get_address_org(unittest.TestCase): assert len(address) == 0 -def _add_subject_mapping_file_to_config(): - path_current_file = os.path.dirname(os.path.abspath(__file__)) - path_to_subject_mapping_file = path_current_file + '/resources/subject_mapping_for_tests.json' - config.update({'ckanext.odsh.subject_mapping': path_to_subject_mapping_file}) - class Test_load_json_to_ordered_dict(unittest.TestCase): def setUp(self): json_str = '{"A": 1, "B": 2, "D": 3, "C":4, "E": 0}' @@ -225,40 +214,3 @@ class Test_load_json_to_ordered_dict(unittest.TestCase): def test_it_preserves_order_of_values(self): values = list(self.result.values()) assert values == [1, 2, 3, 4, 0] - -class Test_load_subject_mapping(unittest.TestCase): - def setUp(self): - _add_subject_mapping_file_to_config() - self.SUBJECT_MAPPING = load_subject_mapping() - - def tearDown(self): - config.clear() - - def test_it_returns_an_ordered_dictionary(self): - assert type(self.SUBJECT_MAPPING) is OrderedDict - - def test_it_preserves_order_of_json_file(self): - keys = list(self.SUBJECT_MAPPING.keys()) - assert keys[0] == 'http://transparenz.schleswig-holstein.de/informationsgegenstand#Verwaltungsvorschrift' - assert keys[1] == 'http://transparenz.schleswig-holstein.de/informationsgegenstand#Organisationsplan' - assert keys[2] == 'http://transparenz.schleswig-holstein.de/informationsgegenstand#Geschaeftsverteilungsplan' - assert keys[3] == 'http://transparenz.schleswig-holstein.de/informationsgegenstand#Aktenplan' - -class Test_get_subject_for_selection(unittest.TestCase): - def setUp(self): - _add_subject_mapping_file_to_config() - self.result = get_subject_for_selection() - - def tearDown(self): - config.clear() - - def test_it_returns_a_list(self): - assert type(self.result) is list - - def test_first_element_is_empty(self): - assert self.result[0] == {'key': 'empty', 'value': ' '} - - def test_it_contains_more_than_one_element(self): - assert len(self.result) > 1 - - diff --git a/ckanext/odsh/tests_tpsh/test_odsh_helpers.py b/ckanext/odsh/tests/test_odsh_helpers.py similarity index 89% rename from ckanext/odsh/tests_tpsh/test_odsh_helpers.py rename to ckanext/odsh/tests/test_odsh_helpers.py index 0f5a788a5434753afdc702ac95070db107223071..fba58f02bb22c6da9da263addc0a2b4bd4e24c18 100644 --- a/ckanext/odsh/tests_tpsh/test_odsh_helpers.py +++ b/ckanext/odsh/tests/test_odsh_helpers.py @@ -2,12 +2,7 @@ import datetime from mock import patch import unittest -import ckan.lib.helpers as helpers - -import ckanext.odsh.helpers as odsh_helpers from ckanext.odsh.helpers import is_within_last_month -import ckanext.odsh.collection.helpers as helpers_collection -import ckan.model as model class Test_is_within_last_month(unittest.TestCase): def test_it_returns_true_for_simple_query(self): diff --git a/ckanext/odsh/tests_tpsh/test_password_validation.py b/ckanext/odsh/tests/test_password_validation.py similarity index 100% rename from ckanext/odsh/tests_tpsh/test_password_validation.py rename to ckanext/odsh/tests/test_password_validation.py diff --git a/ckanext/odsh/tests/test_plugin.py b/ckanext/odsh/tests/test_plugin.py index af2f6e90324119090a8d6ca0c324b900e4cb1690..140bd8ae92afc4a21e9235038898f13a3da489b8 100644 --- a/ckanext/odsh/tests/test_plugin.py +++ b/ckanext/odsh/tests/test_plugin.py @@ -1,30 +1,53 @@ -import paste.fixture -import pylons.test -import ckan.plugins -import ckan.model as model -import ckan.tests.factories as factories -import ckan.tests.legacy as tests -from ckan.common import config +import datetime +import ckanext.odsh.plugin as plugin +import unittest -# class TestOdshPlugin(object): +class TestMethodBeforeView(unittest.TestCase): + date_time_format = '%Y-%m-%dT%H:%M:%S' -# @classmethod -# def setup_class(cls): -# cls.app = paste.fixture.TestApp(pylons.test.pylonsapp) -# ckan.plugins.load('odsh') + def test_before_view_adds_false_for_old_dataset(self): + plugin_object = plugin.OdshPlugin() + today = datetime.date.today() + hundred_days_ago = today - datetime.timedelta(days=100) + hundred_days_ago_as_ckan_str = self._date_as_ckan_str(hundred_days_ago) + dict_for_template = plugin_object.before_view( + { + 'extras': [ + {'key': 'issued', 'value': hundred_days_ago_as_ckan_str} + ] + } + ) + assert dict_for_template['is_new']==False -# def teardown(self): -# model.repo.rebuild_db() + def _date_as_ckan_str(self, date): + return date.strftime(self.date_time_format) -# @classmethod -# def teardown_class(cls): -# ckan.plugins.unload('odsh') - -# def test_plugin(self): -# pass - -# def test_user_cannot_access_dashboard(self): -# user = factories.User() -# tests.call_action_api(self.app, 'group_create', name='test-group', -# apikey=user['apikey']) + def test_before_view_adds_true_for_new_dataset(self): + plugin_object = plugin.OdshPlugin() + today = datetime.date.today() + ten_days_ago = today - datetime.timedelta(days=10) + ten_days_ago_as_ckan_str = self._date_as_ckan_str(ten_days_ago) + dict_for_template = plugin_object.before_view( + { + 'extras': [ + {'key': 'issued', 'value': ten_days_ago_as_ckan_str} + ] + } + ) + assert dict_for_template['is_new']==True + + def test_before_view_does_not_modify_unconcerned_dict_values(self): + plugin_object = plugin.OdshPlugin() + today = datetime.date.today() + ten_days_ago = today - datetime.timedelta(days=10) + ten_days_ago_as_ckan_str = self._date_as_ckan_str(ten_days_ago) + dict_for_template = plugin_object.before_view( + { + 'extras': [ + {'key': 'issued', 'value': ten_days_ago_as_ckan_str} + ], + 'some_other_key': 'some_other_value', + } + ) + assert dict_for_template['some_other_key']=='some_other_value' diff --git a/ckanext/odsh/tests_tpsh/test_profiles.py b/ckanext/odsh/tests/test_profiles.py similarity index 77% rename from ckanext/odsh/tests_tpsh/test_profiles.py rename to ckanext/odsh/tests/test_profiles.py index 1ec5d80a8d6df7901ea6925b5ddbf19d3e77a720..953a201ce426c3be898260ec3b40649aedf7cb83 100644 --- a/ckanext/odsh/tests_tpsh/test_profiles.py +++ b/ckanext/odsh/tests/test_profiles.py @@ -6,7 +6,6 @@ from mock import patch from ckanext.dcat.profiles import URIRefOrLiteral import ckanext.odsh.profiles as profiles -import ckanext.odsh.helper_pkg_dict as helper_pkg_dict DCT = rdflib.namespace.Namespace("http://purl.org/dc/terms/") @@ -18,7 +17,7 @@ class TestODSHDCATdeProfileParseDatasetWithCollection(unittest.TestCase): ''' def setUp(self): rdf_graph = Graph() - rdf_graph.parse('ckanext/odsh/tests_tpsh/resources/collection1.rdf') + rdf_graph.parse('ckanext/odsh/tests/resources/collection1.rdf') self.profile = profiles.ODSHDCATdeProfile(rdf_graph) self.dataset_ref_with_collection = URIRefOrLiteral( 'http://opendata.schleswig-holstein.de/dataset/LAsDSH_SER_Statistik_anerkannte_Versorgungsberechtigte' @@ -59,30 +58,6 @@ class TestODSHDCATdeProfileParseDatasetWithCollection(unittest.TestCase): belongs_to_collection = self.profile._belongs_to_collection( dataset_dict, self.dataset_ref_with_member_not_in_collection) assert not belongs_to_collection - - -class TestODSHDCATdeProfileParseDatasetWithSubject(unittest.TestCase): - ''' - Tests for ODSHDCATdeProfile.parse_dataset with an rdf file - containing datasets with subjects - ''' - def setUp(self): - rdf_graph = Graph() - rdf_graph.parse('ckanext/odsh/tests_tpsh/resources/transparenz.rdf') - self.profile = profiles.ODSHDCATdeProfile(rdf_graph) - self.dataset_ref_with_subject = URIRefOrLiteral( - 'http://transparenz.schleswig-holstein.de/ae2a3cffda84388365bc87711ed4af47' - ) - - def test_parse_subject_returns_subject(self): - dataset_dict = {} - self.profile._parse_subject(dataset_dict, self.dataset_ref_with_subject) - assert 'http://d-nb.info/gnd/4128022-2' == dataset_dict['subject'] - - def test_parse_dataset_returns_subject(self): - dataset_dict = {} - self.profile.parse_dataset(dataset_dict, self.dataset_ref_with_subject) - assert 'http://d-nb.info/gnd/4128022-2' == dataset_dict['subject'] class TestODSHDCATdeProfileGraphFromDataset(unittest.TestCase): @@ -96,7 +71,7 @@ class TestODSHDCATdeProfileGraphFromDataset(unittest.TestCase): def get_graph_and_assert_in(self, dataset_dict, dataset_ref, expected_node): self.profile.graph_from_dataset(dataset_dict, dataset_ref) - graph_serialized = self.profile.g.serialize() + graph_serialized = self.profile.g.serialize(format='pretty-xml') print((self.profile.g.serialize(format='pretty-xml'))) assert expected_node in graph_serialized @@ -114,17 +89,6 @@ class TestODSHDCATdeProfileGraphFromDataset(unittest.TestCase): ) - @patch_no_collection_member - def test_it_adds_dct_subject(self, __): - dataset_dict = { - 'subject': 'http://some_subject', - 'type': 'dataset', - 'groups': [], - } - expected_node = '<dct:subject rdf:resource="http://some_subject"/>' - self.get_graph_and_assert_in(dataset_dict, self.dummy_dataset_ref, expected_node) - - @patch_no_collection_member def test_it_adds_dct_type_collection(self, __): dataset_dict = { @@ -181,4 +145,4 @@ class TestODSHDCATdeProfileGraphFromDataset(unittest.TestCase): self.profile._remove_predefined_collection_members() graph_serialized = self.profile.g.serialize() for ref in refs: - assert ref in graph_serialized + assert ref not in graph_serialized diff --git a/ckanext/odsh/tests/test_search.py b/ckanext/odsh/tests/test_search.py index 854a7917a5f7a0c3a8e27ccafe1cae33f153f185..0988d909ce2f5e86cc9af2822abd03169653a5ec 100644 --- a/ckanext/odsh/tests/test_search.py +++ b/ckanext/odsh/tests/test_search.py @@ -1,253 +1,133 @@ -# encoding: utf-8 - -import ckan.tests.factories as factories -import ckan.tests.helpers as helpers -from bs4 import BeautifulSoup -from ckan import model -from ckan.lib.mailer import create_reset_key -from routes import url_for -import ckan.plugins -from .test_helpers import odsh_test -import pdb - - - -class TestSearch(helpers.FunctionalTestBase): - - _load_plugins = ['odsh', 'spatial_metadata', 'spatial_query'] - - def teardown(self): - model.repo.rebuild_db() - - @odsh_test() - def test_dataset_is_in_search_result(self): - # arrange - dataset = self._create_dataset() - - # act - response = self._perform_search() - - # assert - assert dataset['name'] in response - - @odsh_test() - def test_query_with_no_match_finds_no_dataset(self): - # arrange - dataset = self._create_dataset() - - # act - response = self._perform_search("foobar") - - # assert - self._assert_no_results(response) - - @odsh_test() - def test_query_with_no_dates_finds_dataset(self): - # arrange - dataset = self._create_dataset() - +import ckanext.odsh.search as search +import unittest + +class Test_before_search(unittest.TestCase): + def setUp(self): + self.search_params_before_test = { + 'extras': {}, + 'facet.field': ['organization', 'groups'], + 'fq': 'organization:"test-organisation" groups:"gove" +dataset_type:dataset', + 'include_private': True, + 'q': '', + 'rows': 20, + 'sort': 'score desc, metadata_modified desc', + 'start': 0 + } + self.search_params_with_facet_mincount = self.search_params_before_test.copy() + self.search_params_with_facet_mincount.update({'facet.mincount': 0}) + + def test_it_solely_adds_facet_mincount_to_dict_if_no_extras(self): + # arange + search_params = self.search_params_before_test.copy() # act - response = self._perform_date_search(None, None) - + search.before_search(search_params) # assert - assert dataset['name'] in response - - @odsh_test() - def test_query_with_very_old_dataset(self): - # arrange - dataseta = self._create_dataset('do_not_find_me', '2011-01-01', '2013-12-31') - datasetb = self._create_dataset('old_dataset', '1111-01-01', '1860-12-31') - - # act - response = self._perform_date_search('1110-12-30', '1960-02-01') - - # assert - assert 'wrong_start_date_for_search' not in response - self._assert_datasets_in_response([datasetb], response) - self._assert_datasets_not_in_response([dataseta], response) - - @odsh_test() - def test_query_with_end_before_start_finds_no_dataset(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31') - - # act - response = self._perform_date_search('1960-12-30', '1960-02-01') - - # assert - self._assert_no_results(response) - - @odsh_test() - def test_query_with_wrong_dates_shows_error(self): - # arrange - dataset = self._create_dataset() - + search_params_expected = self.search_params_with_facet_mincount.copy() + assert search_params == search_params_expected + + def test_it_adds_fq_if_empty_range(self): + # arange + search_params = self.search_params_before_test.copy() + extras = {'ext_enddate': '2019-08-01', 'ext_startdate': '2019-08-02'} + search_params.update({'extras': extras}) + search_params_expected = self.search_params_with_facet_mincount.copy() + search_params_expected.update({'extras': extras}) + search_params_expected.update({ + 'fq': ( + 'organization:"test-organisation" groups:"gove" ' + '+dataset_type:dataset (+extras_temporal_start:[2019-08-02T00:00:00Z TO 2019-08-01T00:00:00Z] ' + 'OR +extras_temporal_end:[2019-08-02T00:00:00Z TO 2019-08-01T00:00:00Z] OR ' + '((*:* NOT extras_temporal_end:[* TO *]) AND extras_temporal_start:[* TO 2019-08-01T00:00:00Z]))' + ) + }) # act - response1 = self._perform_date_search('foo', None) - response2 = self._perform_date_search(None, 'foo') - response3 = self._perform_date_search('11-11-11', None) - + search.before_search(search_params) # assert - assert 'wrong_start_date_for_search' in response1 - self._assert_datasets_in_response([dataset], response1) - assert 'daterange: to' not in response1 - assert 'daterange: from' not in response1 - assert 'wrong_end_date_for_search' in response2 - self._assert_datasets_in_response([dataset], response2) - assert 'daterange: to' not in response2 - assert 'daterange: from' not in response2 - assert 'wrong_start_date_for_search' in response3 - assert 'daterange: to' not in response3 - assert 'daterange: from' not in response3 - self._assert_datasets_in_response([dataset], response3) - - @odsh_test() - def test_query_with_start_date_finds_one_dataset(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31') - datasetB = self._create_dataset('datasetb', '1980-01-01', '1990-06-30') - datasetC = self._create_dataset('datasetc', '2001-03-01', '2001-04-30') - + assert search_params == search_params_expected + + def test_it_solely_adds_facet_mincount_to_dict_if_wrong_date_format_in_extras(self): + # arange + search_params = self.search_params_before_test.copy() + extras = {'ext_enddate': 'some_date', 'ext_startdate': 'some_date'} + search_params.update({'extras': extras}) + search_params_expected = self.search_params_with_facet_mincount.copy() + search_params_expected.update({'extras': extras}) # act - response1 = self._perform_date_search(None, '1990-01-01') - response2 = self._perform_date_search(None, '2010-12-31') - response3 = self._perform_date_search('2010-12-31', None) - response4 = self._perform_date_search('1985-04-01', '1985-04-20') - response5 = self._perform_date_search('2001-04-01', None) - + search.before_search(search_params) # assert - self._assert_datasets_in_response([datasetA, datasetB], response1) - self._assert_datasets_not_in_response([datasetC], response1) - assert 'daterange: to' in response1 - - self._assert_datasets_in_response( - [datasetA, datasetB, datasetC], response2) - assert 'daterange: to' in response2 - - self._assert_no_results(response3) - assert 'daterange: from' in response3 - - self._assert_datasets_in_response([datasetB], response4) - self._assert_datasets_not_in_response([datasetA, datasetC], response4) - assert 'daterange: to' in response4 - assert 'daterange: from' in response4 - - self._assert_datasets_in_response([datasetC], response5) - self._assert_datasets_not_in_response([datasetA, datasetB], response5) - - @odsh_test() - def test_dataset_combime_date_range_search_and_text_search_same_title(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31','mytitle') - datasetB = self._create_dataset('datasetb', '1980-01-01', '1990-06-30', 'mytitle') - + assert search_params == search_params_expected + + def test_it_adds_fq_if_enclosing_range(self): + # arange + search_params = self.search_params_before_test.copy() + extras = {'ext_enddate': '2019-08-02', 'ext_startdate': '2019-08-01'} + search_params.update({'extras': extras}) + search_params_expected = self.search_params_with_facet_mincount.copy() + search_params_expected.update({'extras': extras}) + search_params_expected.update({ + 'fq': ( + 'organization:"test-organisation" groups:"gove" ' + '+dataset_type:dataset ' + '(+extras_temporal_start:[2019-08-01T00:00:00Z TO 2019-08-02T00:00:00Z] ' + 'OR +extras_temporal_end:[2019-08-01T00:00:00Z TO 2019-08-02T00:00:00Z] ' + 'OR (extras_temporal_start:[* TO 2019-08-01T00:00:00Z] AND ' + 'extras_temporal_end:[2019-08-02T00:00:00Z TO *]) OR ' + '((*:* NOT extras_temporal_end:[* TO *]) AND ' + 'extras_temporal_start:[* TO 2019-08-02T00:00:00Z]))' + ) + }) # act - response = self._perform_text_and_date_search('mytitle', None, '1970-01-01') - + search.before_search(search_params) # assert - self._assert_datasets_in_response([datasetA], response) - self._assert_datasets_not_in_response([datasetB], response) - - @odsh_test() - def test_dataset_combime_date_range_search_and_text_search_same_dates(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31','mytitle') - datasetB = self._create_dataset('datasetb', '1960-01-01', '1960-12-31','othertitle') - datasetC = self._create_dataset('datasetc', '1980-01-01', '1990-06-30', 'mytitle') - + assert search_params == search_params_expected + + def test_it_adds_fq_if_start_only(self): + # arange + search_params = self.search_params_before_test.copy() + extras = {'ext_startdate': '2019-08-01'} + search_params.update({'extras': extras}) + search_params_expected = self.search_params_with_facet_mincount.copy() + search_params_expected.update({'extras': extras}) + search_params_expected.update({ + 'fq': ( + 'organization:"test-organisation" groups:"gove" ' + '+dataset_type:dataset ' + '(+extras_temporal_start:[2019-08-01T00:00:00Z TO *] ' + 'OR +extras_temporal_end:[2019-08-01T00:00:00Z TO *] ' + 'OR (*:* NOT extras_temporal_end:[* TO *]))' + ) + }) # act - response = self._perform_text_and_date_search('mytitle', None, '1970-01-01') - + search.before_search(search_params) # assert - self._assert_datasets_in_response([datasetA], response) - self._assert_datasets_not_in_response([datasetB, datasetC], response) - - @odsh_test() - def test_dataset_without_end(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', None,'mytitle') - + assert search_params == search_params_expected + + def test_it_adds_fq_if_end_only(self): + # arange + search_params = self.search_params_before_test.copy() + extras = {'ext_enddate': '2019-08-02'} + search_params.update({'extras': extras}) + search_params_expected = self.search_params_with_facet_mincount.copy() + search_params_expected.update({'extras': extras}) + search_params_expected.update({ + 'fq': ( + 'organization:"test-organisation" groups:"gove" ' + '+dataset_type:dataset ' + '(+extras_temporal_start:[* TO 2019-08-02T00:00:00Z] OR ' + '+extras_temporal_end:[* TO 2019-08-02T00:00:00Z] ' + 'OR ((*:* NOT extras_temporal_end:[* TO *]) ' + 'AND extras_temporal_start:[* TO 2019-08-02T00:00:00Z]))' + ) + }) # act - response1 = self._perform_text_and_date_search('mytitle', '1950-01-01', '1950-02-01') - response2 = self._perform_text_and_date_search('mytitle', '1950-01-01', '1960-02-01') - response3 = self._perform_text_and_date_search('mytitle', '1950-01-01', None) - response4 = self._perform_text_and_date_search('mytitle', None, '1970-01-01') - response5 = self._perform_text_and_date_search('mytitle', '1970-01-01', '1980-02-01') - response6 = self._perform_text_and_date_search('mytitle', None, '1950-01-01') - + search.before_search(search_params) # assert - self._assert_datasets_not_in_response([datasetA], response1) - self._assert_datasets_in_response([datasetA], response2) - self._assert_datasets_in_response([datasetA], response3) - self._assert_datasets_in_response([datasetA], response4) - self._assert_datasets_in_response([datasetA], response5) - self._assert_datasets_not_in_response([datasetA], response6) - - @odsh_test() - def test_dataset_new_has_label(self): - # arrange - datasetA = self._create_dataset('dataseta', '1960-01-01', None,'mytitle') - + assert search_params == search_params_expected + + def test_it_returns_search_params(self): + # arange + search_params = self.search_params_before_test.copy() # act - response = self._perform_text_and_date_search('mytitle', None, None) - + return_value = search.before_search(search_params) # assert - response.mustcontain('new-dataset-label') - - def _assert_datasets_in_response(self, datasets, response): - for dataset in datasets: - assert dataset['name'] in response - - def _assert_datasets_not_in_response(self, datasets, response): - for dataset in datasets: - assert dataset['name'] not in response - - def _assert_no_results(self, response): - assert "No datasets found" in response - - def _create_dataset(self, name='my-own-dataset', temporal_start='2000-01-27', temporal_end='2000-01-27',title='title'): - user = factories.User() - extras = [ - {'key': 'temporal_start', 'value': temporal_start}, - {'key': 'temporal_end', 'value': temporal_end}, - {'key': 'issued', 'value': '2000-01-27'}, - {'key': 'groups', 'value': 'soci'}, - {'key': 'licenseAttributionByText', 'value': 'text'}, - {'key': 'spatial_uri', 'value': 'http://dcat-ap.de/def/politicalGeocoding/districtKey/01001'} - ] - return factories.Dataset(user=user, - name=name, - title=title, - issued='27-01-2000', - extras=extras, - license_id='http://dcat-ap.de/def/licenses/dl-by-de/2.0') - - def _perform_search(self, query=None): - search_form = self._perform_search_for_form('dataset-search-box-form') - if query is not None: - search_form['q'] = query - return helpers.webtest_submit(search_form) - - def _perform_date_search(self, search_from, search_to): - search_form = self._perform_search_for_form('dataset-search-box-form') - if search_form is not None: - search_form['ext_startdate'] = search_from - if search_to is not None: - search_form['ext_enddate'] = search_to - return helpers.webtest_submit(search_form) - - def _perform_text_and_date_search(self, query, search_from, search_to): - search_form = self._perform_search_for_form('dataset-search-box-form') - search_form['q'] = query - if search_form is not None: - search_form['ext_startdate'] = search_from - if search_to is not None: - search_form['ext_enddate'] = search_to - return helpers.webtest_submit(search_form) - - def _perform_search_for_form(self, form): - search_url = url_for(named_route='dataset.search') - search_response = self._get_test_app().get(search_url) - - search_form = search_response.forms[form] - return search_form + assert search_params == return_value diff --git a/ckanext/odsh/tests_tpsh/test_uri_store.py b/ckanext/odsh/tests/test_uri_store.py similarity index 100% rename from ckanext/odsh/tests_tpsh/test_uri_store.py rename to ckanext/odsh/tests/test_uri_store.py diff --git a/ckanext/odsh/tests_tpsh/resources/subject_mapping_for_tests.json b/ckanext/odsh/tests_tpsh/resources/subject_mapping_for_tests.json deleted file mode 100644 index 2e8bd946d9237ed177f8d3759defc4732d2f8ddf..0000000000000000000000000000000000000000 --- a/ckanext/odsh/tests_tpsh/resources/subject_mapping_for_tests.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Verwaltungsvorschrift" : "Verwaltungsvorschrift", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Organisationsplan" : "Organisationsplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Geschaeftsverteilungsplan" : "Geschäftsverteilungsplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Aktenplan" : "Aktenplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Richtlinie" : "Richtlinie und Runderlass", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Statistik" : "amtliche Statistik", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Taetigkeitsbericht" : "Tätigkeitsbericht", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Broschuere" : "Broschüre", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Gutachten" : "Gutachten", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Studie" : "Studie", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Haushaltsplan" : "Haushaltsplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Stellenplan" : "Stellenplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Wirtschaftsplan" : "Wirtschaftsplan", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#ZuwendungAnPerson" : "Übersicht über Zuwendungen an juristische Personen des Privatrechts", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#ZuwendungAnLand" : "Übersicht über Zuwendungen an das Land Schleswig-Holstein", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#IZGAntwort" : "IZG/GvgV-Auskunft", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Gerichtsurteil" : "Gerichtsurteil", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#GesetzvorlageLandtag" : "Gesetzesvorlage an den Landtag", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#MitteilungLandtag" : "Mitteilung an den Landtag", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Unternehmensdaten" : "wesentliche Unternehmensdaten von Beteiligungen des Landes", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#VergütungsOG" : "jährliche Vergütungen nach dem VergütungsOG", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#Vertrag" : "Vertrag", - "http://transparenz.schleswig-holstein.de/informationsgegenstand#sonstiges" : "sonstiges" -} - \ No newline at end of file diff --git a/ckanext/odsh/tests_tpsh/resources/transparenz.rdf b/ckanext/odsh/tests_tpsh/resources/transparenz.rdf deleted file mode 100644 index ea4fb5e3c229d3e01feb3e4bb562f644cb8017da..0000000000000000000000000000000000000000 --- a/ckanext/odsh/tests_tpsh/resources/transparenz.rdf +++ /dev/null @@ -1,1145 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<rdf:RDF xmlns:dcatde="http://dcat-ap.de/def/dcatde/1_0/" xmlns:dcat="http://www.w3.org/ns/dcat#" xmlns:dct="http://purl.org/dc/terms/" -xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/"> - <dcat:Catalog rdf:about="https://transparenz.schleswig-holstein.de/catalog"> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/9f9ae60bb0d8985e10e9ab8aa6a7ca34"> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2017)</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/af_blano_fortschritt2017.pdf?__blob=publicationFile&v=5"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/af_blano_fortschritt2017.pdf?__blob=publicationFile&v=5" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2017)</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-05-02</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-05-02</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/ff612d0f165d46f3091f58e1ef56a2ec"> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2016)</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ae_blano_fortschritt2016.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ae_blano_fortschritt2016.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2016)</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-04-10</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-04-10</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/3a0d0674120fbf06b5cb8737124e3fd0"> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2015)</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ad_blano_fortschritt2015.pdf?__blob=publicationFile&v=8"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ad_blano_fortschritt2015.pdf?__blob=publicationFile&v=8" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2015)</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-10</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-10</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/b5cd3f303f594ecde96e1017e953b688"> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2014)</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ad_blano_fortschritt2014.pdf?__blob=publicationFile&v=4"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ad_blano_fortschritt2014.pdf?__blob=publicationFile&v=4" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2014)</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-07-17</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-07-17</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/cd606b042789723a2b6d61cb31c46c39"> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2013)</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ac_blano_fortschritt2013.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/UXO/Berichte/PDF/Berichte/ac_blano_fortschritt2013.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt (Jahr 2013)</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2014-07-26</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2014-07-26</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/04640ac19a21450984d2af7c402d6aa0"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2006 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2006.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2006.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2006 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/86fe10eb6578e940d7df8e3d6da6520d"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2007 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2007.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2007.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2007 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/b0024265f96b9de5a590541f5e0aec91"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2008 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2008.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2008.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2008 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/ccb65ee5047e3c9cc67384b513400246"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2009 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2009.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2009.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2009 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/ae2a3cffda84388365bc87711ed4af47"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2010 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2010.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2010.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2010 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/91a479991245f208dd6f8ba82411a570"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2011 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2011.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2011.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2011 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/1ee93d311ae6078dc11655c2ca8865b5"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2012 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2012.pdf?__blob=publicationFile&v=6"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2012.pdf?__blob=publicationFile&v=6" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2012 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f5123967a8d0d80ff135342ce41a09bb"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2013 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2013.pdf?__blob=publicationFile&v=5"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2013.pdf?__blob=publicationFile&v=5" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2013 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-28</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/05199f38b6234e794f79ad3726957a3e"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2014/15 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2015.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2015.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2014/15 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-14</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-07-14</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/ffef477b7ebb1447d869b33c79cac8e2"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2016/17 - Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2017.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2017.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2016/17 - Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-08-01</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-08-01</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/a1fea922aa7d9f7a924784615301da83"> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein 2015/16 – Bericht</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2016.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/VIII/Service/Broschueren/Broschueren_VIII/Gesundheit/schuleinguntber2016.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein 2015/16 – Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-11-27</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-11-27</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/423e1ea7e98b492aebc0ca5108c7b36d"> - <dct:title>Jahresbericht 2017 zur biologischen Vielfalt - Jagd und Artenschutz</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/7ee94f73beb43faf4099208b4e55734b" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/Jahresbericht_Zur_biologischen_Vielfalt_2017.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/Jahresbericht_Zur_biologischen_Vielfalt_2017.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Jahresbericht 2017 zur biologischen Vielfalt - Jagd und Artenschutz</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-01-16</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-01-16</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/6ea87d1f4a92efb288ed53e2bf901880"> - <dct:title>Jahresbericht 2018 zur biologischen Vielfalt - Jagd und Artenschutz</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/7ee94f73beb43faf4099208b4e55734b" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/Jahresbericht_zur_biologischen_Vielfalt_2018.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/Jahresbericht_zur_biologischen_Vielfalt_2018.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Jahresbericht 2018 zur biologischen Vielfalt - Jagd und Artenschutz</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-12-16</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-12-16</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/7f6ef434153bdbfff9ed42c8d9ee1381"> - <dct:title>Jahresbericht 2016 zur biologischen Vielfalt – Jagd- und Artenschutz</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/7ee94f73beb43faf4099208b4e55734b" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/biodiversitaetsbericht2016.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Landesregierung/V/Service/Broschueren/Broschueren_V/Umwelt/pdf/biodiversitaetsbericht2016.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Jahresbericht 2016 zur biologischen Vielfalt – Jagd- und Artenschutz</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-12-21</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-12-21</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f681f52201dcf1b1ea467aeed683c8a2"> - <dct:title>Waldzustandsbericht 2018</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2018.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2018.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2018</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-11-29</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2018-11-29</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/225ebaffe8e7a30483ac43935e91e1f4"> - <dct:title>Waldzustandsbericht 2017</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht_2017.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht_2017.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2017</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-12-27</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2017-12-27</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/9f48b6c643a139a0b4e7eac2ab4cfbb0"> - <dct:title>Waldzustandsbericht 2016</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2016.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2016.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2016</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-12-15</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2016-12-15</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/904ef47daad01d2979ab20dda18b2ae7"> - <dct:title>Waldzustandsbericht 2015</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2015.pdf?__blob=publicationFile&v=3"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2015.pdf?__blob=publicationFile&v=3" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2015</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2015-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/2147dcaa148ff19a89fa99c989dd648e"> - <dct:title>Waldzustandsbericht 2014</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2014.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2014.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2014</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2014-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2014-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f201ecaf859f8e713cd030615bd3f5cb"> - <dct:title>Waldzustandsbericht 2013</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2013.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2013.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2013</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2013-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2013-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/9bbeaf7b503dbd2c667786db08c4512d"> - <dct:title>Waldzustandsbericht 2012</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2012.pdf?__blob=publicationFile&v=2"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2012.pdf?__blob=publicationFile&v=2" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2012</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2012-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2012-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f6de9c145fe28effe99fc163b92d657e"> - <dct:title>Waldzustandsbericht 2011</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2011.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2011.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2011</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2011-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/5d794a0f4064ba53b5047dbe36eef3ef"> - <dct:title>Waldzustandsbericht 2010</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2010.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2010.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2010</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2010-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/0ac0c2ceb265a7c0ca18385c95ec6e3a"> - <dct:title>Waldzustandsbericht 2009</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2009.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2009.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2009</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-12-31</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-12-31</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/2f21507e1dc4e9106e348a65bb9e5cfa"> - <dct:title>Waldzustandsbericht 2008</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2008.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2008.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2008</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-01-06</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2009-01-06</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/1e4b51fbab78072693617fcc2458824e"> - <dct:title>Waldzustandsbericht 2006/2007</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2006_2007.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2006_2007.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldzustandsbericht 2006/2007</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-02-18</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2008-02-18</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/ac543132dfecddfdaa9ef8385034323f"> - <dct:title>Waldschadensbericht 2005</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2005.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2005.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldschadensbericht 2005</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2006-03-22</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2006-03-22</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - <dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f9727d9cfb4ad6f923a800e0f116b6e3"> - <dct:title>Waldschadensbericht 2004</dct:title> - - <dct:isVersionOf rdf:resource="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63" /> - <dcat:distribution> - <dcat:Distribution rdf:about="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2004.pdf?__blob=publicationFile&v=1"> - <dct:title></dct:title> - <dcat:accessURL rdf:resource="https://www.schleswig-holstein.de/DE/Fachinhalte/W/wald/Downloads/Waldzustandsbericht2004.pdf?__blob=publicationFile&v=1" /> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:format rdf:resource="http://publications.europa.eu/resource/authority/file-type/PDF" /> - <dcat:mediaType>application/pdf</dcat:mediaType> - </dcat:Distribution> - </dcat:distribution> - <dct:subject rdf:resource="http://d-nb.info/gnd/4128022-2"/> - <dcat:theme rdf:resource="http://publications.europa.eu/resource/authority/data-theme/GOVE" /> - <dct:description>Waldschadensbericht 2004</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU"/> - <dct:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2004-11-30</dct:issued> - <dct:license rdf:resource="http://dcat-ap.de/def/licenses/cc-zero" /> - <dct:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2019-07-15T14:55:00.00000</dct:modified> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - <dct:temporal> - <dct:PeriodOfTime> - <schema:startDate rdf:datatype="http://www.w3.org/2001/XMLSchema#date">2004-11-30</schema:startDate> - </dct:PeriodOfTime> - </dct:temporal> - </dcat:Dataset> - </dcat:dataset> - -<dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/5768d5cdbc58abd45c8620e44e017f01"> - <dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> - <dct:title>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt</dct:title> - <dct:description>Munitionsbelastung der deutschen Meeresgewässer – Entwicklungen und Fortschritt</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU" /> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/b5cd3f303f594ecde96e1017e953b688" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/9f9ae60bb0d8985e10e9ab8aa6a7ca34" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/ff612d0f165d46f3091f58e1ef56a2ec" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/3a0d0674120fbf06b5cb8737124e3fd0" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/cd606b042789723a2b6d61cb31c46c39" /> - - </dcat:Dataset> - </dcat:dataset> -<dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/f1f2513c3899ecf6f15691e0e4412822"> - <dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> - <dct:title>Schuleingangsuntersuchungen in Schleswig-Holstein – Bericht</dct:title> - <dct:description>Schuleingangsuntersuchungen in Schleswig-Holstein – Bericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU" /> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/ae2a3cffda84388365bc87711ed4af47" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/1ee93d311ae6078dc11655c2ca8865b5" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/91a479991245f208dd6f8ba82411a570" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/b0024265f96b9de5a590541f5e0aec91" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/04640ac19a21450984d2af7c402d6aa0" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/ffef477b7ebb1447d869b33c79cac8e2" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/a1fea922aa7d9f7a924784615301da83" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/86fe10eb6578e940d7df8e3d6da6520d" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/ccb65ee5047e3c9cc67384b513400246" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/f5123967a8d0d80ff135342ce41a09bb" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/05199f38b6234e794f79ad3726957a3e" /> - - </dcat:Dataset> - </dcat:dataset> -<dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/5ffd27c528f7ab6936318da90d5cdd63"> - <dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> - <dct:title>Waldzustandsbericht</dct:title> - <dct:description>Waldzustandsbericht</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU" /> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/1e4b51fbab78072693617fcc2458824e" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/0ac0c2ceb265a7c0ca18385c95ec6e3a" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/f9727d9cfb4ad6f923a800e0f116b6e3" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/904ef47daad01d2979ab20dda18b2ae7" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/5d794a0f4064ba53b5047dbe36eef3ef" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/2147dcaa148ff19a89fa99c989dd648e" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/f201ecaf859f8e713cd030615bd3f5cb" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/9bbeaf7b503dbd2c667786db08c4512d" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/ac543132dfecddfdaa9ef8385034323f" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/f6de9c145fe28effe99fc163b92d657e" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/f681f52201dcf1b1ea467aeed683c8a2" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/9f48b6c643a139a0b4e7eac2ab4cfbb0" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/225ebaffe8e7a30483ac43935e91e1f4" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/2f21507e1dc4e9106e348a65bb9e5cfa" /> - - </dcat:Dataset> - </dcat:dataset> -<dcat:dataset> - <dcat:Dataset rdf:about="http://transparenz.schleswig-holstein.de/7ee94f73beb43faf4099208b4e55734b"> - <dct:type rdf:resource="http://dcat-ap.de/def/datasetTypes/collection" /> - <dct:title>Jahresbericht zur biologischen Vielfalt</dct:title> - <dct:description>Jahresbericht zur biologischen Vielfalt</dct:description> - <dct:language rdf:resource="http://publications.europa.eu/resource/authority/language/DEU" /> - <dct:spatial> - <dct:Location rdf:about="http://dcat-ap.de/def/politicalGeocoding/stateKey/01" /> - </dct:spatial> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/423e1ea7e98b492aebc0ca5108c7b36d" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/6ea87d1f4a92efb288ed53e2bf901880" /> - - <dct:hasVersion rdf:resource="http://transparenz.schleswig-holstein.de/7f6ef434153bdbfff9ed42c8d9ee1381" /> - - </dcat:Dataset> - </dcat:dataset> -</dcat:Catalog> -</rdf:RDF> - diff --git a/ckanext/odsh/tests_tpsh/test_plugin.py b/ckanext/odsh/tests_tpsh/test_plugin.py deleted file mode 100644 index 140bd8ae92afc4a21e9235038898f13a3da489b8..0000000000000000000000000000000000000000 --- a/ckanext/odsh/tests_tpsh/test_plugin.py +++ /dev/null @@ -1,53 +0,0 @@ -import datetime - -import ckanext.odsh.plugin as plugin -import unittest - -class TestMethodBeforeView(unittest.TestCase): - date_time_format = '%Y-%m-%dT%H:%M:%S' - - def test_before_view_adds_false_for_old_dataset(self): - plugin_object = plugin.OdshPlugin() - today = datetime.date.today() - hundred_days_ago = today - datetime.timedelta(days=100) - hundred_days_ago_as_ckan_str = self._date_as_ckan_str(hundred_days_ago) - dict_for_template = plugin_object.before_view( - { - 'extras': [ - {'key': 'issued', 'value': hundred_days_ago_as_ckan_str} - ] - } - ) - assert dict_for_template['is_new']==False - - def _date_as_ckan_str(self, date): - return date.strftime(self.date_time_format) - - def test_before_view_adds_true_for_new_dataset(self): - plugin_object = plugin.OdshPlugin() - today = datetime.date.today() - ten_days_ago = today - datetime.timedelta(days=10) - ten_days_ago_as_ckan_str = self._date_as_ckan_str(ten_days_ago) - dict_for_template = plugin_object.before_view( - { - 'extras': [ - {'key': 'issued', 'value': ten_days_ago_as_ckan_str} - ] - } - ) - assert dict_for_template['is_new']==True - - def test_before_view_does_not_modify_unconcerned_dict_values(self): - plugin_object = plugin.OdshPlugin() - today = datetime.date.today() - ten_days_ago = today - datetime.timedelta(days=10) - ten_days_ago_as_ckan_str = self._date_as_ckan_str(ten_days_ago) - dict_for_template = plugin_object.before_view( - { - 'extras': [ - {'key': 'issued', 'value': ten_days_ago_as_ckan_str} - ], - 'some_other_key': 'some_other_value', - } - ) - assert dict_for_template['some_other_key']=='some_other_value' diff --git a/ckanext/odsh/tests_tpsh/test_search.py b/ckanext/odsh/tests_tpsh/test_search.py deleted file mode 100644 index a8f216163cd612d72c24319cca7e32ad9e3362e4..0000000000000000000000000000000000000000 --- a/ckanext/odsh/tests_tpsh/test_search.py +++ /dev/null @@ -1,133 +0,0 @@ -import ckanext.odsh.search as search -import unittest - -class Test_before_search(unittest.TestCase): - def setUp(self): - self.search_params_before_test = { - 'extras': {}, - 'facet.field': ['organization', 'subject_text', 'groups'], - 'fq': 'organization:"test-organisation" groups:"gove" subject_text:"T\xe4tigkeitsbericht" +dataset_type:dataset', - 'include_private': True, - 'q': '', - 'rows': 20, - 'sort': 'score desc, metadata_modified desc', - 'start': 0 - } - self.search_params_with_facet_mincount = self.search_params_before_test.copy() - self.search_params_with_facet_mincount.update({'facet.mincount': 0}) - - def test_it_solely_adds_facet_mincount_to_dict_if_no_extras(self): - # arange - search_params = self.search_params_before_test.copy() - # act - search.before_search(search_params) - # assert - search_params_expected = self.search_params_with_facet_mincount.copy() - assert search_params == search_params_expected - - def test_it_adds_fq_if_empty_range(self): - # arange - search_params = self.search_params_before_test.copy() - extras = {'ext_enddate': '2019-08-01', 'ext_startdate': '2019-08-02'} - search_params.update({'extras': extras}) - search_params_expected = self.search_params_with_facet_mincount.copy() - search_params_expected.update({'extras': extras}) - search_params_expected.update({ - 'fq': ( - 'organization:"test-organisation" groups:"gove" subject_text:"T\xe4tigkeitsbericht" ' - '+dataset_type:dataset (+extras_temporal_start:[2019-08-02T00:00:00Z TO 2019-08-01T00:00:00Z] ' - 'OR +extras_temporal_end:[2019-08-02T00:00:00Z TO 2019-08-01T00:00:00Z] OR ' - '((*:* NOT extras_temporal_end:[* TO *]) AND extras_temporal_start:[* TO 2019-08-01T00:00:00Z]))' - ) - }) - # act - search.before_search(search_params) - # assert - assert search_params == search_params_expected - - def test_it_solely_adds_facet_mincount_to_dict_if_wrong_date_format_in_extras(self): - # arange - search_params = self.search_params_before_test.copy() - extras = {'ext_enddate': 'some_date', 'ext_startdate': 'some_date'} - search_params.update({'extras': extras}) - search_params_expected = self.search_params_with_facet_mincount.copy() - search_params_expected.update({'extras': extras}) - # act - search.before_search(search_params) - # assert - assert search_params == search_params_expected - - def test_it_adds_fq_if_enclosing_range(self): - # arange - search_params = self.search_params_before_test.copy() - extras = {'ext_enddate': '2019-08-02', 'ext_startdate': '2019-08-01'} - search_params.update({'extras': extras}) - search_params_expected = self.search_params_with_facet_mincount.copy() - search_params_expected.update({'extras': extras}) - search_params_expected.update({ - 'fq': ( - 'organization:"test-organisation" groups:"gove" ' - 'subject_text:"T\xe4tigkeitsbericht" +dataset_type:dataset ' - '(+extras_temporal_start:[2019-08-01T00:00:00Z TO 2019-08-02T00:00:00Z] ' - 'OR +extras_temporal_end:[2019-08-01T00:00:00Z TO 2019-08-02T00:00:00Z] ' - 'OR (extras_temporal_start:[* TO 2019-08-01T00:00:00Z] AND ' - 'extras_temporal_end:[2019-08-02T00:00:00Z TO *]) OR ' - '((*:* NOT extras_temporal_end:[* TO *]) AND ' - 'extras_temporal_start:[* TO 2019-08-02T00:00:00Z]))' - ) - }) - # act - search.before_search(search_params) - # assert - assert search_params == search_params_expected - - def test_it_adds_fq_if_start_only(self): - # arange - search_params = self.search_params_before_test.copy() - extras = {'ext_startdate': '2019-08-01'} - search_params.update({'extras': extras}) - search_params_expected = self.search_params_with_facet_mincount.copy() - search_params_expected.update({'extras': extras}) - search_params_expected.update({ - 'fq': ( - 'organization:"test-organisation" groups:"gove" ' - 'subject_text:"T\xe4tigkeitsbericht" +dataset_type:dataset ' - '(+extras_temporal_start:[2019-08-01T00:00:00Z TO *] ' - 'OR +extras_temporal_end:[2019-08-01T00:00:00Z TO *] ' - 'OR (*:* NOT extras_temporal_end:[* TO *]))' - ) - }) - # act - search.before_search(search_params) - # assert - assert search_params == search_params_expected - - def test_it_adds_fq_if_end_only(self): - # arange - search_params = self.search_params_before_test.copy() - extras = {'ext_enddate': '2019-08-02'} - search_params.update({'extras': extras}) - search_params_expected = self.search_params_with_facet_mincount.copy() - search_params_expected.update({'extras': extras}) - search_params_expected.update({ - 'fq': ( - 'organization:"test-organisation" groups:"gove" ' - 'subject_text:"T\xe4tigkeitsbericht" +dataset_type:dataset ' - '(+extras_temporal_start:[* TO 2019-08-02T00:00:00Z] OR ' - '+extras_temporal_end:[* TO 2019-08-02T00:00:00Z] ' - 'OR ((*:* NOT extras_temporal_end:[* TO *]) ' - 'AND extras_temporal_start:[* TO 2019-08-02T00:00:00Z]))' - ) - }) - # act - search.before_search(search_params) - # assert - assert search_params == search_params_expected - - def test_it_returns_search_params(self): - # arange - search_params = self.search_params_before_test.copy() - # act - return_value = search.before_search(search_params) - # assert - assert search_params == return_value diff --git a/ckanext/odsh/tests_tpsh/resources/__init__.py b/ckanext/odsh/tests_wip/__init__.py similarity index 100% rename from ckanext/odsh/tests_tpsh/resources/__init__.py rename to ckanext/odsh/tests_wip/__init__.py diff --git a/ckanext/odsh/tests/ckan_selenium.py b/ckanext/odsh/tests_wip/ckan_selenium.py similarity index 100% rename from ckanext/odsh/tests/ckan_selenium.py rename to ckanext/odsh/tests_wip/ckan_selenium.py diff --git a/ckanext/odsh/tests/harvest_sever_mock.py b/ckanext/odsh/tests_wip/harvest_sever_mock.py similarity index 100% rename from ckanext/odsh/tests/harvest_sever_mock.py rename to ckanext/odsh/tests_wip/harvest_sever_mock.py diff --git a/ckanext/odsh/tests/icap_sever_mock.py b/ckanext/odsh/tests_wip/icap_sever_mock.py similarity index 100% rename from ckanext/odsh/tests/icap_sever_mock.py rename to ckanext/odsh/tests_wip/icap_sever_mock.py diff --git a/ckanext/odsh/tests/rdf_catalog.xml b/ckanext/odsh/tests_wip/rdf_catalog.xml similarity index 100% rename from ckanext/odsh/tests/rdf_catalog.xml rename to ckanext/odsh/tests_wip/rdf_catalog.xml diff --git a/ckanext/odsh/tests/rdf_catalog_empty.xml b/ckanext/odsh/tests_wip/rdf_catalog_empty.xml similarity index 100% rename from ckanext/odsh/tests/rdf_catalog_empty.xml rename to ckanext/odsh/tests_wip/rdf_catalog_empty.xml diff --git a/ckanext/odsh/tests/result_data.json b/ckanext/odsh/tests_wip/result_data.json similarity index 100% rename from ckanext/odsh/tests/result_data.json rename to ckanext/odsh/tests_wip/result_data.json diff --git a/ckanext/odsh/tests/spatial_mapping.csv b/ckanext/odsh/tests_wip/spatial_mapping.csv similarity index 100% rename from ckanext/odsh/tests/spatial_mapping.csv rename to ckanext/odsh/tests_wip/spatial_mapping.csv diff --git a/ckanext/odsh/tests/test_data.json b/ckanext/odsh/tests_wip/test_data.json similarity index 100% rename from ckanext/odsh/tests/test_data.json rename to ckanext/odsh/tests_wip/test_data.json diff --git a/ckanext/odsh/tests/test_datarequest.py b/ckanext/odsh/tests_wip/test_datarequest.py similarity index 91% rename from ckanext/odsh/tests/test_datarequest.py rename to ckanext/odsh/tests_wip/test_datarequest.py index a37c7e4eace8a3696bca01c83a118c47d2a022ae..f8c656c2b38288640922a21d271efb4448e4adf5 100644 --- a/ckanext/odsh/tests/test_datarequest.py +++ b/ckanext/odsh/tests_wip/test_datarequest.py @@ -1,11 +1,11 @@ -from ckanext.odsh.tests.test_helpers import AppProxy -import ckanext.odsh.tests.test_helpers as testhelpers +from ckanext.odsh.tests_wip.test_helpers import AppProxy +import ckanext.odsh.tests_wip.test_helpers as testhelpers import ckan.tests.factories as factories import uuid import pdb -from ckanext.odsh.tests.harvest_sever_mock import HarvestServerMock -import ckanext.odsh.tests.harvest_sever_mock as harvest_sever_mock +from ckanext.odsh.tests_wip.harvest_sever_mock import HarvestServerMock +import ckanext.odsh.tests_wip.harvest_sever_mock as harvest_sever_mock import subprocess import re diff --git a/ckanext/odsh/tests/test_env.py b/ckanext/odsh/tests_wip/test_env.py similarity index 98% rename from ckanext/odsh/tests/test_env.py rename to ckanext/odsh/tests_wip/test_env.py index 70e2bf126e9ac42b275aff07b190fbd271ca2e76..a17ddffa308ce409a37210bf66067647cee7e5f4 100644 --- a/ckanext/odsh/tests/test_env.py +++ b/ckanext/odsh/tests_wip/test_env.py @@ -105,7 +105,6 @@ class TestEnv: checkConfig('ckanext-archiver.user_agent_string', 'Open Data Schleswig-Holstein') checkConfig('ckan.harvest.mq.type', 'redis') - checkConfig('ckanext.odsh.upload_formats', minLength=2) checkConfig('ckanext.spatial.search_backend', 'solr-spatial-field') checkConfig('ckanext.spatial.common_map.type', 'wms') checkConfig('ckanext.spatial.common_map.wms.url', @@ -115,8 +114,8 @@ class TestEnv: checkJsonFile( 'qa.resource_format_openness_scores_json', expectedLength=60) - checkConfig('ckanext.odsh.language.mapping', - '/usr/lib/ckan/default/src/ckanext-odsh/languages.json') + checkConfig('ckanext.odsh.language_mapping', + '/usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/resources/languages.json') def test_non_critical(self): checkConfig('who.timeout', '1800') diff --git a/ckanext/odsh/tests/test_harvest.py b/ckanext/odsh/tests_wip/test_harvest.py similarity index 87% rename from ckanext/odsh/tests/test_harvest.py rename to ckanext/odsh/tests_wip/test_harvest.py index ff7df9f46fbbbaf5b2e6d871183f3a47ee1444e0..bb6563617c25800490359db6d90cf9c049384997 100644 --- a/ckanext/odsh/tests/test_harvest.py +++ b/ckanext/odsh/tests_wip/test_harvest.py @@ -1,10 +1,10 @@ -from ckanext.odsh.tests.test_helpers import AppProxy -import ckanext.odsh.tests.test_helpers as testhelpers +from ckanext.odsh.tests_wip.test_helpers import AppProxy +import ckanext.odsh.tests_wip.test_helpers as testhelpers import ckan.tests.factories as factories import uuid import pdb -from ckanext.odsh.tests.harvest_sever_mock import HarvestServerMock -import ckanext.odsh.tests.harvest_sever_mock as harvest_sever_mock +from ckanext.odsh.tests_wip.harvest_sever_mock import HarvestServerMock +import ckanext.odsh.tests_wip.harvest_sever_mock as harvest_sever_mock import subprocess diff --git a/ckanext/odsh/tests/test_helpers.py b/ckanext/odsh/tests_wip/test_helpers.py similarity index 96% rename from ckanext/odsh/tests/test_helpers.py rename to ckanext/odsh/tests_wip/test_helpers.py index f033b573fb4b8b14e3bbb48a0bb1c244719a6379..33f03d58e54aed548afaccadb4f27dc9347493c0 100644 --- a/ckanext/odsh/tests/test_helpers.py +++ b/ckanext/odsh/tests_wip/test_helpers.py @@ -26,7 +26,7 @@ def change_config(): def changed_config(): _original_config = config.copy() config['ckanext.odsh.spatial.mapping'] = 'file:///usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/tests/spatial_mapping.csv' - config['licenses_group_url'] = 'file:///usr/lib/ckan/default/src/ckanext-odsh/licenses.json' + config['licenses_group_url'] = 'file:///usr/lib/ckan/default/src/ckanext-odsh/ckanext/odsh/ckanext/odsh/resources/licenses.json' try: yield finally: diff --git a/ckanext/odsh/tests_wip/test_plugin.py b/ckanext/odsh/tests_wip/test_plugin.py new file mode 100644 index 0000000000000000000000000000000000000000..af2f6e90324119090a8d6ca0c324b900e4cb1690 --- /dev/null +++ b/ckanext/odsh/tests_wip/test_plugin.py @@ -0,0 +1,30 @@ +import paste.fixture +import pylons.test +import ckan.plugins +import ckan.model as model +import ckan.tests.factories as factories +import ckan.tests.legacy as tests +from ckan.common import config + + +# class TestOdshPlugin(object): + +# @classmethod +# def setup_class(cls): +# cls.app = paste.fixture.TestApp(pylons.test.pylonsapp) +# ckan.plugins.load('odsh') + +# def teardown(self): +# model.repo.rebuild_db() + +# @classmethod +# def teardown_class(cls): +# ckan.plugins.unload('odsh') + +# def test_plugin(self): +# pass + +# def test_user_cannot_access_dashboard(self): +# user = factories.User() +# tests.call_action_api(self.app, 'group_create', name='test-group', +# apikey=user['apikey']) diff --git a/ckanext/odsh/tests/test_rdfexport.py b/ckanext/odsh/tests_wip/test_rdfexport.py similarity index 100% rename from ckanext/odsh/tests/test_rdfexport.py rename to ckanext/odsh/tests_wip/test_rdfexport.py diff --git a/ckanext/odsh/tests/test_routes.py b/ckanext/odsh/tests_wip/test_routes.py similarity index 100% rename from ckanext/odsh/tests/test_routes.py rename to ckanext/odsh/tests_wip/test_routes.py diff --git a/ckanext/odsh/tests_wip/test_search.py b/ckanext/odsh/tests_wip/test_search.py new file mode 100644 index 0000000000000000000000000000000000000000..854a7917a5f7a0c3a8e27ccafe1cae33f153f185 --- /dev/null +++ b/ckanext/odsh/tests_wip/test_search.py @@ -0,0 +1,253 @@ +# encoding: utf-8 + +import ckan.tests.factories as factories +import ckan.tests.helpers as helpers +from bs4 import BeautifulSoup +from ckan import model +from ckan.lib.mailer import create_reset_key +from routes import url_for +import ckan.plugins +from .test_helpers import odsh_test +import pdb + + + +class TestSearch(helpers.FunctionalTestBase): + + _load_plugins = ['odsh', 'spatial_metadata', 'spatial_query'] + + def teardown(self): + model.repo.rebuild_db() + + @odsh_test() + def test_dataset_is_in_search_result(self): + # arrange + dataset = self._create_dataset() + + # act + response = self._perform_search() + + # assert + assert dataset['name'] in response + + @odsh_test() + def test_query_with_no_match_finds_no_dataset(self): + # arrange + dataset = self._create_dataset() + + # act + response = self._perform_search("foobar") + + # assert + self._assert_no_results(response) + + @odsh_test() + def test_query_with_no_dates_finds_dataset(self): + # arrange + dataset = self._create_dataset() + + # act + response = self._perform_date_search(None, None) + + # assert + assert dataset['name'] in response + + @odsh_test() + def test_query_with_very_old_dataset(self): + # arrange + dataseta = self._create_dataset('do_not_find_me', '2011-01-01', '2013-12-31') + datasetb = self._create_dataset('old_dataset', '1111-01-01', '1860-12-31') + + # act + response = self._perform_date_search('1110-12-30', '1960-02-01') + + # assert + assert 'wrong_start_date_for_search' not in response + self._assert_datasets_in_response([datasetb], response) + self._assert_datasets_not_in_response([dataseta], response) + + @odsh_test() + def test_query_with_end_before_start_finds_no_dataset(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31') + + # act + response = self._perform_date_search('1960-12-30', '1960-02-01') + + # assert + self._assert_no_results(response) + + @odsh_test() + def test_query_with_wrong_dates_shows_error(self): + # arrange + dataset = self._create_dataset() + + # act + response1 = self._perform_date_search('foo', None) + response2 = self._perform_date_search(None, 'foo') + response3 = self._perform_date_search('11-11-11', None) + + # assert + assert 'wrong_start_date_for_search' in response1 + self._assert_datasets_in_response([dataset], response1) + assert 'daterange: to' not in response1 + assert 'daterange: from' not in response1 + assert 'wrong_end_date_for_search' in response2 + self._assert_datasets_in_response([dataset], response2) + assert 'daterange: to' not in response2 + assert 'daterange: from' not in response2 + assert 'wrong_start_date_for_search' in response3 + assert 'daterange: to' not in response3 + assert 'daterange: from' not in response3 + self._assert_datasets_in_response([dataset], response3) + + @odsh_test() + def test_query_with_start_date_finds_one_dataset(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31') + datasetB = self._create_dataset('datasetb', '1980-01-01', '1990-06-30') + datasetC = self._create_dataset('datasetc', '2001-03-01', '2001-04-30') + + # act + response1 = self._perform_date_search(None, '1990-01-01') + response2 = self._perform_date_search(None, '2010-12-31') + response3 = self._perform_date_search('2010-12-31', None) + response4 = self._perform_date_search('1985-04-01', '1985-04-20') + response5 = self._perform_date_search('2001-04-01', None) + + # assert + self._assert_datasets_in_response([datasetA, datasetB], response1) + self._assert_datasets_not_in_response([datasetC], response1) + assert 'daterange: to' in response1 + + self._assert_datasets_in_response( + [datasetA, datasetB, datasetC], response2) + assert 'daterange: to' in response2 + + self._assert_no_results(response3) + assert 'daterange: from' in response3 + + self._assert_datasets_in_response([datasetB], response4) + self._assert_datasets_not_in_response([datasetA, datasetC], response4) + assert 'daterange: to' in response4 + assert 'daterange: from' in response4 + + self._assert_datasets_in_response([datasetC], response5) + self._assert_datasets_not_in_response([datasetA, datasetB], response5) + + @odsh_test() + def test_dataset_combime_date_range_search_and_text_search_same_title(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31','mytitle') + datasetB = self._create_dataset('datasetb', '1980-01-01', '1990-06-30', 'mytitle') + + # act + response = self._perform_text_and_date_search('mytitle', None, '1970-01-01') + + # assert + self._assert_datasets_in_response([datasetA], response) + self._assert_datasets_not_in_response([datasetB], response) + + @odsh_test() + def test_dataset_combime_date_range_search_and_text_search_same_dates(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', '1960-12-31','mytitle') + datasetB = self._create_dataset('datasetb', '1960-01-01', '1960-12-31','othertitle') + datasetC = self._create_dataset('datasetc', '1980-01-01', '1990-06-30', 'mytitle') + + # act + response = self._perform_text_and_date_search('mytitle', None, '1970-01-01') + + # assert + self._assert_datasets_in_response([datasetA], response) + self._assert_datasets_not_in_response([datasetB, datasetC], response) + + @odsh_test() + def test_dataset_without_end(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', None,'mytitle') + + # act + response1 = self._perform_text_and_date_search('mytitle', '1950-01-01', '1950-02-01') + response2 = self._perform_text_and_date_search('mytitle', '1950-01-01', '1960-02-01') + response3 = self._perform_text_and_date_search('mytitle', '1950-01-01', None) + response4 = self._perform_text_and_date_search('mytitle', None, '1970-01-01') + response5 = self._perform_text_and_date_search('mytitle', '1970-01-01', '1980-02-01') + response6 = self._perform_text_and_date_search('mytitle', None, '1950-01-01') + + # assert + self._assert_datasets_not_in_response([datasetA], response1) + self._assert_datasets_in_response([datasetA], response2) + self._assert_datasets_in_response([datasetA], response3) + self._assert_datasets_in_response([datasetA], response4) + self._assert_datasets_in_response([datasetA], response5) + self._assert_datasets_not_in_response([datasetA], response6) + + @odsh_test() + def test_dataset_new_has_label(self): + # arrange + datasetA = self._create_dataset('dataseta', '1960-01-01', None,'mytitle') + + # act + response = self._perform_text_and_date_search('mytitle', None, None) + + # assert + response.mustcontain('new-dataset-label') + + def _assert_datasets_in_response(self, datasets, response): + for dataset in datasets: + assert dataset['name'] in response + + def _assert_datasets_not_in_response(self, datasets, response): + for dataset in datasets: + assert dataset['name'] not in response + + def _assert_no_results(self, response): + assert "No datasets found" in response + + def _create_dataset(self, name='my-own-dataset', temporal_start='2000-01-27', temporal_end='2000-01-27',title='title'): + user = factories.User() + extras = [ + {'key': 'temporal_start', 'value': temporal_start}, + {'key': 'temporal_end', 'value': temporal_end}, + {'key': 'issued', 'value': '2000-01-27'}, + {'key': 'groups', 'value': 'soci'}, + {'key': 'licenseAttributionByText', 'value': 'text'}, + {'key': 'spatial_uri', 'value': 'http://dcat-ap.de/def/politicalGeocoding/districtKey/01001'} + ] + return factories.Dataset(user=user, + name=name, + title=title, + issued='27-01-2000', + extras=extras, + license_id='http://dcat-ap.de/def/licenses/dl-by-de/2.0') + + def _perform_search(self, query=None): + search_form = self._perform_search_for_form('dataset-search-box-form') + if query is not None: + search_form['q'] = query + return helpers.webtest_submit(search_form) + + def _perform_date_search(self, search_from, search_to): + search_form = self._perform_search_for_form('dataset-search-box-form') + if search_form is not None: + search_form['ext_startdate'] = search_from + if search_to is not None: + search_form['ext_enddate'] = search_to + return helpers.webtest_submit(search_form) + + def _perform_text_and_date_search(self, query, search_from, search_to): + search_form = self._perform_search_for_form('dataset-search-box-form') + search_form['q'] = query + if search_form is not None: + search_form['ext_startdate'] = search_from + if search_to is not None: + search_form['ext_enddate'] = search_to + return helpers.webtest_submit(search_form) + + def _perform_search_for_form(self, form): + search_url = url_for(named_route='dataset.search') + search_response = self._get_test_app().get(search_url) + + search_form = search_response.forms[form] + return search_form diff --git a/ckanext/odsh/tests/test_selenium.py b/ckanext/odsh/tests_wip/test_selenium.py similarity index 97% rename from ckanext/odsh/tests/test_selenium.py rename to ckanext/odsh/tests_wip/test_selenium.py index 084e515ba5660ab9665cda186670447007f9d04c..29936a574ac3f59107932b84e4a1715e22f3a189 100644 --- a/ckanext/odsh/tests/test_selenium.py +++ b/ckanext/odsh/tests_wip/test_selenium.py @@ -1,6 +1,6 @@ # coding: utf-8 -from ckanext.odsh.tests.ckan_selenium import SeleniumCkanApp +from ckanext.odsh.tests_wip.ckan_selenium import SeleniumCkanApp import pdb import uuid diff --git a/ckanext/odsh/tests/test_statistikNordHarvester_old.py b/ckanext/odsh/tests_wip/test_statistikNordHarvester_old.py similarity index 100% rename from ckanext/odsh/tests/test_statistikNordHarvester_old.py rename to ckanext/odsh/tests_wip/test_statistikNordHarvester_old.py diff --git a/ckanext/odsh/tests/test_upload.py b/ckanext/odsh/tests_wip/test_upload.py similarity index 100% rename from ckanext/odsh/tests/test_upload.py rename to ckanext/odsh/tests_wip/test_upload.py diff --git a/ckanext/odsh/tests/test_user.py b/ckanext/odsh/tests_wip/test_user.py similarity index 100% rename from ckanext/odsh/tests/test_user.py rename to ckanext/odsh/tests_wip/test_user.py diff --git a/ckanext/odsh/tests/test_validation.py b/ckanext/odsh/tests_wip/test_validation.py similarity index 71% rename from ckanext/odsh/tests/test_validation.py rename to ckanext/odsh/tests_wip/test_validation.py index 40e8ee32b2110b0f0cf32590a0a9da45db7a2f7e..746afc75da8b4c3d4514e205ed1ed7bed8d5545a 100644 --- a/ckanext/odsh/tests/test_validation.py +++ b/ckanext/odsh/tests_wip/test_validation.py @@ -3,6 +3,7 @@ import ckan.plugins.toolkit as toolkit import ckan.model as modelMock import sys import json +import pytest from mock import MagicMock, Mock, patch @@ -52,16 +53,7 @@ def test_tag_string_convert(): assert data[('tags', 1, 'name')] == 'tag2' -@raises(Exception) -def test_tag_name_validator_invalid(): - tag_name_validator('&', None) - - -def test_tag_name_validator_valid(): - tag_name_validator('valid', None) - - -@patch('urllib2.urlopen') +@patch('urllib.request.urlopen') @patch('pylons.config.get', side_effect='foo') @patch('csv.reader', side_effect=[[['uri', 'text', json.dumps({"geometry": 0})]]]) def test_known_spatial_uri(url_mock, get_mock, csv_mock): @@ -77,26 +69,31 @@ def test_known_spatial_uri(url_mock, get_mock, csv_mock): assert data[('extras', 2, 'value')] == '0' -@raises(Exception) -@patch('urllib2.urlopen') +@pytest.mark.parametrize('exception_type', [Exception]) +@patch('urllib.request.urlopen') @patch('pylons.config.get', side_effect='foo') @patch('csv.reader', side_effect=[[['uri', 'text', json.dumps({"geometry": 0})]]]) -def test_known_spatial_uri_without_uri(url_mock, get_mock, csv_mock): +def test_known_spatial_uri_without_uri(url_mock, get_mock, csv_mock, exception_type): # arrange data = {('extras', 0, 'key'): 'spatial_uri', ('extras', 0, 'value'): ''} - # act - known_spatial_uri('spatial_uri', data, {}, None) + + # act and assert + with pytest.raises(exception_type): + known_spatial_uri('spatial_uri', data, {}, None) -def test_known_spatial_uri_without_uri_with_spatial(): +@pytest.mark.parametrize('exception_type', [Exception]) +def test_known_spatial_uri_without_uri_with_spatial(exception_type): # arrange data = {('extras', 0, 'key'): 'spatial', ('extras', 0, 'value'): 'value', ('extras', 1, 'key'): 'spatial_uri', ('extras', 1, 'value'): ''} - # act - known_spatial_uri('spatial_uri', data, {}, None) + + # act and assert + with pytest.raises(exception_type): + known_spatial_uri('spatial_uri', data, {}, None) def test_validate_licenseAttributionByText(): @@ -109,24 +106,10 @@ def test_validate_licenseAttributionByText(): ('extras', 0, 'value'): ''} validate_licenseAttributionByText('key', data, {}, None) - -def test_convert_subjectID_to_subjectText(): - # arrange - data = {('extras', 0, 'subject'): 'subject', - ('extras', 0, 'subject'): 'Test_id'} - # act - convert_subjectID_to_subjectText('key', data, {}, None) - # assert - assert data[('extras', 1, 'key')] == 'subject_text' - assert data[('extras', 1, 'value')] == 'Test_subject' +def test_tag_name_validator_invalid(): + with pytest.raises(Exception): + tag_name_validator('Foo\nBar', None) -def test_exception_convert_subjectID_to_subjectText(): - # arrange - data = {('extras', 0, 'subject'): 'subject', - ('extras', 0, 'subject'): 'Nicht_Vorhanden'} - # act - convert_subjectID_to_subjectText('key', data, {}, None) - #assert - assert data[('extras', 1, 'key')] == 'subject_text' - assert data[('extras', 1, 'value')] == '' +def test_tag_name_validator_valid(): + tag_name_validator('Regionalplan für den Planungsraum_I: (5.8 – Windenergie_an_Land)', None) diff --git a/ckanext/odsh/validation.py b/ckanext/odsh/validation.py index a27fbf9c7dae69ca5d1615ea98f88fb6d6e39b83..32cd39e3f1e69b3b88b3e81a1fd42f8c1ab20039 100644 --- a/ckanext/odsh/validation.py +++ b/ckanext/odsh/validation.py @@ -4,6 +4,8 @@ import csv import re import urllib.request, urllib.error, urllib.parse import json +import ckan.logic as logic + from itertools import count from dateutil.parser import parse @@ -11,8 +13,10 @@ import ckan.plugins.toolkit as toolkit import ckan.model as model from ckan.lib.navl.dictization_functions import Missing -from ckanext.odsh.helpers_tpsh import get_package_dict +from ckanext.odsh.helpers import get_package_dict +from ckanext.odsh.helpers import odsh_resource_formats import ckan.plugins.toolkit as tk +import pkg_resources _ = toolkit._ @@ -180,10 +184,6 @@ def validate_licenseAttributionByText(key, data, errors, context): raise toolkit.Invalid( 'licenseAttributionByText: empty not allowed') - if not isByLicense and hasAttribution: - raise toolkit.Invalid( - 'licenseAttributionByText: text not allowed for this license') - def known_spatial_uri(key, data, errors, context): if data.get(('__extras',)) and 'spatial_uri_temp' in data.get(('__extras',)): @@ -218,7 +218,8 @@ def known_spatial_uri(key, data, errors, context): data[('extras', new_index+1, 'value')] = poly return - mapping_path = tk.config.get('ckanext.odsh.spatial.mapping') + extension_path = pkg_resources.resource_filename('ckanext.odsh', '') + mapping_path = tk.config.get('ckanext.odsh.spatial.mapping', extension_path + '/resources/schleswig-holstein_geojson.csv') not_found = True spatial_text = str() @@ -269,14 +270,6 @@ def next_extra_index(data): return max(current_indexes) + 1 if current_indexes else 0 -def tag_name_validator(value, context): - tagname_match = re.compile(r'[\w \-.\:\(\)\´\`\§]*$', re.UNICODE) - if not tagname_match.match(value): - raise toolkit.Invalid(_('Tag "%s" must be alphanumeric ' - 'characters or symbols: -_.:()') % (value)) - return value - - def tag_string_convert(key, data, errors, context): '''Takes a list of tags that is a comma-separated string (in data[key]) and parses tag names. These are added to the data dict, enumerated. They @@ -299,59 +292,6 @@ def tag_string_convert(key, data, errors, context): tag_name_validator(tag, context) -def _convert_subjectID_to_subjectText(subject_id, flattened_data): - - if not subject_id: - return flattened_data - - default_subject_mapping_file_path = '/usr/lib/ckan/default/src/ckanext-odsh/subject_mapping.json' - subject_mapping_file_path = tk.config.get( - 'ckanext.odsh.subject_mapping_file_path', default_subject_mapping_file_path) - - try: - with open(subject_mapping_file_path) as mapping_json: - subject_mapping = json.loads(mapping_json.read()) - except IOError as err: - log.error( - 'Could not load subject mapping file from {}' - .format(subject_mapping_file_path) - ) - raise - except ValueError as err: - log.error( - 'Could not convert subject mapping file from json. \nSubject mapping file: {}' - .format(subject_mapping_file_path) - ) - raise - - try: - subject_text = subject_mapping[subject_id] - except: - raise toolkit.Invalid(_('Subject must be a known URI.')) - log.warning( - 'Subject_id "{}" not found in subject mapping dictionary.\nSubject mapping file: {}' - .format(subject_id, subject_mapping_file_path) - ) - - - new_index = next_extra_index(flattened_data) - flattened_data[('extras', new_index, 'key')] = 'subject_text' - flattened_data[('extras', new_index, 'value')] = subject_text - return flattened_data - - -def validate_subject(key, flattened_data, errors, context): - subject_id = flattened_data[key] - require_subject = toolkit.asbool( - tk.config.get('ckanext.odsh.require_subject', True) - ) - if not require_subject: - flattened_data = _convert_subjectID_to_subjectText(subject_id, flattened_data) - return - if not subject_id: - raise toolkit.Invalid(_('Subject must not be empty.')) - flattened_data = _convert_subjectID_to_subjectText(subject_id, flattened_data) - def validate_relatedPackage(data): if data: try: @@ -359,22 +299,32 @@ def validate_relatedPackage(data): except logic.NotFound: raise toolkit.Invalid("relatedPackage: package '{}' not found".format(data)) + def validate_formats(data, errors): if not data: raise toolkit.Invalid('Missing format.') - if not data.upper() in ['7Z','AAB','AAC','AKN4EU','AKN4EU_ZIP','APK','APPX','ARC','ARCINFO_COV','ARC_GZ','ARJ','ATOM','AZW','BIN','BITS','BMP','BWF','BZIP2','CSS','CSV','DAPK','DBF','DCR','DEB','DGN','DMG','DMP','DOC','DOCX','DTD_SGML','DTD_XML','DWG','DXF','E00','EAR','ECW','EFORMS_XML','EPS','EPUB','ETSI_XML','EXE','FMX2','FMX3','FMX4','FMX4_ZIP','GDB','GEOJSON','GEOTIFF','GIF','GML','GMZ','GPKG','GRID','GRID_ASCII','GTFS','GZIP','HDF','HDT','HTML','HTML5','HTML_SIMPL','ICS','IMMC_XML','INDD','IPA','ISO','ISO_ZIP','JAR','JATS','JPEG','JPEG2000','JS','JSON','JSON_LD','KML','KMZ','LAS','LAZ','LEG','LHA','LPK','LZIP','LZMA','LZO','MAP_PRVW','MAP_SRVC','MBOX','MDB','METS','METS_ZIP','MHTML','MIF_MID','MOBI','MOP','MP3','MPEG2','MPEG4','MPEG4_AVC','MRSID','MSG_HTTP','MSI','MXD','N3','NETCDF','OAPK','OCTET','ODB','ODC','ODF','ODG','ODP','ODS','ODT','OP_DATPRO','OVF','OWL','PDF','PDF1X','PDFA1A','PDFA1B','PDFA2A','PDFA2B','PDFA3','PDFUA','PDFX','PDFX1A','PDFX2A','PDFX4','PL','PNG','PPS','PPSX','PPT','PPTX','PS','PSD','PWP','QGS','RAR','RDF','RDFA','RDF_N_QUADS','RDF_N_TRIPLES','RDF_THRIFT','RDF_TRIG','RDF_TRIX','RDF_TURTLE','RDF_XML','REST','RPM','RSS','RTF','SB3','SCHEMA_XML','SDMX','SGML','SHP','SKOS_XML','SPARQLQ','SPARQLQRES','SQL','STL','SVG','SWM','TAB','TAB_RSTR','TAR','TAR_GZ','TAR_XZ','TIFF','TIFF_FX','TMX','TSV','TXT','UNGEN','WAR','WARC','WARC_GZ','WAV','WCS_SRVC','WEBP','WFS_SRVC','WIM','WMS_SRVC','WMTS_SRVC','WORLD','XHTML','XHTML5','XHTML_SIMPL','XLIFF','XLS','XLSB','XLSM','XLSX','XML','XSLFO','XSLT','XYZ','XZ','YAML','Z','ZIP']: + if not any(data.upper() == obj['key'] for obj in odsh_resource_formats()): raise toolkit.Invalid(_('Only formats on the list of the EU Publications Office are allowed.')) return data + +def tag_name_validator(value, context): + """Allow tag name to contain any characters but no newlines + """ + tagname_match = re.compile(r'^(?=.*[^\n])[^\n]*$', re.UNICODE) + if not tagname_match.match(value): + raise toolkit.Invalid(_('Invalid tag: "%s". Tags cannot contain line breaks.') % (value)) + return value + + def get_validators(): return { 'known_spatial_uri': known_spatial_uri, - 'odsh_tag_name_validator': tag_name_validator, 'odsh_validate_extras': validate_extras, 'validate_licenseAttributionByText': validate_licenseAttributionByText, - 'tpsh_validate_subject': validate_subject, - 'tpsh_validate_relatedPackage': validate_relatedPackage, + 'validate_relatedPackage': validate_relatedPackage, 'odsh_validate_format': validate_formats, + 'tag_name_validator': tag_name_validator, } diff --git a/ckanext/odsh/views/dashboard.py b/ckanext/odsh/views/dashboard.py index 78fe3b1b16f872df0994f18c9f6b76c0669a2ca2..3aa1736bf7ce0eb7583765d24ebcbf7a49b113a9 100644 --- a/ckanext/odsh/views/dashboard.py +++ b/ckanext/odsh/views/dashboard.py @@ -12,7 +12,7 @@ blueprint = Blueprint('odsh_dashboard', __name__) def dashboard(offset=0): - log.info("views.dashboard::dashboard") + log.debug("views.dashboard::dashboard") is_sysadmin = authz.is_sysadmin(g.user) if not is_sysadmin: @@ -22,7 +22,7 @@ def dashboard(offset=0): def dashboard_datasets(): - log.info("views.dashboard::dashboard_datasets") + log.debug("views.dashboard::dashboard_datasets") is_sysadmin = authz.is_sysadmin(g.user) if not is_sysadmin: diff --git a/ckanext/odsh/views/default.py b/ckanext/odsh/views/default.py index 3bd0e3091e67d316f9818f2b983443cfaf7bb2d4..61333f696c5da067c3d18501e15261f01e9aea2b 100644 --- a/ckanext/odsh/views/default.py +++ b/ckanext/odsh/views/default.py @@ -8,19 +8,19 @@ log = logging.getLogger(__name__) blueprint = Blueprint('odsh_default', __name__) def info_page(): - log.info("views.default::info_page") + log.debug("views.default::info_page") return toolkit.redirect_to('http://www.schleswig-holstein.de/odpinfo') def start(): - log.info("views.default::start") + log.debug("views.default::start") return toolkit.redirect_to('/dataset') def not_found(): - log.info("views.default::not_found") + log.debug("views.default::not_found") toolkit.abort(404) def robots_txt(): - log.info("views.default::robots_txt") + log.debug("views.default::robots_txt") resp = make_response(base.render('home/robots.txt')) resp.headers['Content-Type'] = "text/plain; charset=utf-8" return resp diff --git a/ckanext/odsh/views/feed.py b/ckanext/odsh/views/feed.py index e8b3649215b8a4a2f068ee4c37b8afdedbf8c0fa..2305e2f3b0ea9b55143f045cd3993fd366ab5d27 100644 --- a/ckanext/odsh/views/feed.py +++ b/ckanext/odsh/views/feed.py @@ -1,4 +1,3 @@ -import ckan.plugins.toolkit as toolkit from flask import Blueprint from flask import request import ckan.views.feed as ckan_feed diff --git a/ckanext/odsh/views/package.py b/ckanext/odsh/views/package.py index 64199f6389a849657b4ec7a0d01a2a42ef5859bc..c082dffc33505fe3297a3fd17c36998838f68a15 100644 --- a/ckanext/odsh/views/package.py +++ b/ckanext/odsh/views/package.py @@ -1,5 +1,4 @@ import ckan.plugins.toolkit as toolkit -import ckan.authz as authz from flask import Blueprint import logging @@ -9,5 +8,5 @@ log = logging.getLogger(__name__) blueprint = Blueprint('odsh_package', __name__) def redirect_dataset_resource(id, resource_id): - log.info("views.package::redirect_dataset_resource") + log.debug("views.package::redirect_dataset_resource") return toolkit.redirect_to('/dataset/{}'.format(id)) diff --git a/ckanext/odsh/views/user.py b/ckanext/odsh/views/user.py index 1fcc28e9754d315a0ba179b44d1b674922227122..4c3e0874e13ac4bae200f34906cbb36f84ba960c 100644 --- a/ckanext/odsh/views/user.py +++ b/ckanext/odsh/views/user.py @@ -1,6 +1,5 @@ import ckan.plugins.toolkit as toolkit import ckan.authz as authz -import ckan.logic as logic from ckan.common import g from flask import Blueprint import ckan.views.user as ckan_user_view @@ -12,7 +11,7 @@ blueprint = Blueprint('odsh_user', __name__) def index(): - log.info("views.user::index") + log.debug("views.user::index") is_sysadmin = authz.is_sysadmin(g.user) if not is_sysadmin: @@ -21,7 +20,7 @@ def index(): # def register(): -# log.info("views.user::register") +# log.debug("views.user::register") # is_sysadmin = authz.is_sysadmin(g.user) # if not is_sysadmin: @@ -30,14 +29,14 @@ def index(): def read(id=None): - log.info("views.user::read") + log.debug("views.user::read") if not g.user: return ckan_user_view.login() return ckan_user_view.read(id) def activity(id, offset=0): - log.info("views.user::activity") + log.debug("views.user::activity") is_sysadmin = authz.is_sysadmin(g.user) if not is_sysadmin: diff --git a/dev-requirements.txt b/dev-requirements.txt index fd7d9cbb4b89ff1cae0d7e44d8586c503c340b38..0e7ac24e690337ed0c60cbf1182acd0671bedc14 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,2 +1,3 @@ mock -pytest-ckan \ No newline at end of file +pytest-ckan +coverage \ No newline at end of file