diff --git a/cmd/version.go b/cmd/version.go index 9a14e0b..66636f7 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -13,7 +13,7 @@ var versionCmd = &cobra.Command{ Short: "Print the version number of commonmeta", Long: `All software has versions. This is commonmeta's`, Run: func(cmd *cobra.Command, args []string) { - cmd.Println("Commonmeta v0.3.22 -- HEAD") + cmd.Println("Commonmeta v0.3.23 -- HEAD") }, } diff --git a/crossrefxml/writer.go b/crossrefxml/writer.go index 8ac96f8..68afb34 100644 --- a/crossrefxml/writer.go +++ b/crossrefxml/writer.go @@ -279,7 +279,23 @@ func Convert(data commonmeta.Data) (Body, error) { if identifierType == "URL" { identifierType = "uri" } - if slices.Contains(InterWorkRelationTypes, relation.Type) && id != "" { + identifierTypes := []string{ + "doi", + "issn", + "isbn", + "uri", + "pmid", + "pmcid", + "purl", + "arxiv", + "ark", + "handle", + "uuid", + "ecli", + "accession", + "other", + } + if slices.Contains(InterWorkRelationTypes, relation.Type) && slices.Contains(identifierTypes, strings.ToLower(identifierType)) && id != "" { // Crossref relation types are camel case rather than pascal case interWorkRelation := &InterWorkRelation{ RelationshipType: utils.CamelCaseString(relation.Type), @@ -291,7 +307,7 @@ func Convert(data commonmeta.Data) (Body, error) { } relatedItem = append(relatedItem, r) } - if slices.Contains(IntraWorkRelationTypes, relation.Type) && id != "" { + if slices.Contains(IntraWorkRelationTypes, relation.Type) && slices.Contains(identifierTypes, strings.ToLower(identifierType)) && id != "" { intraWorkRelation := &IntraWorkRelation{ RelationshipType: utils.CamelCaseString(relation.Type), IdentifierType: strings.ToLower(identifierType),