Commit 1117a290 authored by Andreas Wagner's avatar Andreas Wagner
Browse files

Enable all metadata fields (hopefully).

parent 1837b2b9
......@@ -85,8 +85,7 @@ func SetupRoutes(conf tei2zenodo.Config) *gin.Engine {
} else {
log.Printf("=== Retrieve deposit for %s and create a new version ===", doi)
myDeposit.OldDOI = doi
// TODO: Fix Metadata and re-enable RelatedIdentifiers and other fields!
// md.RelatedIdentifiers = append(md.RelatedIdentifiers, tei2zenodo.ZIdentifier{Relation: "isNewVersionOf", Identifier: doi})
md.RelatedIdentifiers = append(md.RelatedIdentifiers, tei2zenodo.ZIdentifier{Relation: "isNewVersionOf", Identifier: doi})
newDOI, err := zenodo.UpdateDeposit(&myDeposit, &md, &conf.Repo)
if err != nil {
log.Printf("Error retrieving zenodo deposit for doi %s: %v", doi, err)
......
......@@ -6,6 +6,7 @@ import (
"log"
"reflect"
"regexp"
"strings"
"github.com/antchfx/xmlquery"
"github.com/antchfx/xpath"
......@@ -62,7 +63,13 @@ func ParseTEI(r io.Reader, md *tei2zenodo.ZMetadata, conf *tei2zenodo.MetadataCo
f := s.Field(i)
structFieldname := typeOfT.Field(i).Name
structFieldtype := f.Type()
jsonFieldname := typeOfT.Field(i).Tag.Get("json")
jsonTag := typeOfT.Field(i).Tag.Get("json")
var jsonFieldname string
if idx := strings.IndexByte(jsonTag, ','); idx >= 0 {
jsonFieldname = jsonTag[:strings.IndexByte(jsonTag, ',')]
} else {
jsonFieldname = jsonTag
}
for j := range conf.Fields {
if conf.Fields[j].Field == jsonFieldname {
// log.Printf("Found config for %s.", jsonFieldname)
......
......@@ -458,6 +458,7 @@ func PutMetadata(d *tei2zenodo.Deposit, md *tei2zenodo.ZMetadata, conf *tei2zeno
log.Printf("Problem converting metadata to JSON format: %v ...", err)
return fmt.Errorf("problem converting metadata to JSON format: %s", err)
}
log.Printf("JSON: %s", mdJSON)
// Compile PUT request
b := bytes.NewBuffer(mdJSON)
......
......@@ -110,41 +110,41 @@ type ZMetadata struct {
License string `json:"license,omitempty"` // mandatory if access_right=(open|embargoed)
// values: See Open Definition Licenses Service.
// Defaults to cc-by for non-datasets and cc-zero for datasets
EmbargoDate string `json:"embargo_date,omitempty"` // mandatory if access_right=embargoed, in ISO8601 format (YYYY-MM-DD)
AccessConditions string `json:"access_conditions,omitempty"` // mandatory if access_right=restricted, can contain html
// Contributors []ZContributor `json:"contributors"` // optional
DOI string `json:"doi"` // optional
EmbargoDate string `json:"embargo_date,omitempty"` // mandatory if access_right=embargoed, in ISO8601 format (YYYY-MM-DD)
AccessConditions string `json:"access_conditions,omitempty"` // mandatory if access_right=restricted, can contain html
Contributors []ZContributor `json:"contributors,omitempty"` // optional
DOI string `json:"doi"` // optional
Keywords []string `json:"keywords,omitempty"` // optional, free form
Notes string `json:"notes,omitempty"` // optional, can contain html
RelatedIdentifiers []ZIdentifier `json:"related_identifiers,omitempty"` // optional
References []string `json:"references,omitempty"` // optional
Communities []ZCommunity `json:"communities,omitempty"` // optional
Grants []ZGrant `json:"grants,omitempty"` // optional
JournalTitle string `json:"journal_title,omitempty"` // optional
JournalVolume string `json:"journal_volume,omitempty"` // optional
JournalIssue string `json:"journal_issue,omitempty"` // optional
JournalPages string `json:"journal_pages,omitempty"` // optional
ConferenceTitle string `json:"conference_title,omitempty"` // optional
ConferenceAcronym string `json:"conference_acronym,omitempty"` // optional
ConferenceDates string `json:"conference_dates,omitempty"` // optional
ConferencePlace string `json:"conference_place,omitempty"` // optional
ConferenceURL string `json:"conference_url,omitempty"` // optional
ConferenceSession string `json:"conference_session,omitempty"` // optional
ConferenceSessionPart string `json:"conference_session_part,omitempty"` // optional
ImprintPublisher string `json:"imprint_publisher,omitempty"` // optional
ImprintISBN string `json:"imprint_isbn,omitempty"` // optional
ImprintPlace string `json:"imprint_place,omitempty"` // optional
PartofTitle string `json:"partof_title,omitempty"` // optional
PartofPages string `json:"partof_pages,omitempty"` // optional
ThesisSupervisors []ZCreator `json:"thesis_supervisors,omitempty"` // optional
ThesisUniversity string `json:"thesis_university,omitempty"` // optional
Subjects []ZSubject `json:"subjects,omitempty"` // optional
Version string `json:"version,omitempty"` // optional
Language string `json:"language,omitempty"` // optional, ISO 639-2 or 639-3 code
Locations []ZLocation `json:"locations,omitempty"` // optional
Dates []ZDate `json:"dates,omitempty"` // optional
Method string `json:"method,omitempty"` // optional, can contain html
//PrereserveDOI *ZPrereserveMetadata `json:"prereserve_doi,omitempty"` // optional, use this to reserve and get a doi to include in your upload
//Keywords []string `json:"keywords,omitempty"` // optional, free form
Notes string `json:"notes,omitempty"` // optional, can contain html
//RelatedIdentifiers []ZIdentifier `json:"related_identifiers"` // optional
//References []string `json:"references,omitempty"` // optional
// Communities []ZCommunity `json:"communities"` // optional
// Grants []ZGrant `json:"grants"` // optional
JournalTitle string `json:"journal_title,omitempty"` // optional
JournalVolume string `json:"journal_volume,omitempty"` // optional
JournalIssue string `json:"journal_issue,omitempty"` // optional
JournalPages string `json:"journal_pages,omitempty"` // optional
ConferenceTitle string `json:"conference_title,omitempty"` // optional
ConferenceAcronym string `json:"conference_acronym,omitempty"` // optional
ConferenceDates string `json:"conference_dates,omitempty"` // optional
ConferencePlace string `json:"conference_place,omitempty"` // optional
ConferenceURL string `json:"conference_url,omitempty"` // optional
ConferenceSession string `json:"conference_session,omitempty"` // optional
ConferenceSessionPart string `json:"conference_session_part,omitempty"` // optional
ImprintPublisher string `json:"imprint_publisher,omitempty"` // optional
ImprintISBN string `json:"imprint_isbn,omitempty"` // optional
ImprintPlace string `json:"imprint_place,omitempty"` // optional
PartofTitle string `json:"partof_title,omitempty"` // optional
PartofPages string `json:"partof_pages,omitempty"` // optional
// ThesisSupervisors []ZCreator `json:"thesis_supervisors"` // optional
ThesisUniversity string `json:"thesis_university,omitempty"` // optional
// Subjects []ZSubject `json:"subjects"` // optional
Version string `json:"version,omitempty"` // optional
Language string `json:"language,omitempty"` // optional, ISO 639-2 or 639-3 code
// Locations []ZLocation `json:"locations"` // optional
// Dates []ZDate `json:"dates"` // optional
Method string `json:"method,omitempty"` // optional, can contain html
}
// ZPrereserveMetadata stores DOI prereservation metadata
......
......@@ -46,7 +46,7 @@
</xi:fallback>
</xi:include>
<availability>
<license target="http://creativecommons.org/cc-by/4.0">CC-BY</license>
<licence target="http://creativecommons.org/cc-by/4.0" n="cc-by">CC-BY</licence>
</availability>
<date type="digitizedEd" when="2018-07-10">2018-07-10</date>
<idno>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment