diff --git a/cmd/epfmt/epfmt.go b/cmd/epfmt/epfmt.go index 1b4b5f4..3e18c98 100644 --- a/cmd/epfmt/epfmt.go +++ b/cmd/epfmt/epfmt.go @@ -44,7 +44,7 @@ var ( helpText = `--- title: "{app_name} (1) user manual" author: "R. S. Doiel" -pubDate: 2023-01-11 +pubDate: 2023-03-03 --- # NAME @@ -59,7 +59,10 @@ pubDate: 2023-01-11 {app_name} is a command line program for pretty printing EPrint XML. It can also convert EPrint XML to and from -JSON. By default it reads from standard input and writes to +EPrint as JSON or as a simplified JSON records for export +to RDM. + +By default it reads from standard input and writes to standard out. {app_name} EPrint XML (or JSON version) from @@ -94,7 +97,7 @@ input. -quiet : suppress error messages --s, -simplified +-s, -simple : output simplified JSON version of EPrints XML -version @@ -180,8 +183,8 @@ func main() { // App Options flag.BoolVar(&asXML, "xml", false, "output EPrint XML") flag.BoolVar(&asJSON, "json", false, "output JSON version of EPrint XML") - flag.BoolVar(&asSimplified, "s", false, "output simplified JSON version of EPrints XML") - flag.BoolVar(&asSimplified, "simplified", false, "output simplified JSON version of EPrints XML") + flag.BoolVar(&asSimplified, "s", false, "output simple JSON record version of EPrints XML") + flag.BoolVar(&asSimplified, "simple", false, "output simple JSON record version of EPrints XML") // We're ready to process args flag.Parse() diff --git a/codemeta.json b/codemeta.json index 62ecd38..96be373 100644 --- a/codemeta.json +++ b/codemeta.json @@ -6,7 +6,7 @@ "codeRepository": "https://github.com/caltechlibrary/eprinttools", "issueTracker": "https://github.com/caltechlibrary/eprinttools/issues", "license": "https://caltechlibrary.github.io/eprinttools/license.html", - "version": "1.2.4", + "version": "1.2.4b", "author": [ { "@type": "Person", diff --git a/crosswalk.go b/crosswalk.go index 29e1678..9809ae9 100644 --- a/crosswalk.go +++ b/crosswalk.go @@ -75,6 +75,9 @@ func CrosswalkEPrintToRecord(eprint *EPrint, rec *Record) error { if err := simplifyCreators(rec); err != nil { return err } + if err := simplifyContributors(rec); err != nil { + return err + } // FIXME: Map eprint record types to invenio RDM record types we've // decided on. // FIXME: Funders must have a title, could just copy in the funder @@ -306,6 +309,11 @@ func creatorFromItem(item *Item, objType string, objRoleSrc string, objIdType st identifier.Identifier = item.ID person.Identifiers = append(person.Identifiers, identifier) } + //NOTE: for contributors we need to map the type as LOC URI + // to a person's role. + if item.Type != "" { + person.Role = &Role{ ID: item.Type } + } creator := new(Creator) creator.PersonOrOrg = person // FIXME: For Creators we skip adding the role and affiliation for now, diff --git a/doi2eprintxml.1.md b/doi2eprintxml.1.md index fbf21af..4cbf811 100644 --- a/doi2eprintxml.1.md +++ b/doi2eprintxml.1.md @@ -126,6 +126,6 @@ an XML document called "import-articles.xml". doi2eprintxml -i doi-list.txt -o import-articles.xml ~~~ -doi2eprintxml 1.2.3 +doi2eprintxml 1.2.4 diff --git a/ep3apid.1.md b/ep3apid.1.md index 4c2c016..bbbfcbd 100644 --- a/ep3apid.1.md +++ b/ep3apid.1.md @@ -164,6 +164,6 @@ or to load "settings.json" from the current work directory. ~~~ -ep3apid 1.2.3 +ep3apid 1.2.4 diff --git a/ep3datasets.1.md b/ep3datasets.1.md index 6df5022..21e7cc3 100644 --- a/ep3datasets.1.md +++ b/ep3datasets.1.md @@ -59,6 +59,6 @@ in the key list file to th edataset collection. ep3datasets -repo caltechauthors -eprinids keys.txt settings.json ~~~ -ep3datasets 1.2.3 +ep3datasets 1.2.4 diff --git a/ep3genfeeds.1.md b/ep3genfeeds.1.md index 07a57c9..f77624e 100644 --- a/ep3genfeeds.1.md +++ b/ep3genfeeds.1.md @@ -50,6 +50,6 @@ Harvesting repositories for week month of May, 2022. ep3genfeeds harvester-settings.json ~~~ -ep3genfeeds 1.2.3 +ep3genfeeds 1.2.4 diff --git a/ep3harvester.1.md b/ep3harvester.1.md index bbd3aba..6b245c8 100644 --- a/ep3harvester.1.md +++ b/ep3harvester.1.md @@ -103,6 +103,6 @@ for week month of the month of May, 2022. "2022-05-01 00:00:00" "2022-05-31 59:59:59" ~~~ -ep3harvester 1.2.3 +ep3harvester 1.2.4 diff --git a/epfmt.1.md b/epfmt.1.md index 818e9fd..a3da8ee 100644 --- a/epfmt.1.md +++ b/epfmt.1.md @@ -1,7 +1,7 @@ --- title: "epfmt (1) user manual" author: "R. S. Doiel" -pubDate: 2023-01-11 +pubDate: 2023-03-03 --- # NAME @@ -16,7 +16,10 @@ epfmt epfmt is a command line program for pretty printing EPrint XML. It can also convert EPrint XML to and from -JSON. By default it reads from standard input and writes to +EPrint as JSON or as a simplified JSON records for export +to RDM. + +By default it reads from standard input and writes to standard out. epfmt EPrint XML (or JSON version) from @@ -51,7 +54,7 @@ input. -quiet : suppress error messages --s, -simplified +-s, -simple : output simplified JSON version of EPrints XML -version @@ -86,6 +89,6 @@ in the desired format requested. If no format option chosen it will pretty print in the same format as input. -epfmt 1.2.3 +epfmt 1.2.4 diff --git a/eputil.1.md b/eputil.1.md index 1d82c3e..a38a76f 100644 --- a/eputil.1.md +++ b/eputil.1.md @@ -179,7 +179,7 @@ Supported Environment Variables EPrints REST API ~~~ -eputil 1.2.3 +eputil 1.2.4 diff --git a/harvest.go b/harvest.go index bc20af5..ff46097 100644 --- a/harvest.go +++ b/harvest.go @@ -504,12 +504,12 @@ func harvestEPrintRecord(cfg *Config, repoName string, eprintID int) error { // crosswalk here. var src []byte if UseSimpleRecord { - simplified := new(Record) - err = CrosswalkEPrintToRecord(eprint, simplified) + simple := new(Record) + err = CrosswalkEPrintToRecord(eprint, simple) if err != nil { return fmt.Errorf("failed to crosswalk eprint %d, %s", eprintID, err) } - src, _ = jsonEncode(simplified) + src, _ = jsonEncode(simple) } else { src, _ = jsonEncode(eprint) } diff --git a/man/man1/doi2eprintxml.1 b/man/man1/doi2eprintxml.1 index 7374bd0..50cb311 100644 --- a/man/man1/doi2eprintxml.1 +++ b/man/man1/doi2eprintxml.1 @@ -142,6 +142,6 @@ called \[lq]import-articles.xml\[rq]. \f[R] .fi .PP -doi2eprintxml 1.2.3 +doi2eprintxml 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/ep3apid.1 b/man/man1/ep3apid.1 index c807d4c..5e29bac 100644 --- a/man/man1/ep3apid.1 +++ b/man/man1/ep3apid.1 @@ -321,6 +321,6 @@ or to load \[lq]settings.json\[rq] from the current work directory. \f[R] .fi .PP -ep3apid 1.2.3 +ep3apid 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/ep3datasets.1 b/man/man1/ep3datasets.1 index 3ff5a69..89b9ec2 100644 --- a/man/man1/ep3datasets.1 +++ b/man/man1/ep3datasets.1 @@ -74,6 +74,6 @@ the key list file to th edataset collection. \f[R] .fi .PP -ep3datasets 1.2.3 +ep3datasets 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/ep3genfeeds.1 b/man/man1/ep3genfeeds.1 index 07b342d..6916465 100644 --- a/man/man1/ep3genfeeds.1 +++ b/man/man1/ep3genfeeds.1 @@ -60,6 +60,6 @@ Harvesting repositories for week month of May, 2022. \f[R] .fi .PP -ep3genfeeds 1.2.3 +ep3genfeeds 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/ep3harvester.1 b/man/man1/ep3harvester.1 index 75959dd..205bf30 100644 --- a/man/man1/ep3harvester.1 +++ b/man/man1/ep3harvester.1 @@ -120,6 +120,6 @@ month of the month of May, 2022. \f[R] .fi .PP -ep3harvester 1.2.3 +ep3harvester 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/epfmt.1 b/man/man1/epfmt.1 index 4d65aeb..082784a 100644 --- a/man/man1/epfmt.1 +++ b/man/man1/epfmt.1 @@ -25,7 +25,9 @@ epfmt .SH DESCRIPTION .PP epfmt is a command line program for pretty printing EPrint XML. -It can also convert EPrint XML to and from JSON. +It can also convert EPrint XML to and from EPrint as JSON or as a +simplified JSON records for export to RDM. +.PP By default it reads from standard input and writes to standard out. .PP epfmt EPrint XML (or JSON version) from standard input and pretty prints @@ -59,7 +61,7 @@ if true add a trailing newline -quiet suppress error messages .TP --s, -simplified +-s, -simple output simplified JSON version of EPrints XML .TP -version @@ -98,6 +100,6 @@ the output in the desired format requested. If no format option chosen it will pretty print in the same format as input. .PP -epfmt 1.2.3 +epfmt 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/man/man1/eputil.1 b/man/man1/eputil.1 index c9d9132..76a2209 100644 --- a/man/man1/eputil.1 +++ b/man/man1/eputil.1 @@ -210,6 +210,6 @@ Supported Environment Variables \f[R] .fi .PP -eputil 1.2.3 +eputil 1.2.4 .SH AUTHORS R. S. Doiel. diff --git a/version.go b/version.go index 6d463aa..70d1057 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ package eprinttools const ( - Version = "1.2.4" + Version = "1.2.4b" LicenseText = `