Reorganise XML test files into more sensible directory names. Add lower level validation tests.

This commit is contained in:
David Read 2012-10-19 14:23:34 +01:00
parent 2d6f497720
commit 0e8a62fe1e
31 changed files with 1227 additions and 65 deletions

View File

@ -134,14 +134,14 @@ class TestHarvest(HarvestFixtureBase):
@classmethod
def setup_class(cls):
SpatialHarvester._validator = Validators(profiles=['iso19139','gemini2'])
SpatialHarvester._validator = Validators(profiles=['gemini2'])
HarvestFixtureBase.setup_class()
def test_harvest_basic(self):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/waf/index.html',
'url': u'http://127.0.0.1:8999/gemini2.1-waf/index.html',
'type': u'gemini-waf'
}
@ -178,7 +178,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/service1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/service1.xml',
'type': u'gemini-single'
}
@ -285,7 +285,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/dataset1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/dataset1.xml',
'type': u'gemini-single'
}
@ -386,7 +386,7 @@ class TestHarvest(HarvestFixtureBase):
def test_harvest_error_bad_xml(self):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/error_bad_xml.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/error_bad_xml.xml',
'type': u'gemini-single'
}
@ -410,7 +410,7 @@ class TestHarvest(HarvestFixtureBase):
def test_harvest_error_404(self):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/not_there.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/not_there.xml',
'type': u'gemini-single'
}
@ -430,7 +430,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/error_validation.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/error_validation.xml',
'type': u'gemini-single'
}
@ -473,7 +473,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/dataset1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/dataset1.xml',
'type': u'gemini-single'
}
@ -537,7 +537,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/service1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/service1.xml',
'type': u'gemini-single'
}
@ -575,7 +575,7 @@ class TestHarvest(HarvestFixtureBase):
# Harvest an updated document, with a more recent modified date, package should be
# updated and reactivated
source.url = u'http://127.0.0.1:8999/single/service1_newer.xml'
source.url = u'http://127.0.0.1:8999/gemini2.1/service1_newer.xml'
source.save()
third_job = self._create_job(source.id)
@ -608,7 +608,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source1
source1_fixture = {
'url': u'http://127.0.0.1:8999/single/source1/same_dataset.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/source1/same_dataset.xml',
'type': u'gemini-single'
}
@ -628,7 +628,7 @@ class TestHarvest(HarvestFixtureBase):
# (As of https://github.com/okfn/ckanext-inspire/commit/9fb67
# we are no longer throwing an exception when this happens)
source2_fixture = {
'url': u'http://127.0.0.1:8999/single/source2/same_dataset.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/source2/same_dataset.xml',
'type': u'gemini-single'
}
@ -673,7 +673,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source1
source1_fixture = {
'url': u'http://127.0.0.1:8999/single/source1/same_dataset.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/source1/same_dataset.xml',
'type': u'gemini-single'
}
@ -694,7 +694,7 @@ class TestHarvest(HarvestFixtureBase):
# Harvest the same document, unchanged, from another source
source2_fixture = {
'url': u'http://127.0.0.1:8999/single/source2/same_dataset.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/source2/same_dataset.xml',
'type': u'gemini-single'
}
@ -716,7 +716,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source1
source1_fixture = {
'url': u'http://127.0.0.1:8999/single/service1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/service1.xml',
'type': u'gemini-single'
}
@ -733,7 +733,7 @@ class TestHarvest(HarvestFixtureBase):
# Harvest the same document GUID but with a newer date, from another source.
source2_fixture = {
'url': u'http://127.0.0.1:8999/single/service1_newer.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/service1_newer.xml',
'type': u'gemini-single'
}
@ -758,7 +758,7 @@ class TestHarvest(HarvestFixtureBase):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/dataset1.xml',
'url': u'http://127.0.0.1:8999/gemini2.1/dataset1.xml',
'type': u'gemini-single'
}
@ -804,16 +804,6 @@ class TestHarvest(HarvestFixtureBase):
assert len(source_dict['status']['packages']) == 1
validation_error_xml = '''
<root xmlns:svrl="http://purl.oclc.org/dsdl/svrl">
<svrl:failed-assert test="srv:serviceType/*[1] = 'discovery' or srv:serviceType/*[1] = 'view' or srv:serviceType/*[1] = 'download' or srv:serviceType/*[1] = 'transformation' or srv:serviceType/*[1] = 'invoke' or srv:serviceType/*[1] = 'other'" location="/*[local-name()='MD_Metadata' and namespace-uri()='http://www.isotc211.org/2005/gmd']/*[local-name()='identificationInfo' and namespace-uri()='http://www.isotc211.org/2005/gmd']/*[local-name()='SV_ServiceIdentification' and namespace-uri()='http://www.isotc211.org/2005/srv']">
<svrl:text>
Service type shall be one of 'discovery', 'view', 'download', 'transformation', 'invoke' or 'other' following INSPIRE generic names.
</svrl:text>
</svrl:failed-assert>
</root>
'''
class TestValidation(HarvestFixtureBase):
@classmethod
@ -824,7 +814,7 @@ class TestValidation(HarvestFixtureBase):
def get_validation_errors(self, validation_test_filename):
# Create source
source_fixture = {
'url': u'http://127.0.0.1:8999/single/validation/%s' % validation_test_filename,
'url': u'http://127.0.0.1:8999/gemini2.1/validation/%s' % validation_test_filename,
'type': u'gemini-single'
}
@ -839,16 +829,6 @@ class TestValidation(HarvestFixtureBase):
errors = '; '.join([gather_error.message for gather_error in job.gather_errors])
return errors
def test_schematron_error_extraction(self):
failure_xml = lxml.etree.fromstring(validation_error_xml)
fail_element = failure_xml.getchildren()[0]
details = SchematronValidator.extract_error_details(fail_element)
if isinstance(details, tuple):
details = details[1]
assert_in("srv:serviceType/*[1] = 'discovery'", details)
assert_in("/*[local-name()='MD_Metadata'", details)
assert_in("Service type shall be one of 'discovery'", details)
def test_01_dataset_fail_iso19139_schema(self):
errors = self.get_validation_errors('01_Dataset_Invalid_XSD_No_Such_Element.xml')
assert len(errors) > 0

View File

@ -0,0 +1,139 @@
import os
from lxml import etree
from nose.tools import assert_equal, assert_in
from ckanext.spatial import validation
# other validation tests are in test_harvest.py
class TestValidation:
def get_validation_errors(self, validator, validation_test_filename):
validation_test_filepath = os.path.join(os.path.dirname(__file__),
'xml',
validation_test_filename)
xml = etree.parse(validation_test_filepath)
is_valid, errors = validator.is_valid(xml)
return ';'.join(errors)
def test_iso19139_failure(self):
errors = self.get_validation_errors(validation.ISO19139Schema,
'iso19139/dataset-invalid.xml')
assert len(errors) > 0
assert_in('Dataset schema (gmx.xsd)', errors)
assert_in('{http://www.isotc211.org/2005/gmd}nosuchelement\': This element is not expected.', errors)
def test_iso19139_pass(self):
errors = self.get_validation_errors(validation.ISO19139Schema,
'iso19139/dataset.xml')
assert_equal(errors, '')
# Gemini2.1 tests are basically the same as those in test_harvest.py but
# a few little differences make it worth not removing them in
# test_harvest
def test_01_dataset_fail_iso19139_schema(self):
errors = self.get_validation_errors(validation.ISO19139EdenSchema,
'gemini2.1/validation/01_Dataset_Invalid_XSD_No_Such_Element.xml')
assert len(errors) > 0
assert_in('(gmx.xsd)', errors)
assert_in('\'{http://www.isotc211.org/2005/gmd}nosuchelement\': This element is not expected.', errors)
def test_02_dataset_fail_constraints_schematron(self):
errors = self.get_validation_errors(validation.ConstraintsSchematron,
'gemini2.1/validation/02_Dataset_Invalid_19139_Missing_Data_Format.xml')
assert len(errors) > 0
assert_in('MD_Distribution / MD_Format: count(distributionFormat + distributorFormat) > 0', errors)
def test_03_dataset_fail_gemini_schematron(self):
errors = self.get_validation_errors(validation.Gemini2Schematron,
'gemini2.1/validation/03_Dataset_Invalid_GEMINI_Missing_Keyword.xml')
assert len(errors) > 0
assert_in('Descriptive keywords are mandatory', errors)
def assert_passes_all_gemini2_1_validation(self, xml_filepath):
errs = self.get_validation_errors(validation.ISO19139EdenSchema,
xml_filepath)
assert not errs, 'ISO19139EdenSchema: ' + errs
errs = self.get_validation_errors(validation.ConstraintsSchematron,
xml_filepath)
assert not errs, 'ConstraintsSchematron: ' + errs
errs = self.get_validation_errors(validation.Gemini2Schematron,
xml_filepath)
assert not errs, 'Gemini2Schematron: ' + errs
def test_04_dataset_valid(self):
self.assert_passes_all_gemini2_1_validation('gemini2.1/validation/04_Dataset_Valid.xml')
def test_05_series_fail_iso19139_schema(self):
errors = self.get_validation_errors(validation.ISO19139EdenSchema,
'gemini2.1/validation/05_Series_Invalid_XSD_No_Such_Element.xml')
assert len(errors) > 0
assert_in('(gmx.xsd)', errors)
assert_in('\'{http://www.isotc211.org/2005/gmd}nosuchelement\': This element is not expected.', errors)
def test_06_series_fail_constraints_schematron(self):
errors = self.get_validation_errors(validation.ConstraintsSchematron,
'gemini2.1/validation/06_Series_Invalid_19139_Missing_Data_Format.xml')
assert len(errors) > 0
assert_in('MD_Distribution / MD_Format: count(distributionFormat + distributorFormat) > 0', errors)
def test_07_series_fail_gemini_schematron(self):
errors = self.get_validation_errors(validation.Gemini2Schematron,
'gemini2.1/validation/07_Series_Invalid_GEMINI_Missing_Keyword.xml')
assert len(errors) > 0
assert_in('Descriptive keywords are mandatory', errors)
def test_08_series_valid(self):
self.assert_passes_all_gemini2_1_validation('gemini2.1/validation/08_Series_Valid.xml')
def test_09_service_fail_iso19139_schema(self):
errors = self.get_validation_errors(validation.ISO19139EdenSchema,
'gemini2.1/validation/09_Service_Invalid_No_Such_Element.xml')
assert len(errors) > 0
assert_in('(gmx.xsd & srv.xsd)', errors)
assert_in('\'{http://www.isotc211.org/2005/gmd}nosuchelement\': This element is not expected.', errors)
def test_10_service_fail_constraints_schematron(self):
errors = self.get_validation_errors(validation.ConstraintsSchematron,
'gemini2.1/validation/10_Service_Invalid_19139_Level_Description.xml')
assert len(errors) > 0
assert_in("DQ_Scope: 'levelDescription' is mandatory if 'level' notEqual 'dataset' or 'series'.", errors)
def test_11_service_fail_gemini_schematron(self):
errors = self.get_validation_errors(validation.Gemini2Schematron,
'gemini2.1/validation/11_Service_Invalid_GEMINI_Service_Type.xml')
assert len(errors) > 0
assert_in("Service type shall be one of 'discovery', 'view', 'download', 'transformation', 'invoke' or 'other' following INSPIRE generic names.", errors)
def test_12_service_valid(self):
self.assert_passes_all_gemini2_1_validation('gemini2.1/validation/12_Service_Valid.xml')
def test_13_dataset_fail_iso19139_schema_2(self):
# This test Dataset has srv tags and only Service metadata should.
errors = self.get_validation_errors(validation.ISO19139EdenSchema,
'gemini2.1/validation/13_Dataset_Invalid_Element_srv.xml')
assert len(errors) > 0
assert_in('(gmx.xsd)', errors)
assert_in('(u"Element \'{http://www.isotc211.org/2005/srv}SV_ServiceIdentification\': This element is not expected.', errors)
def test_schematron_error_extraction(self):
validation_error_xml = '''
<root xmlns:svrl="http://purl.oclc.org/dsdl/svrl">
<svrl:failed-assert test="srv:serviceType/*[1] = 'discovery' or srv:serviceType/*[1] = 'view' or srv:serviceType/*[1] = 'download' or srv:serviceType/*[1] = 'transformation' or srv:serviceType/*[1] = 'invoke' or srv:serviceType/*[1] = 'other'" location="/*[local-name()='MD_Metadata' and namespace-uri()='http://www.isotc211.org/2005/gmd']/*[local-name()='identificationInfo' and namespace-uri()='http://www.isotc211.org/2005/gmd']/*[local-name()='SV_ServiceIdentification' and namespace-uri()='http://www.isotc211.org/2005/srv']">
<svrl:text>
Service type shall be one of 'discovery', 'view', 'download', 'transformation', 'invoke' or 'other' following INSPIRE generic names.
</svrl:text>
</svrl:failed-assert>
</root>
'''
failure_xml = etree.fromstring(validation_error_xml)
fail_element = failure_xml.getchildren()[0]
details = validation.SchematronValidator.extract_error_details(fail_element)
if isinstance(details, tuple):
details = details[1]
assert_in("srv:serviceType/*[1] = 'discovery'", details)
assert_in("/*[local-name()='MD_Metadata'", details)
assert_in("Service type shall be one of 'discovery'", details)

View File

@ -0,0 +1,498 @@
<?xml version='1.0' encoding='ASCII'?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<gmd:nosuchelement>
<gco:CharacterString>test-record</gco:CharacterString>
</gmd:nosuchelement>
<gmd:fileIdentifier xmlns:gml="http://www.opengis.net/gml">
<gco:CharacterString>test-dataset</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/php/code_list.php" codeListValue="eng">eng</gmd:LanguageCode>
</gmd:language>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems and Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
<gco:DateTime xmlns:gml="http://www.opengis.net/gml">2011-09-23T10:06:08</gco:DateTime>
</gmd:dateStamp>
<gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>urn:ogc:def:crs:EPSG::27700</gco:CharacterString>
</gmd:code>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>Country Parks (Scotland)</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2004-02</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2006-07-03</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>CPK</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>
<gmd:presentationForm>
<gmd:CI_PresentationFormCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#CI_PresentationFormCode" codeListValue="mapDigital"/>
</gmd:presentationForm>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>Parks are set up by Local Authorities to provide open-air recreation facilities close to towns and cities. [edited]</gco:CharacterString>
</gmd:abstract>
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="custodian">custodian</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="irregular">irregular</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<gmd:resourceFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>SDE Feature Class</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing">
<gco:CharacterString/>
</gmd:version>
</gmd:MD_Format>
</gmd:resourceFormat>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>Nature conservation</gco:CharacterString>
</gmd:keyword>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>Government Category List</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2004-07-15</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
</gmd:useConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
</gmd:useConstraints>
<gmd:otherConstraints>
<gco:CharacterString>Copyright Scottish Natural Heritage</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
<gmd:resourceConstraints>
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>Reference and PSMA Only</gco:CharacterString>
</gmd:useLimitation>
<gmd:useLimitation>
<gco:CharacterString>http://www.test.gov.uk/licenseurl</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<gmd:spatialRepresentationType>
<gmd:MD_SpatialRepresentationTypeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_SpatialRepresentationTypeCode" codeListValue="vector"/>
</gmd:spatialRepresentationType>
<gmd:spatialResolution>
<gmd:MD_Resolution>
<gmd:distance>
<gco:Distance uom="urn:ogc:def:uom:EPSG::9001">5</gco:Distance>
</gmd:distance>
</gmd:MD_Resolution>
</gmd:spatialResolution>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/php/code_list.php" codeListValue="eng">eng</gmd:LanguageCode>
</gmd:language>
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>environment</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicDescription>
<gmd:geographicIdentifier>
<gmd:MD_Identifier>
<gmd:authority>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>ISO 3166</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2007-09-02</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:authority>
<gmd:code>
<gco:CharacterString>GB-SCT</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:geographicIdentifier>
</gmd:EX_GeographicDescription>
</gmd:geographicElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-8.97114288</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>0.205857204</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>54.529947158</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>61.06066944</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
<gmd:temporalElement>
<gmd:EX_TemporalExtent xmlns:gml="http://www.opengis.net/gml">
<gmd:extent>
<gml:TimePeriod gml:id="_d1242823">
<gml:beginPosition>1998</gml:beginPosition>
<gml:endPosition>2010</gml:endPosition>
</gml:TimePeriod>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>ESRI Shapefile</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>Unknown</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>KML</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>2.1</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>GML</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>3.1.1</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:distributorContact>
<gmd:distributorFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>SDE Feature Class</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing">
<gco:CharacterString/>
</gmd:version>
</gmd:MD_Format>
</gmd:distributorFormat>
<gmd:distributorTransferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.snh.org.uk/snhi</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:distributorTransferOptions>
</gmd:MD_Distributor>
</gmd:distributor>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://gateway.snh.gov.uk/pls/apex_ddtdb2/f?p=101</gmd:URL>
</gmd:linkage>
<gmd:name>
<gco:CharacterString>Test Resource Name</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>Test Resource Description</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:level>
</gmd:DQ_Scope>
</gmd:scope>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>Country Park is not a statutory designation. Countryside (Scotland) Act 1967 Section 48 gives local authorities power to assess and review the need for Country Parks in consultation with SNH.</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</gmd:MD_Metadata>

View File

@ -0,0 +1,495 @@
<?xml version='1.0' encoding='ASCII'?>
<gmd:MD_Metadata xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gmx="http://www.isotc211.org/2005/gmx" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:geonet="http://www.fao.org/geonetwork" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<gmd:fileIdentifier xmlns:gml="http://www.opengis.net/gml">
<gco:CharacterString>test-dataset-1</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/php/code_list.php" codeListValue="eng">eng</gmd:LanguageCode>
</gmd:language>
<gmd:hierarchyLevel>
<gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:hierarchyLevel>
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems and Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="pointOfContact">pointOfContact</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
<gco:DateTime xmlns:gml="http://www.opengis.net/gml">2011-09-23T10:06:08</gco:DateTime>
</gmd:dateStamp>
<gmd:referenceSystemInfo>
<gmd:MD_ReferenceSystem>
<gmd:referenceSystemIdentifier>
<gmd:RS_Identifier>
<gmd:code>
<gco:CharacterString>urn:ogc:def:crs:EPSG::27700</gco:CharacterString>
</gmd:code>
</gmd:RS_Identifier>
</gmd:referenceSystemIdentifier>
</gmd:MD_ReferenceSystem>
</gmd:referenceSystemInfo>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>Country Parks (Scotland)</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2004-02</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2006-07-03</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<gmd:identifier>
<gmd:MD_Identifier>
<gmd:code>
<gco:CharacterString>CPK</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:identifier>
<gmd:presentationForm>
<gmd:CI_PresentationFormCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#CI_PresentationFormCode" codeListValue="mapDigital"/>
</gmd:presentationForm>
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>Parks are set up by Local Authorities to provide open-air recreation facilities close to towns and cities. [edited]</gco:CharacterString>
</gmd:abstract>
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="custodian">custodian</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
<gmd:pointOfContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:pointOfContact>
<gmd:resourceMaintenance>
<gmd:MD_MaintenanceInformation>
<gmd:maintenanceAndUpdateFrequency>
<gmd:MD_MaintenanceFrequencyCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_MaintenanceFrequencyCode" codeListValue="irregular">irregular</gmd:MD_MaintenanceFrequencyCode>
</gmd:maintenanceAndUpdateFrequency>
</gmd:MD_MaintenanceInformation>
</gmd:resourceMaintenance>
<gmd:resourceFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>SDE Feature Class</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing">
<gco:CharacterString/>
</gmd:version>
</gmd:MD_Format>
</gmd:resourceFormat>
<gmd:descriptiveKeywords>
<gmd:MD_Keywords>
<gmd:keyword>
<gco:CharacterString>Nature conservation</gco:CharacterString>
</gmd:keyword>
<gmd:thesaurusName>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>Government Category List</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2004-07-15</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:thesaurusName>
</gmd:MD_Keywords>
</gmd:descriptiveKeywords>
<gmd:resourceConstraints>
<gmd:MD_LegalConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:accessConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
</gmd:accessConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="copyright">copyright</gmd:MD_RestrictionCode>
</gmd:useConstraints>
<gmd:useConstraints>
<gmd:MD_RestrictionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_RestrictionCode" codeListValue="otherRestrictions">otherRestrictions</gmd:MD_RestrictionCode>
</gmd:useConstraints>
<gmd:otherConstraints>
<gco:CharacterString>Copyright Scottish Natural Heritage</gco:CharacterString>
</gmd:otherConstraints>
</gmd:MD_LegalConstraints>
</gmd:resourceConstraints>
<gmd:resourceConstraints>
<gmd:MD_Constraints>
<gmd:useLimitation>
<gco:CharacterString>Reference and PSMA Only</gco:CharacterString>
</gmd:useLimitation>
<gmd:useLimitation>
<gco:CharacterString>http://www.test.gov.uk/licenseurl</gco:CharacterString>
</gmd:useLimitation>
</gmd:MD_Constraints>
</gmd:resourceConstraints>
<gmd:spatialRepresentationType>
<gmd:MD_SpatialRepresentationTypeCode codeList="http://www.isotc211.org/2005/resources/codeList.xml#MD_SpatialRepresentationTypeCode" codeListValue="vector"/>
</gmd:spatialRepresentationType>
<gmd:spatialResolution>
<gmd:MD_Resolution>
<gmd:distance>
<gco:Distance uom="urn:ogc:def:uom:EPSG::9001">5</gco:Distance>
</gmd:distance>
</gmd:MD_Resolution>
</gmd:spatialResolution>
<gmd:language>
<gmd:LanguageCode codeList="http://www.loc.gov/standards/iso639-2/php/code_list.php" codeListValue="eng">eng</gmd:LanguageCode>
</gmd:language>
<gmd:topicCategory>
<gmd:MD_TopicCategoryCode>environment</gmd:MD_TopicCategoryCode>
</gmd:topicCategory>
<gmd:extent>
<gmd:EX_Extent>
<gmd:geographicElement>
<gmd:EX_GeographicDescription>
<gmd:geographicIdentifier>
<gmd:MD_Identifier>
<gmd:authority>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>ISO 3166</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>2007-09-02</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision">revision</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
</gmd:CI_Citation>
</gmd:authority>
<gmd:code>
<gco:CharacterString>GB-SCT</gco:CharacterString>
</gmd:code>
</gmd:MD_Identifier>
</gmd:geographicIdentifier>
</gmd:EX_GeographicDescription>
</gmd:geographicElement>
<gmd:geographicElement>
<gmd:EX_GeographicBoundingBox>
<gmd:westBoundLongitude>
<gco:Decimal>-8.97114288</gco:Decimal>
</gmd:westBoundLongitude>
<gmd:eastBoundLongitude>
<gco:Decimal>0.205857204</gco:Decimal>
</gmd:eastBoundLongitude>
<gmd:southBoundLatitude>
<gco:Decimal>54.529947158</gco:Decimal>
</gmd:southBoundLatitude>
<gmd:northBoundLatitude>
<gco:Decimal>61.06066944</gco:Decimal>
</gmd:northBoundLatitude>
</gmd:EX_GeographicBoundingBox>
</gmd:geographicElement>
<gmd:temporalElement>
<gmd:EX_TemporalExtent xmlns:gml="http://www.opengis.net/gml">
<gmd:extent>
<gml:TimePeriod gml:id="_d1242823">
<gml:beginPosition>1998</gml:beginPosition>
<gml:endPosition>2010</gml:endPosition>
</gml:TimePeriod>
</gmd:extent>
</gmd:EX_TemporalExtent>
</gmd:temporalElement>
</gmd:EX_Extent>
</gmd:extent>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
<gmd:distributionInfo>
<gmd:MD_Distribution>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>ESRI Shapefile</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>Unknown</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>KML</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>2.1</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributionFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>GML</gco:CharacterString>
</gmd:name>
<gmd:version>
<gco:CharacterString>3.1.1</gco:CharacterString>
</gmd:version>
</gmd:MD_Format>
</gmd:distributionFormat>
<gmd:distributor>
<gmd:MD_Distributor>
<gmd:distributorContact>
<gmd:CI_ResponsibleParty>
<gmd:individualName>
<gco:CharacterString>Lachlan Renwick</gco:CharacterString>
</gmd:individualName>
<gmd:organisationName>
<gco:CharacterString>Scottish Natural Heritage</gco:CharacterString>
</gmd:organisationName>
<gmd:positionName>
<gco:CharacterString>Geographic Systems &amp; Data Coordinator</gco:CharacterString>
</gmd:positionName>
<gmd:contactInfo>
<gmd:CI_Contact>
<gmd:phone>
<gmd:CI_Telephone>
<gmd:voice>
<gco:CharacterString>01463 725000</gco:CharacterString>
</gmd:voice>
</gmd:CI_Telephone>
</gmd:phone>
<gmd:address>
<gmd:CI_Address>
<gmd:deliveryPoint>
<gco:CharacterString>Great Glen House, Leachkin Road</gco:CharacterString>
</gmd:deliveryPoint>
<gmd:city>
<gco:CharacterString>INVERNESS</gco:CharacterString>
</gmd:city>
<gmd:postalCode>
<gco:CharacterString>IV3 8NW</gco:CharacterString>
</gmd:postalCode>
<gmd:country>
<gco:CharacterString>United Kingdom</gco:CharacterString>
</gmd:country>
<gmd:electronicMailAddress>
<gco:CharacterString>data_supply@snh.gov.uk</gco:CharacterString>
</gmd:electronicMailAddress>
</gmd:CI_Address>
</gmd:address>
</gmd:CI_Contact>
</gmd:contactInfo>
<gmd:role>
<gmd:CI_RoleCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_RoleCode" codeListValue="distributor">distributor</gmd:CI_RoleCode>
</gmd:role>
</gmd:CI_ResponsibleParty>
</gmd:distributorContact>
<gmd:distributorFormat>
<gmd:MD_Format>
<gmd:name>
<gco:CharacterString>SDE Feature Class</gco:CharacterString>
</gmd:name>
<gmd:version gco:nilReason="missing">
<gco:CharacterString/>
</gmd:version>
</gmd:MD_Format>
</gmd:distributorFormat>
<gmd:distributorTransferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>http://www.snh.org.uk/snhi</gmd:URL>
</gmd:linkage>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:distributorTransferOptions>
</gmd:MD_Distributor>
</gmd:distributor>
<gmd:transferOptions>
<gmd:MD_DigitalTransferOptions>
<gmd:onLine>
<gmd:CI_OnlineResource>
<gmd:linkage>
<gmd:URL>https://gateway.snh.gov.uk/pls/apex_ddtdb2/f?p=101</gmd:URL>
</gmd:linkage>
<gmd:name>
<gco:CharacterString>Test Resource Name</gco:CharacterString>
</gmd:name>
<gmd:description>
<gco:CharacterString>Test Resource Description</gco:CharacterString>
</gmd:description>
<gmd:function>
<gmd:CI_OnLineFunctionCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode" codeListValue="download">download</gmd:CI_OnLineFunctionCode>
</gmd:function>
</gmd:CI_OnlineResource>
</gmd:onLine>
</gmd:MD_DigitalTransferOptions>
</gmd:transferOptions>
</gmd:MD_Distribution>
</gmd:distributionInfo>
<gmd:dataQualityInfo>
<gmd:DQ_DataQuality>
<gmd:scope>
<gmd:DQ_Scope>
<gmd:level>
<gmd:MD_ScopeCode codeList="http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/resources/Codelist/gmxCodelists.xml#MD_ScopeCode" codeListValue="dataset">dataset</gmd:MD_ScopeCode>
</gmd:level>
</gmd:DQ_Scope>
</gmd:scope>
<gmd:lineage>
<gmd:LI_Lineage>
<gmd:statement>
<gco:CharacterString>Country Park is not a statutory designation. Countryside (Scotland) Act 1967 Section 48 gives local authorities power to assess and review the need for Country Parks in consultation with SNH.</gco:CharacterString>
</gmd:statement>
</gmd:LI_Lineage>
</gmd:lineage>
</gmd:DQ_DataQuality>
</gmd:dataQualityInfo>
</gmd:MD_Metadata>

View File

@ -10,8 +10,9 @@ PORT = 8999
def serve(port=PORT):
'''Serves test XML files over HTTP'''
# Make sure we serve from the tests directory
os.chdir(os.path.dirname(os.path.abspath( __file__ )))
# Make sure we serve from the tests' XML directory
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)),
'xml'))
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

View File

@ -53,6 +53,18 @@ class XsdValidator(BaseValidator):
return True, []
class ISO19139Schema(XsdValidator):
name = 'iso19139'
title = 'ISO19139 XSD Schema'
@classmethod
def is_valid(cls, xml):
xsd_path = 'xml/iso19139'
gmx_xsd_filepath = os.path.join(os.path.dirname(__file__),
xsd_path, 'gmx/gmx.xsd')
is_valid, errors = cls._is_valid(xml, gmx_xsd_filepath, 'Dataset schema (gmx.xsd)')
return is_valid, errors
class ISO19139EdenSchema(XsdValidator):
name = 'iso19139eden'
title = 'ISO19139 XSD Schema (EDEN)'
@ -157,31 +169,6 @@ class SchematronValidator(BaseValidator):
return etree.XSLT(compiled)
class ISO19139Schema(SchematronValidator):
name = 'iso19139'
title = 'ISO19139 XSD Schema'
@classmethod
def get_schematrons(cls):
with resource_stream("ckanext.csw", "xml/schematron/ExtractSchFromXSD.xsl") as xsl_file:
xsl = etree.parse(xsl_file)
xsd2sch = etree.XSLT(xsl)
root = resource_filename("ckanext.csw", "xml/iso19139")
schematrons = []
for filename in ["gmd/gmd.xsd"]:
filename = os.path.join(root, filename)
with open(filename) as xsd_file:
xsd = etree.parse(xsd_file)
extracted_schematron_rules = xsd2sch(xsd)
# There are no schematron rules here! So this validation is pointless.
#<?xml version="1.0" standalone="yes"?>
#<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema">
# <sch:diagnostics/>
#</sch:schema>
schematrons.append(cls.schematron(extracted_schematron_rules))
return schematrons
class ConstraintsSchematron(SchematronValidator):
name = 'constraints'
title = 'ISO19139 Table A.1 Constraints Schematron 1.3'

62
test.ini Normal file
View File

@ -0,0 +1,62 @@
[DEFAULT]
debug = true
# Uncomment and replace with the address which should receive any error reports
#email_to = you@yourdomain.com
smtp_server = localhost
error_email_from = paste@localhost
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000
[app:main]
use = config:test-core.ini
# Here we hard-code the database and a flag to make default tests
# run fast.
faster_db_test_hacks = True
sqlalchemy.url = sqlite:///
# NB: other test configuration should go in test-core.ini, which is
# what the postgres tests use.
# Logging configuration
[loggers]
keys = root, ckan, ckanext, sqlalchemy
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_ckan]
qualname = ckan
handlers = console
level = INFO
propagate = 0
[logger_ckanext]
qualname = ckanext
handlers = console
level = DEBUG
propagate = 0
[logger_sqlalchemy]
handlers = console
qualname = sqlalchemy.engine
level = WARN
[handler_console]
class = StreamHandler
args = (sys.stdout,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s