Documentation
¶
Overview ¶
Package crossref provides function to convert Crossref metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Fetch(str string, match bool) (commonmeta.Data, error)
- func FetchAll(number int, page int, member string, type_ string, sample bool, year string, ...) ([]commonmeta.Data, error)
- func GetMember(memberId string) (string, bool)
- func Load(filename string, match bool) (commonmeta.Data, error)
- func LoadAll(filename string, match bool) ([]commonmeta.Data, error)
- func QueryURL(number int, page int, member string, type_ string, sample bool, year string, ...) string
- func Read(content Content, match bool) (commonmeta.Data, error)
- func ReadAll(content []Content, match bool) ([]commonmeta.Data, error)
- type Content
- type Reader
Constants ¶
This section is empty.
Variables ¶
var CRCitationToCMMappings = map[string]string{
"blog-post": "BlogPost",
"book": "Book",
"book-chapter": "BookChapter",
"dataset": "Dataset",
"dissertation": "Dissertation",
"journal": "Journal",
"journal-article": "JournalArticle",
"patent": "Patent",
"peer-review": "PeerReview",
"preprint": "Preprint",
"conference-proceedings": "Proceedings",
"conference-paper": "ProceedingsArticle",
"protocol": "Protocol",
"report": "Report",
"software": "Software",
"standard": "Standard",
"web-resource": "Webpage",
"other": "Other",
}
CRCitationToCMMappings maps Crossref citation types to Commonmeta types
var CRToCMContainerTranslations = map[string]string{
"book": "Book",
"book-series": "BookSeries",
"database": "DataRepository",
"journal": "Journal",
"proceedings": "Proceedings",
"periodical": "Periodical",
}
CRToCMContainerTranslations maps Crossref container types to Commonmeta container types
var CRToCMMappings = map[string]string{
"book-chapter": "BookChapter",
"book-part": "BookPart",
"book-section": "BookSection",
"book-series": "BookSeries",
"book-set": "BookSet",
"book-track": "BookTrack",
"book": "Book",
"component": "Component",
"database": "Database",
"dataset": "Dataset",
"dissertation": "Dissertation",
"edited-book": "Book",
"grant": "Grant",
"journal-article": "JournalArticle",
"journal-issue": "JournalIssue",
"journal-volume": "JournalVolume",
"journal": "Journal",
"monograph": "Book",
"other": "Other",
"peer-review": "PeerReview",
"posted-content": "Article",
"proceedings-article": "ProceedingsArticle",
"proceedings-series": "ProceedingsSeries",
"proceedings": "Proceedings",
"reference-book": "Book",
"reference-entry": "Entry",
"report-component": "ReportComponent",
"report-series": "ReportSeries",
"report": "Report",
"standard": "Standard",
}
CRToCMMappings maps Crossref types to Commonmeta types source: http://api.crossref.org/types
var CrossrefContainerTypes = map[string]string{
"book-chapter": "book",
"dataset": "database",
"journal-article": "journal",
"journal-issue": "journal",
"monograph": "book-series",
"proceedings-article": "proceedings",
"posted-content": "periodical",
}
CrossrefContainerTypes maps Crossref types to Crossref container types
Functions ¶
func Fetch ¶ added in v0.2.1
func Fetch(str string, match bool) (commonmeta.Data, error)
Fetch gets the metadata for a single work from the Crossref API and converts it to the Commonmeta format
func FetchAll ¶ added in v0.2.14
func FetchAll(number int, page int, member string, type_ string, sample bool, year string, ror string, orcid string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool, match bool) ([]commonmeta.Data, error)
FetchAll gets the metadata for a list of works from the Crossref API and converts it to the Commonmeta format
func Load ¶ added in v0.2.1
func Load(filename string, match bool) (commonmeta.Data, error)
Load loads the metadata for a single work from a JSON file
func LoadAll ¶ added in v0.2.14
func LoadAll(filename string, match bool) ([]commonmeta.Data, error)
LoadAll loads the metadata for a list of works from a JSON file and converts it to the Commonmeta format
func QueryURL ¶ added in v0.2.1
func QueryURL(number int, page int, member string, type_ string, sample bool, year string, orcid string, ror string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool) string
QueryURL returns the URL for the Crossref API query
Types ¶
type Content ¶
type Content struct {
ID string `json:"id"`
Type string `json:"type"`
Abstract string `json:"abstract"`
Archive []string `json:"archive"`
Author []struct {
Given string `json:"given"`
Family string `json:"family"`
Name string `json:"name"`
ORCID string `json:"ORCID"`
Sequence string `json:"sequence"`
Affiliation []struct {
ID []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
AssertedBy string `json:"asserted-by"`
} `json:"id"`
Name string `json:"name"`
} `json:"affiliation"`
} `json:"author"`
Member string `json:"member"`
ContainerTitle []string `json:"container-title"`
DOI string `json:"doi"`
Files []struct{} `json:"files"`
Funder []struct {
DOI string `json:"DOI"`
Name string `json:"name"`
Award []string `json:"award"`
} `json:"funder"`
GroupTitle string `json:"group-title"`
Issue string `json:"issue"`
Published struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"published"`
Issued struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"issued"`
Created struct {
DateAsParts []dateutils.DateSlice `json:"date-parts"`
DateTime string `json:"date-time"`
} `json:"created"`
Institution []struct {
Name string `json:"name"`
} `json:"institution"`
ISSNType []struct {
Value string `json:"value"`
Type string `json:"type"`
} `json:"issn-type"`
ISBNType []struct {
Value string `json:"value"`
Type string `json:"type"`
} `json:"isbn-type"`
Language string `json:"language"`
License []struct {
URL string `json:"URL"`
ContentVersion string `json:"content-version"`
} `json:"license"`
Link []struct {
ContentType string `json:"content-type"`
URL string `json:"url"`
} `json:"link"`
OriginalTitle []string `json:"original-title"`
Page string `json:"page"`
PublishedAt string `json:"published_at"`
Publisher string `json:"publisher"`
Reference []struct {
Key string `json:"key"`
Type string `json:"type"`
DOI string `json:"DOI"`
ArticleTitle string `json:"article-title"`
Year string `json:"year"`
Unstructured string `json:"unstructured"`
AssertedBy string `json:"doi-asserted-by"`
} `json:"reference"`
Relation struct {
IsNewVersionOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-new-version-of"`
IsPreviousVersionOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-previous-version-of"`
IsVersionOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-version-of"`
HasVersion []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"has-version"`
IsPartOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-part-of"`
HasPart []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"has-part"`
IsVariantFormOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-variant-form-of"`
IsOriginalFormOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-original-form-of"`
IsIdenticalTo []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-identical-to"`
IsTranslationOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-translation-of"`
IsReviewOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"reviews"`
HasReview []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"has-review"`
IsPreprintOf []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-preprint-of"`
HasPreprint []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"has-preprint"`
IsSupplementTo []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-supplement-to"`
IsSupplementedBy []struct {
ID string `json:"id"`
IDType string `json:"id-type"`
} `json:"is-supplemented-by"`
} `json:"relation"`
Resource struct {
Primary struct {
ContentType string `json:"content_type"`
URL string `json:"url"`
} `json:"primary"`
} `json:"resource"`
Subject []string `json:"subject"`
Subtitle []string `json:"subtitle,omitempty"`
Title []string `json:"title"`
URL string `json:"url"`
Version string `json:"version,omitempty"`
Volume string `json:"volume,omitempty"`
}
Content is the struct for the message in the JSON response from the Crossref API
func GetAll ¶ added in v0.2.14
func GetAll(number int, page int, member string, type_ string, sample bool, year string, ror string, orcid string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool) ([]Content, error)
GetAll gets the metadata for a list of works from the Crossref API