Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add thesaurus handling to ISO import #226

Merged
merged 1 commit into from
May 10, 2023
Merged

add thesaurus handling to ISO import #226

merged 1 commit into from
May 10, 2023

Conversation

tomkralidis
Copy link
Member

Fixes #225

@pvgenuchten
Copy link
Contributor

pvgenuchten commented May 8, 2023

tom, had to change to to get it working (init.py#L120):

(code expected an object but got dict)

finally the theasurus was not loaded for https://nationaalgeoregister.nl/geonetwork/srv/metadata/208bc283-7c66-4ce7-8ad3-1cf3e8933fb5/formatters/xml, i wonder if this is on owslib side, when adding print(value['thesaurus']), the title in all cases is empty, but for example the date is populated (issue is probably related to geopython/OWSLib#735, use of Anchor vs CharacterString).

if identification.keywords:
            mcf['identification']['keywords'] = {}
            for count, value in enumerate(identification.keywords):
                key = f'keywords-{count}'
                mcf['identification']['keywords'][key] = {
                    'keywords_type': value.get('type',''),
                    'keywords': [k for k in value.get('keywords',[])]
                }
                if value.get('thesaurus') is not None:
                    mcf['identification']['keywords'][key]['vocabulary'] = {
                        'name': value.get('thesaurus').get('title',''),
                        'url': value.get('thesaurus').get('url','')
                    }

actually with this code it works (almost fine)

        if identification.keywords2:
            mcf['identification']['keywords'] = {}
            for count, value in enumerate(identification.keywords2):
                key = f'keywords-{count}'
                mcf['identification']['keywords'][key] = {
                    'keywords_type': value.type,
                    'keywords': [k for k in value.keywords]
                }
                if value.thesaurus is not None:
                    print(value.thesaurus)
                    mcf['identification']['keywords'][key]['vocabulary'] = {
                        'name': value.thesaurus['title'],
                        'url': value.thesaurus['url']
                    }

image

@tomkralidis
Copy link
Member Author

What version of OWSLib are you using (worksforme with 0.29.1)?

@pvgenuchten
Copy link
Contributor

Problem seems on my side, code looks good Tom

@tomkralidis tomkralidis merged commit cd3f360 into master May 10, 2023
@tomkralidis tomkralidis deleted the issue-225 branch May 10, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

check thesaurus import from iso19139
2 participants