Skip to content

Commit

Permalink
remove issn ispartof relation in inveniordm writer
Browse files Browse the repository at this point in the history
  • Loading branch information
mfenner committed Oct 16, 2024
1 parent 6525e80 commit 620b312
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion commonmeta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"""

__title__ = "commonmeta-py"
__version__ = "0.40"
__version__ = "0.41"
__author__ = "Martin Fenner"
__license__ = "MIT"

Expand Down
8 changes: 1 addition & 7 deletions commonmeta/writers/inveniordm_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def write_inveniordm(metadata):
relations = [
to_inveniordm_related_identifier(i)
for i in wrap(metadata.relations)
if i.get("id", None) and i.get("type", None)
if i.get("id", None) and i.get("type", None) != "IsPartOf"
]
related_identifiers = references + relations
funding = compact(
Expand Down Expand Up @@ -212,12 +212,6 @@ def to_inveniordm_related_identifier(relation: dict) -> dict:
if normalize_doi(relation.get("id", None)):
identifier = doi_from_url(relation.get("id", None))
scheme = "doi"
elif (
relation.get("type", None) == "IsPartOf"
and furl(relation.get("id", None)).host == "portal.issn.org"
):
identifier = issn_from_url(relation.get("id", None))
scheme = "issn"
else:
identifier = relation.get("id", None)
scheme = "url"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name="commonmeta-py"
version="0.40"
version="0.41"
repository = "https:/front-matter/commonmeta-py"
homepage = "https://python.commonmeta.org"
documentation = "https://python.commonmeta.org"
Expand Down
16 changes: 2 additions & 14 deletions tests/test-inveniordm_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_journal_article():
)
assert py_.get(inveniordm, "metadata.rights") == [{"id": "cc-by-3.0"}]
related_identifiers = py_.get(inveniordm, "metadata.related_identifiers")
assert len(related_identifiers) == 31
assert len(related_identifiers) == 30
assert related_identifiers[0] == {
"identifier": "10.1038/nature02100",
"relation_type": {
Expand All @@ -119,13 +119,6 @@ def test_journal_article():
},
"scheme": "doi",
}
assert related_identifiers[30] == {
"identifier": "2050-084X",
"relation_type": {
"id": "ispartof",
},
"scheme": "issn",
}
assert py_.get(inveniordm, "metadata.funding") == [
{"funder": {"name": "SystemsX"}},
{"funder": {"name": "EMBO longterm post-doctoral fellowships"}},
Expand Down Expand Up @@ -411,7 +404,7 @@ def test_from_json_feed_references():
== "Differences between ORCID and DataCite Metadata"
)
related_identifiers = py_.get(inveniordm, "metadata.related_identifiers")
assert len(related_identifiers) == 3
assert len(related_identifiers) == 2
assert related_identifiers[0] == {
"identifier": "10.5281/zenodo.30799",
"relation_type": {"id": "references"},
Expand All @@ -422,11 +415,6 @@ def test_from_json_feed_references():
"relation_type": {"id": "isidenticalto"},
"scheme": "doi",
}
assert related_identifiers[2] == {
"identifier": "2749-9952",
"relation_type": {"id": "ispartof"},
"scheme": "issn",
}
assert py_.get(inveniordm, "metadata.funding") == [
{
"award": {
Expand Down

0 comments on commit 620b312

Please sign in to comment.