Skip to content

Commit

Permalink
set dc mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten committed Nov 20, 2024
1 parent 4a27826 commit 4c429d3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
8 changes: 6 additions & 2 deletions pycsw/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,14 @@ def __init__(self, prefix='csw30'):
{'dbcol': self.md_core_model['mappings']['pycsw:Publisher']},
'dc:contributor':
{'dbcol': self.md_core_model['mappings']['pycsw:Contributor']},
'dct:created':
{'dbcol': self.md_core_model['mappings']['pycsw:CreationDate']},
'dct:modified':
{'dbcol': self.md_core_model['mappings']['pycsw:Modified']},
{'dbcol': self.md_core_model['mappings']['pycsw:RevisionDate']},
'dct:available':
{'dbcol': self.md_core_model['mappings']['pycsw:PublicationDate']},
'dc:date':
{'dbcol': self.md_core_model['mappings']['pycsw:Date']},
{'dbcol': self.md_core_model['mappings']['pycsw:Modified']},
'dc:type':
{'dbcol': self.md_core_model['mappings']['pycsw:Type']},
'dc:format':
Expand Down
8 changes: 5 additions & 3 deletions pycsw/core/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,9 @@ def _parse_dc(context, repos, exml):

_set(context, recobj, 'pycsw:ParentIdentifier', md.ispartof)
_set(context, recobj, 'pycsw:Relation', md.relation)
_set(context, recobj, 'pycsw:TempExtent_begin', md.temporal)
_set(context, recobj, 'pycsw:TempExtent_end', md.temporal)
_set(context, recobj, 'pycsw:TempExtent_begin', md.temporal.split('/')[0])
if len(md.temporal.split('/')) > 0:
_set(context, recobj, 'pycsw:TempExtent_end', md.temporal.split('/').pop())
_set(context, recobj, 'pycsw:ResourceLanguage', md.language)
_set(context, recobj, 'pycsw:Creator', md.creator)
_set(context, recobj, 'pycsw:Publisher', md.publisher)
Expand All @@ -1685,9 +1686,10 @@ def _parse_dc(context, repos, exml):
_set(context, recobj, 'pycsw:AccessConstraints', md.accessrights)
_set(context, recobj, 'pycsw:OtherConstraints', md.license)
_set(context, recobj, 'pycsw:Date', md.date)
_set(context, recobj, 'pycsw:Modified', md.date)
_set(context, recobj, 'pycsw:CreationDate', md.created)
_set(context, recobj, 'pycsw:PublicationDate', md.issued)
_set(context, recobj, 'pycsw:Modified', md.modified)
_set(context, recobj, 'pycsw:RevisionDate', md.modified)
_set(context, recobj, 'pycsw:Format', md.format)
_set(context, recobj, 'pycsw:Source', md.source)

Expand Down
9 changes: 8 additions & 1 deletion pycsw/ogc/csw/csw2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ def _write_record(self, recobj, queryables):
util.nspath_eval(i, self.parent.context.namespaces)).text = val

if self.parent.kvp['elementsetname'] == 'full': # add full elements
for i in ['dc:date', 'dc:creator', \
for i in ['dc:date', 'dct:created', 'dct:issued', 'dc:creator', \
'dc:publisher', 'dc:contributor', 'dc:source', \
'dc:language', 'dc:rights', 'dct:alternative']:
val = util.getqattr(recobj, queryables[i]['dbcol'])
Expand All @@ -1550,6 +1550,13 @@ def _write_record(self, recobj, queryables):
etree.SubElement(record,
util.nspath_eval('dct:spatial', self.parent.context.namespaces), scheme='http://www.opengis.net/def/crs').text = val

# temporal extent
begin = util.getqattr(recobj, self.parent.context.md_core_model['mappings']['pycsw:time_begin'])
end = util.getqattr(recobj, self.parent.context.md_core_model['mappings']['pycsw:time_end'])
if begin or end:
etree.SubElement(record,
util.nspath_eval('dct:temporal', self.parent.context.namespaces)).text = f"{begin or ''}/{end or ''}"

# always write out ows:BoundingBox
bboxel = write_boundingbox(getattr(recobj,
self.parent.context.md_core_model['mappings']['pycsw:BoundingBox']),
Expand Down
2 changes: 1 addition & 1 deletion pycsw/ogc/csw/csw3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,7 @@ def _write_record(self, recobj, queryables):
util.nspath_eval(i, self.parent.context.namespaces)).text = val

if self.parent.kvp['elementsetname'] == 'full': # add full elements
for i in ['dc:date', 'dc:creator', \
for i in ['dc:date', 'dct:created', 'dct:issued', 'dc:creator', \
'dc:publisher', 'dc:contributor', 'dc:source', \
'dc:language', 'dc:rights', 'dct:alternative']:
val = util.getqattr(recobj, queryables[i]['dbcol'])
Expand Down

0 comments on commit 4c429d3

Please sign in to comment.