Comments (2)
Mapping the formats provided in the remote DCAT document to the ones that CKAN previews understand is out of the scope of this extension for now, and is up to extensions to define them. I've created #18 to add this feature.
In this particular case the remote file is defining them "properly" as mime types, which is what CKAN core should eventually support (see ckan/ckan#1350 and ckan/ckan#1336).
In the meantime, is up to particular extensions to implement the mapping. You can do this by extending the DCATXMLHarvester
class and implementing a modify_package_dict
method on your own extension. Something like this should get you started:
# ckanext.myext.harvesters.py
from ckanext.dcat.harvesters import DCATXMLHarvester
class MyDCATHarvester(DCATXMLHarvester):
def modify_package_dict(self, package_dict, dcat_dict, harvest_object):
# See https://github.com/ckan/ckan/blob/master/ckan/config/resource_formats.json
mapping = {
'application/xml': 'xml',
'application/gzip': 'gz',
# ...
}
for resource in package_dict.get('resources', []):
if resource.get('format') in mapping:
resource['format'] = mapping[resource['format']]
return package_dict
To register your own DCAT harvester, add it as normal plugin to the setup.py
file of your extension:
entry_points=\
"""
[ckan.plugins]
# Add plugins here, eg
my_dcat_harvester=ckanext.myext.harvesters:MyDCATHarvester
""",
And then add it to your ini file:
ckan.plugins = ... my_dcat_harvester
Hope this helps
from ckanext-dcat.
The RDF harvester (dcat_rdf_harvester
) handles this, setting up resource['format'] and resource['mimetype'] properly from the DCAT fields. Please use this harvester instead of the XML based one (https://github.com/ckan/ckanext-dcat#xml-dcat-harvester-deprecated)
from ckanext-dcat.
Related Issues (20)
- ckanext-harvest mandatory or not HOT 2
- Command line interface not working with ckan 2.9 and python 2.8 HOT 2
- Making a new profile for Dcat v.2.0 HOT 8
- DCAT not mapping all metadata to extras
- Catalog.xml UnicodeEncodeError
- Unkown RDF profiles error
- Loading multiple datasets and distribution for those datasets in one jsonld HOT 4
- does the harvester/dcat have the ability to parse an entire catalog with multiple datasets and their distributions at once. HOT 7
- schemaorg profile not working HOT 1
- Could not build url for endpoint 'dcat.read_catalog' HOT 5
- Does not install with python 3.10 HOT 1
- dcat:mediaType must be a resource HOT 3
- Already deleted records are to be deleted again
- Backslash? Forward slash HOT 2
- New version for dropped Py2 and CKAN<2.9 support HOT 3
- two many locn:geometry
- do not split keywords HOT 2
- Harvester crashes with missing title HOT 1
- Support for DCAT 3 HOT 2
- Improving Pagination Handling in RDF Harvester's gather_stage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckanext-dcat.