[pycsw-devel] intention of xml db field and usage of profile's xpath

Tom Kralidis tomkralidis at gmail.com
Tue Feb 13 09:28:50 PST 2018

Hi Sophie: thanks for the info.  Comments interleaved.

On Tue, 13 Feb 2018, Sophie Herrmann wrote:

> Date: Tue, 13 Feb 2018 10:01:09 +0000
> From: Sophie Herrmann <Sophie.Herrmann at eodc.eu>
> To: "pycsw-devel at lists.osgeo.org" <pycsw-devel at lists.osgeo.org>
> Subject: [pycsw-devel] intention of xml db field and usage of profile's xpath
> Dear pycsw team,
> I just started working with pycsw and found two things I don't fully understand.
> I saw that the DB has a field 'xml' which is not nullable. At first I thought I need to create a xml, store all the metadatainformtion in this xml and save it into this column. But this doesn't really make sense for me because then the whole information is stored twice in the same DB record.
> So my question is, what 's the intention of this field, do I need to create such a xml?

The 'xml' field is designed to keep a full XML representation of the metadata
record.  Usually this field is managed as part of the insert/update process
in pycsw internally so users do not have to worry about it.  If you are
writing a custom application which writes directly to the database without
pycsw then you need to ensure your source XML is stored in this field.

The 'xml' field is provided (in addition to other fields like 'title',
  'abstract', etc.) as an 'early out' field for users asking for the full
representation of the metadata record as-inserted/updated.

> The second question is somehow related. I am currently extending your metadata profile to make additional fields queryable. Using this explaination
> https://gist.github.com/tomkralidis/ddf5ea8b08ae90df592863cf065bd35f I was able to add new custom fields and also query them. I didn't set any xpath but everything still seems to work as expected.
> When do I need to set the xpath and to which xml file does it belong?

the 'xpath' field of a new queryable is not currently used, but valuable
nonetheless.  In pre 1.0 releases of pycsw we did xpath querying.  Shortly
after we removed this functionality to improve performance.  Having said this,
it is still valuable to populate with the real XPath of the queryable in
your XML files.  The XPath is based on  the XML structure for the model/fields
you are extending.

For example, consider the below XML and xpath definition:

  <foo:value>test valuei</foo:value>

'foo:value': {'xpath': '//foo:value', 'dbcol': 'value_column'}

Hope this helps.


> Thanks a lot for your help and time!
> Best regards,
> Sophie

More information about the pycsw-devel mailing list