-
Notifications
You must be signed in to change notification settings - Fork 278
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
[iso19139:2007] add more generic char/anchor check #954
[iso19139:2007] add more generic char/anchor check #954
Conversation
@pvgenuchten - do you have a link to the raw XML used as the basis for your test record? It may also be good to just add the XML snippet that this pull request is solving (with and without a The code looks good to me, but I've no experience with |
03f42d5
to
a0e2029
Compare
updated method text raw xml is at a thing i would like your view on is this: if a list consists of charstring, anchor, charstring, anchor, would you expect:
or
|
Yes, I can see the point of not exposing such real life metadata as part of a software, on the other side it is an indication of the fact that these patterns are used in the wild… |
I'd imagine it would be expected the name and URL list lengths would match, although not sure about use of @pvgenuchten do you have an example of the above from the XML you linked to that I could test the above question with? >>> from owslib.iso import *
>>>
>>> md = MD_Metadata(etree.parse('test.xml'))
>>> iden = md.identification[0]
>>> iden.contact[0].organization_url
'http://standaarden.overheid.nl/owms/terms/Ministerie_van_Defensie'
>>> iden.contact[0].name_url
''
>>> iden.contact[0].name
'Ministerie van Defensie, Koninklijke Marine, Dienst der Hydrografie'
>>> iden.otherconstraints
['Geen beperkingen', 'Er zijn geen condities voor toegang en gebruik', 'Geen beperkingen voor publieke toegang']
>>> dist = md.distribution
>>> dist.specification_url
'http://inspire.ec.europa.eu/id/document/tg/hy' |
updated PR to have matching lengths of xx vs xx_url combined use is available in OWSLib/tests/resources/csw_dov_getrecordbyid.xml Lines 470 to 475 in ae98c20
another sample in the wild is this one |
7a08683
to
6c0c2b5
Compare
Tested this branch with the live URL. from owslib.util import openURL
from owslib.iso import MD_Metadata
from lxml import etree
url = 'https://www.nationaalgeoregister.nl/geonetwork/srv/api/records/1e9cf0ef-f905-46df-b4f8-2bab7a3808bb/formatters/xml'
response = openURL(url)
xml_content = response.read()
xml_tree = etree.fromstring(xml_content)
md = MD_Metadata(xml_tree)
iden = md.identification[0]
# ['Te gebruiken onder voorwaarden van ESRI licentie', 'Niet Commercieel, Geen Afgeleide Werken, Naamsvermelding verplicht, organisatienaam'] This picks up values from both <gmd:otherConstraints>
<gco:CharacterString>Te gebruiken onder voorwaarden van ESRI licentie</gco:CharacterString>
</gmd:otherConstraints>
...
<gmd:otherConstraints>
<gmx:Anchor xlink:href="http://creativecommons.org/licenses/by-nc-nd/4.0/deed.nl">
Niet Commercieel, Geen Afgeleide Werken, Naamsvermelding verplicht, organisatienaam
</gmx:Anchor>
</gmd:otherConstraints> Failing CI issues are unrelated. Will merge shortly unless any issues raised. |
Anchor is used in quite places in the inspire profile on iso19139:2007
Add xxx_url property to keep backwards compatibility
Adds tests based on a record, derived from nationaalgeoregister.nl