diff options
Diffstat (limited to 'skate/map.go')
-rw-r--r-- | skate/map.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/skate/map.go b/skate/map.go index ca98186..ad62328 100644 --- a/skate/map.go +++ b/skate/map.go @@ -415,6 +415,25 @@ func MapperReleaseWork(p []byte) (fields [][]byte, err error) { return [][]byte{[]byte(release.WorkID), p}, nil } +// MapperBrefIdentifierTable generates an id table from biblioref. +func MapperBrefIdentifierTable(p []byte) (field [][]byte, err error) { + var bref struct { + SourceReleaseIdent string `json:"source_release_ident,omitempty"` + TargetReleaseIdent string `json:"target_release_ident,omitempty"` + SourceDOI string `json:"source_doi,omitempty"` + TargetDOI string `json:"target_doi,omitempty"` + } + if err := json.Unmarshal(p, &bref); err != nil { + return nil, err + } + return [][]byte{ + []byte(bref.SourceReleaseIdent), + []byte(bref.TargetReleaseIdent), + []byte(bref.SourceDOI), + []byte(bref.TargetDOI), + }, nil +} + // sandcrawlerSlugify normalizes a string. func sandcrawlerSlugify(s string) string { slug := strings.ToLower(strings.TrimSpace(s)) |