pycsw
pycsw copied to clipboard
GetRecords ignores specified namespace prefix for http://purl.org/dc/elements/1.1
Description
If I post a getRecords query filtering on a Dublin Core property, I have to use the "dc" namespace prefix. Using another (declared) prefix results in an exception (e.g. invalid PropertyName: dcelem:title).
Environment
pycsw version: 2.0 dev source/distribution: git clone web server: mod_wsgi
Python version: sys.version_info(major=2, minor=7, micro=11, releaselevel='final', serial=0)
os: linux2
SQLAlchemy: 1.0.13
Shapely: 1.3.1
lxml: 3.6.0
libxml2: (2, 9, 3)
pyproj: 1.9.3
OWSLib: 0.10.3
Steps to Reproduce
Post the following:
<?xml version="1.0" encoding="UTF-8"?>
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
xmlns:dcelem="http://purl.org/dc/elements/1.1/" service="CSW" version="2.0.2" maxRecords="10">
<csw:Query typeNames="csw:Record">
<csw:ElementSetName>full</csw:ElementSetName>
<csw:Constraint version="1.1.0">
<Filter xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
<PropertyIsLike wildCard="%" singleChar="_" escapeChar="\\">
<PropertyName>dcelem:title</PropertyName>
<Literal>%us%</Literal>
</PropertyIsLike>
</Filter>
</csw:Constraint>
</csw:Query>
</csw:GetRecords>
=> Invalid Constraint: Invalid Filter request: Invalid PropertyName: dcelem:title.
Using dc:title instead of dcelem:title solves the problem.
Additional Information
To my knowledge, XML namespace prefixes are not normative. The CSW-ebRIM spec says:
Several prefixes are used throughout this document to designate XML namespaces. Table 1 lists the namespaces used in this document and the specifications in which they are defined; these bindings shall be assumed in the absence of an explicit declaration. The prefixes are not normative and are merely employed for convenience—they may appear in examples without being formally declared, and have no semantic significance. The namespaces to which the prefixes correspond are normative, however.