serializers: added dcat serializer #2328
Annotations
2 errors
Run tests:
site/zenodo_rdm/serializers/dcat.py#L1
Black format check
--- /home/runner/work/zenodo-rdm/zenodo-rdm/site/zenodo_rdm/serializers/dcat.py 2024-12-03 12:13:49.097474+00:00
+++ /home/runner/work/zenodo-rdm/zenodo-rdm/site/zenodo_rdm/serializers/dcat.py 2024-12-03 12:21:40.902019+00:00
@@ -21,28 +21,33 @@
super().__init__(**options)
def add_missing_creator_link(self, rdf_tree):
"""Add `rdf:about` attributes to <rdf:Description> within <dct:creator> if missing."""
namespaces = rdf_tree.nsmap
- creators = rdf_tree.xpath("//dct:creator/rdf:Description[not(@Rdf:about)]", namespaces=namespaces)
+ creators = rdf_tree.xpath(
+ "//dct:creator/rdf:Description[not(@Rdf:about)]", namespaces=namespaces
+ )
for description in creators:
identifier_elem = description.find("dct:identifier", namespaces)
if identifier_elem is not None:
identifier = identifier_elem.text.strip()
schemes = idutils.detect_identifier_schemes(identifier)
rdf_about_url = next(
- (idutils.to_url(identifier, scheme=scheme) for scheme in schemes if idutils.to_url(identifier, scheme)),
- None
+ (
+ idutils.to_url(identifier, scheme=scheme)
+ for scheme in schemes
+ if idutils.to_url(identifier, scheme)
+ ),
+ None,
)
if rdf_about_url:
description.set(
"{http://www.w3.org/1999/02/22-rdf-syntax-ns#}about",
rdf_about_url,
)
return rdf_tree
-
def transform_with_xslt(self, dc_record, **kwargs):
"""Transform record with XSLT and add rdf:about."""
# Transform with base class functionality
dc_etree = schema43.dump_etree(dc_record)
|
Run tests
Process completed with exit code 1.
|
Loading