Documentation
¶
Overview ¶
Package crossrefxml provides function to convert Crossref XML metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Fetch(str string) (commonmeta.Data, error)
- func GetContributors(contrib Contributors) ([]commonmeta.Contributor, error)
- func GetFundingReferences(fundref Program) ([]commonmeta.FundingReference, error)
- func Load(filename string) (commonmeta.Data, error)
- func LoadAll(filename string) ([]commonmeta.Data, error)
- func Read(query Query) (commonmeta.Data, error)
- func ReadAll(query []Query) ([]commonmeta.Data, error)
- func Upload(content []byte, account Account) (string, error)
- func Write(data commonmeta.Data, account Account) ([]byte, []gojsonschema.ResultError)
- func WriteAll(list []commonmeta.Data, account Account) ([]byte, []gojsonschema.ResultError)
- type Abstract
- type AcceptanceDate
- type Account
- type Affiliation
- type Affiliations
- type ApprovalDate
- type Archive
- type ArchiveLocations
- type Assertion
- type Body
- type Book
- type BookMetadata
- type BookSetMetadata
- type CRMItem
- type Citation
- type CitationList
- type Collection
- type Component
- type ComponentList
- type Conference
- type ConferencePaper
- type Content
- type ContentItem
- type Contributors
- type CreationDate
- type Crossmark
- type Crossrefxml
- type CustomMetadata
- type DOI
- type DOIBatch
- type DOIData
- type DOIRecord
- type Database
- type DatabaseMetadata
- type Dataset
- type Depositor
- type Dissertation
- type EventMetadata
- type Format
- type Head
- type ISBN
- type ISSN
- type Institution
- type InstitutionID
- type InterWorkRelation
- type IntraWorkRelation
- type Item
- type ItemNumber
- type Journal
- type JournalArticle
- type JournalIssue
- type JournalMetadata
- type JournalVolume
- type LicenseRef
- type Organization
- type OriginalLanguageTitle
- type P
- type Pages
- type PeerReview
- type PersonName
- type PostedContent
- type PostedDate
- type ProceedingsMetadata
- type Program
- type PublicationDate
- type Publisher
- type PublisherItem
- type Query
- type RelatedItem
- type Resource
- type ReviewDate
- type SAComponent
- type SetMetadata
- type Standard
- type StringMap
- type Titles
Constants ¶
This section is empty.
Variables ¶
var CMToCRMappings = map[string]string{
"Article": "PostedContent",
"BookChapter": "BookChapter",
"BookSeries": "BookSeries",
"Book": "Book",
"Component": "Component",
"Dataset": "Dataset",
"Dissertation": "Dissertation",
"Grant": "Grant",
"JournalArticle": "JournalArticle",
"JournalIssue": "JournalIssue",
"JournalVolume": "JournalVolume",
"Journal": "Journal",
"ProceedingsArticle": "ProceedingsArticle",
"ProceedingsSeries": "ProceedingsSeries",
"Proceedings": "Proceedings",
"ReportComponent": "ReportComponent",
"ReportSeries": "ReportSeries",
"Report": "Report",
"Review": "PeerReview",
"Other": "Other",
}
CMToCRMappings maps Commonmeta types to Crossref types source: http://api.crossref.org/types
var CRToCMMappings = map[string]string{
"journal_title": "Journal",
"journal_issue": "JournalIssue",
"journal_volume": "JournalVolume",
"journal_article": "JournalArticle",
"conference_title": "Proceedings",
"conference_series": "ProceedingsSeries",
"conference_paper": "ProceedingsArticle",
"book_title": "Book",
"book_series": "BookSeries",
"book_content": "BookChapter",
"component": "Component",
"dissertation": "Dissertation",
"peer_review": "PeerReview",
"posted_content": "Article",
"report-paper_title": "Report",
"report-paper_series": "ReportSeries",
"standard_title": "Standard",
"standard_series": "StandardSeries",
}
CRToCMMappings maps Crossref Query types to Commonmeta types source: https://www.crossref.org/schemas/crossref_query_output3.0.xsd Crossref Query naming conventions are different from the REST API
var InterWorkRelationTypes = []string{
"IsPartOf",
"HasPart",
"IsReviewOf",
"HasReview",
"IsRelatedMaterial",
"HasRelatedMaterial",
}
var IntraWorkRelationTypes = []string{
"IsIdenticalTo",
"IsPreprintOf",
"HasPreprint",
"IsTranslationOf",
"HasTranslation",
"IsVersionOf",
"HasVersion",
}
var OFRToRORMappings = map[string]string{
"https://doi.org/10.13039/100000001": "https://ror.org/021nxhr62",
"https://doi.org/10.13039/501100000780": "https://ror.org/00k4n6c32",
"https://doi.org/10.13039/501100007601": "https://ror.org/00k4n6c32",
"https://doi.org/10.13039/501100001659": "https://ror.org/018mejw64",
"https://doi.org/10.13039/501100006390": "https://ror.org/019whta54",
"https://doi.org/10.13039/501100001711": "https://ror.org/00yjd3n13",
"https://doi.org/10.13039/501100003043": "https://ror.org/04wfr2810",
}
var RORToOFRMappings = map[string]string{
"https://ror.org/021nxhr62": "https://doi.org/10.13039/100000001",
"https://ror.org/00k4n6c32": "https://doi.org/10.13039/501100000780",
"https://ror.org/018mejw64": "https://doi.org/10.13039/501100001659",
"https://ror.org/019whta54": "https://doi.org/10.13039/501100006390",
"https://ror.org/00yjd3n13": "https://doi.org/10.13039/501100001711",
"https://ror.org/04wfr2810": "https://doi.org/10.13039/501100003043",
}
Functions ¶
func Fetch ¶ added in v0.2.8
func Fetch(str string) (commonmeta.Data, error)
Fetch gets the metadata for a single work from the Crossref API and converts it to the Commonmeta format
func GetContributors ¶ added in v0.2.8
func GetContributors(contrib Contributors) ([]commonmeta.Contributor, error)
func GetFundingReferences ¶ added in v0.2.8
func GetFundingReferences(fundref Program) ([]commonmeta.FundingReference, error)
func Load ¶ added in v0.2.8
func Load(filename string) (commonmeta.Data, error)
Load loads the metadata for a single work from a XML file
func LoadAll ¶ added in v0.2.14
func LoadAll(filename string) ([]commonmeta.Data, error)
LoadAll loads the metadata for a list of works from an XML file and converts it to the Commonmeta format
func Read ¶ added in v0.2.1
func Read(query Query) (commonmeta.Data, error)
Read Crossref XML response and return work struct in Commonmeta format
func ReadAll ¶ added in v0.2.13
func ReadAll(query []Query) ([]commonmeta.Data, error)
ReadAll reads a list of Crossref XML responses and returns a list of works in Commonmeta format
func Write ¶ added in v0.2.14
func Write(data commonmeta.Data, account Account) ([]byte, []gojsonschema.ResultError)
Write writes Crossrefxml metadata.
func WriteAll ¶ added in v0.2.15
func WriteAll(list []commonmeta.Data, account Account) ([]byte, []gojsonschema.ResultError)
WriteAll writes a list of commonmeta metadata.
Types ¶
type AcceptanceDate ¶ added in v0.2.8
type Affiliation ¶ added in v0.2.8
Affiliation represents an affiliation in Crossref XML metadata.
type Affiliations ¶ added in v0.2.14
type Affiliations struct {
XMLName xml.Name `xml:"affiliations"`
Institution []Institution `xml:"institution,omitempty"`
}
type ApprovalDate ¶ added in v0.2.8
type ArchiveLocations ¶ added in v0.2.8
type Assertion ¶ added in v0.2.8
type Assertion struct {
XMLName xml.Name `xml:"assertion"`
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Provider string `xml:"provider,attr,omitempty"`
Label string `xml:"label,attr,omitempty"`
GroupName string `xml:"group_name,attr,omitempty"`
GroupLabel string `xml:"group_label,attr,omitempty"`
Order string `xml:"order,attr,omitempty"`
Assertion []Assertion `xml:"assertion"`
}
type Body ¶ added in v0.3.13
type Body struct {
XMLName xml.Name `xml:"body"`
Book []Book `xml:"book,omitempty"`
Conference []Conference `xml:"conference,omitempty"`
Database []Database `xml:"database,omitempty"`
Dissertation []Dissertation `xml:"dissertation,omitempty"`
Journal []Journal `xml:"journal,omitempty"`
PeerReview []PeerReview `xml:"peer_review,omitempty"`
PostedContent []PostedContent `xml:"posted_content,omitempty"`
SAComponent []SAComponent `xml:"sa_component,omitempty"`
Standard []Standard `xml:"standard,omitempty"`
}
type Book ¶ added in v0.2.8
type Book struct {
XMLName xml.Name `xml:"book"`
BookType string `xml:"book_type,attr"`
BookMetadata BookMetadata `xml:"book_metadata"`
BookSetMetadata BookSetMetadata `xml:"book_set_metadata"`
ContentItem ContentItem `xml:"content_item"`
}
type BookMetadata ¶ added in v0.2.8
type BookMetadata struct {
XMLName xml.Name `xml:"book_metadata"`
Language string `xml:"language,attr"`
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
Abstract []Abstract `xml:"abstract"`
EditionNumber int `xml:"edition_number"`
PublicationDate []PublicationDate `xml:"publication_date"`
ISBN []ISBN `xml:"isbn"`
Publisher Publisher `xml:"publisher"`
DOIData DOIData `xml:"doi_data"`
}
type BookSetMetadata ¶ added in v0.2.13
type BookSetMetadata struct {
XMLName xml.Name `xml:"book_set_metadata"`
Language string `xml:"language,attr"`
SetMetadata SetMetadata `xml:"set_metadata"`
Volume string `xml:"volume"`
EditionNumber string `xml:"edition_number"`
PublicationDate []PublicationDate `xml:"publication_date"`
ISBN []ISBN `xml:"isbn"`
Publisher Publisher `xml:"publisher"`
}
type Citation ¶ added in v0.2.8
type Citation struct {
XMLName xml.Name `xml:"citation"`
Key string `xml:"key,attr"`
JournalTitle string `xml:"journal_title,omitempty"`
Author string `xml:"author,omitempty"`
Volume string `xml:"volume,omitempty"`
FirstPage string `xml:"first_page,omitempty"`
CYear string `xml:"cYear,omitempty"`
ArticleTitle string `xml:"article_title,omitempty"`
DOI *DOI `xml:"doi,omitempty"`
UnstructedCitation string `xml:"unstructured_citation,omitempty"`
}
type CitationList ¶ added in v0.2.8
type Collection ¶ added in v0.2.8
type ComponentList ¶ added in v0.2.8
type Conference ¶ added in v0.2.8
type Conference struct {
XMLName xml.Name `xml:"conference"`
Contributors Contributors `xml:"contributors"`
EventMetadata EventMetadata `xml:"event_metadata"`
ProceedingsMetadata ProceedingsMetadata `xml:"proceedings_metadata"`
ConferencePaper ConferencePaper `xml:"conference_paper"`
}
type ConferencePaper ¶ added in v0.2.8
type ConferencePaper struct {
XMLName xml.Name `xml:"conference_paper"`
PublicationType string `xml:"publication_type,attr"`
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
PublicationDate []PublicationDate `xml:"publication_date"`
Pages Pages `xml:"pages"`
PublisherItem PublisherItem `xml:"publisher_item"`
Crossmark Crossmark `xml:"crossmark"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list,omitempty"`
}
type Content ¶
type Content struct {
XMLName xml.Name `xml:"crossref"`
Xmlns string `xml:"xmlns,attr,omitempty"`
Book *Book `xml:"book,omitempty"`
Conference *Conference `xml:"conference,omitempty"`
Database *Database `xml:"database,omitempty"`
Dissertation *Dissertation `xml:"dissertation,omitempty"`
Journal *Journal `xml:"journal,omitempty"`
PeerReview *PeerReview `xml:"peer_review,omitempty"`
PostedContent *PostedContent `xml:"posted_content,omitempty"`
SAComponent *SAComponent `xml:"sa_component,omitempty"`
Standard *Standard `xml:"standard,omitempty"`
}
Content represents the Crossref XML metadata returned from Crossref. The type uses a struct instead of the slice for the Crossref metadata.
type ContentItem ¶ added in v0.2.8
type ContentItem struct {
XMLName xml.Name `xml:"content_item"`
ComponentType string `xml:"component_type,attr"`
LevelSequenceNumber string `xml:"level_sequence_number,attr"`
PublicationType string `xml:"publication_type,attr"`
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
PublicationDate []PublicationDate `xml:"publication_date"`
Pages struct {
FirstPage string `xml:"first_page"`
LastPage string `xml:"last_page"`
} `xml:"pages"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list,omitempty"`
}
type Contributors ¶ added in v0.2.8
type Contributors struct {
XMLName xml.Name `xml:"contributors"`
Organization []Organization `xml:"organization,omitempty"`
PersonName []PersonName `xml:"person_name,omitempty"`
}
type CreationDate ¶ added in v0.2.8
type Crossmark ¶ added in v0.2.8
type Crossmark struct {
XMLName xml.Name `xml:"crossmark"`
Text string `xml:",chardata"`
CrossmarkVersion string `xml:"crossmark_version"`
CrossmarkPolicy string `xml:"crossmark_policy"`
CrossmarkDomains struct {
Text string `xml:",chardata"`
CrossmarkDomain struct {
Text string `xml:",chardata"`
Domain string `xml:"domain"`
} `xml:"crossmark_domain"`
} `xml:"crossmark_domains"`
CrossmarkDomainExclusive string `xml:"crossmark_domain_exclusive"`
CustomMetadata CustomMetadata `xml:"custom_metadata"`
}
type Crossrefxml ¶ added in v0.2.8
Crossrefxml represents the Crossref XML metadata.
type CustomMetadata ¶ added in v0.2.8
type Database ¶ added in v0.2.8
type Database struct {
DatabaseMetadata DatabaseMetadata `xml:"database_metadata"`
Dataset Dataset `xml:"dataset"`
}
type DatabaseMetadata ¶ added in v0.2.8
type DatabaseMetadata struct {
Titles struct {
Title string `xml:"title"`
} `xml:"titles"`
}
type Dataset ¶ added in v0.2.8
type Dataset struct {
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
DatabaseDate struct {
CreationDate CreationDate `xml:"creation_date"`
} `xml:"database_date"`
DOIData DOIData `xml:"doi_data"`
}
type Dissertation ¶ added in v0.2.8
type Dissertation struct {
XMLName xml.Name `xml:"dissertation"`
Language string `xml:"language"`
PublicationType string `xml:"publication_type"`
PersonName []PersonName `xml:"person_name"`
Titles Titles `xml:"titles"`
ApprovalDate ApprovalDate `xml:"approval_date"`
Institution Institution `xml:"institution"`
Degree string `xml:"degree"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list,omitempty"`
}
type EventMetadata ¶ added in v0.2.8
type EventMetadata struct {
XMLName xml.Name `xml:"event_metadata"`
ConferenceName string `xml:"conference_name"`
ConferenceAcronym string `xml:"conference_acronym"`
ConferenceSponsor string `xml:"conference_sponsor"`
ConferenceLocation string `xml:"conference_location"`
ConferenceDate string `xml:"conference_date"`
}
type ISBN ¶ added in v0.2.8
type ISBN struct {
XMLName xml.Name `xml:"isbn"`
MediaType string `xml:"media_type,attr"`
Text string `xml:",chardata"`
}
ISBN represents a ISSN in Crossref XML metadata.
type ISSN ¶ added in v0.2.8
type ISSN struct {
XMLName xml.Name `xml:"issn"`
MediaType string `xml:"media_type,attr"`
Text string `xml:",chardata"`
}
ISSN represents a ISSN in Crossref XML metadata.
type Institution ¶ added in v0.2.8
type Institution struct {
XMLName xml.Name `xml:"institution"`
InstitutionName string `xml:"institution_name,omitempty"`
InstitutionPlace string `xml:"institution_place,omitempty"`
InstitutionID *InstitutionID `xml:"institution_id,omitempty"`
}
type InstitutionID ¶ added in v0.2.14
type InterWorkRelation ¶ added in v0.2.14
type IntraWorkRelation ¶ added in v0.2.14
type ItemNumber ¶ added in v0.2.8
type ItemNumber struct {
XMLName xml.Name `xml:"item_number"`
ItemNumberType string `xml:"item_number_type,attr"`
Text string `xml:",chardata"`
}
ItemNumber represents an item number in Crossref XML metadata.
type Journal ¶ added in v0.2.8
type Journal struct {
XMLName xml.Name `xml:"journal"`
JournalMetadata JournalMetadata `xml:"journal_metadata,omitempty"`
JournalIssue JournalIssue `xml:"journal_issue,omitempty"`
JournalArticle JournalArticle `xml:"journal_article,omitempty"`
}
Journal represents a journal in Crossref XML metadata.
type JournalArticle ¶ added in v0.2.8
type JournalArticle struct {
XMLName xml.Name `xml:"journal_article"`
Text string `xml:",chardata"`
PublicationType string `xml:"publication_type,attr,omitempty"`
ReferenceDistributionOpts string `xml:"reference_distribution_opts,attr,omitempty"`
Titles Titles `xml:"titles,omitempty"`
Contributors Contributors `xml:"contributors,omitempty"`
PublicationDate []PublicationDate `xml:"publication_date"`
PublisherItem *PublisherItem `xml:"publisher_item,omitempty"`
Abstract []Abstract `xml:"jats:abstract"`
Pages *Pages `xml:"pages,omitempty"`
ISSN []ISSN `xml:"issn"`
Program []Program `xml:"program"`
Crossmark *Crossmark `xml:"crossmark,omitempty"`
ArchiveLocations ArchiveLocations `xml:"archive_locations"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list,omitempty"`
}
JournalArticle represents a journal article in Crossref XML metadata.
type JournalIssue ¶ added in v0.2.8
type JournalIssue struct {
XMLName xml.Name `xml:"journal_issue"`
PublicationDate []PublicationDate `xml:"publication_date"`
JournalVolume JournalVolume `xml:"journal_volume,omitempty"`
Issue string `xml:"issue,omitempty"`
DOIData *DOIData `xml:"doi_data,omitempty"`
}
type JournalMetadata ¶ added in v0.2.8
type JournalMetadata struct {
XMLName xml.Name `xml:"journal_metadata"`
Language string `xml:"language,attr,omitempty"`
FullTitle string `xml:"full_title,omitempty"`
ISSN []ISSN `xml:"issn,omitempty"`
DOIData *DOIData `xml:"doi_data,omitempty"`
}
JournalMetadata represents journal metadata in Crossref XML metadata.
type JournalVolume ¶ added in v0.2.8
type LicenseRef ¶ added in v0.2.8
type Organization ¶ added in v0.3.20
type Organization struct {
XMLName xml.Name `xml:"organization"`
ContributorRole string `xml:"contributor_role,attr"`
Sequence string `xml:"sequence,attr"`
Text string `xml:",chardata"`
}
OrganizationName represents an organization in Crossref XML metadata.
type OriginalLanguageTitle ¶ added in v0.2.14
type PeerReview ¶ added in v0.2.8
type PeerReview struct {
XMLName xml.Name `xml:"peer_review"`
Stage string `xml:"stage,attr"`
RevisionRound string `xml:"revision-round,attr"`
Recommendation string `xml:"recommendation,attr"`
Type string `xml:"type,attr"`
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
ReviewDate ReviewDate `xml:"review_date"`
CompetingInterestStatement string `xml:"competing_interest_statement"`
Program []Program `xml:"program"`
DOIData DOIData `xml:"doi_data"`
}
type PersonName ¶ added in v0.2.8
type PersonName struct {
XMLName xml.Name `xml:"person_name"`
ContributorRole string `xml:"contributor_role,attr"`
Sequence string `xml:"sequence,attr"`
Text string `xml:",chardata"`
GivenName string `xml:"given_name"`
Surname string `xml:"surname"`
Affiliations *Affiliations `xml:"affiliations,omitempty"`
Affiliation string `xml:"affiliation,omitempty"`
ORCID string `xml:"ORCID,omitempty"`
}
PersonName represents a person in Crossref XML metadata.
type PostedContent ¶ added in v0.2.8
type PostedContent struct {
XMLName xml.Name `xml:"posted_content"`
Type string `xml:"type,attr"`
Language string `xml:"language,attr,omitempty"`
GroupTitle string `xml:"group_title,omitempty"`
Contributors Contributors `xml:"contributors,omitempty"`
Titles Titles `xml:"titles,omitempty"`
PostedDate PostedDate `xml:"posted_date,omitempty"`
AcceptanceDate *AcceptanceDate `xml:"acceptance_date,omitempty"`
Institution *Institution `xml:"institution,omitempty"`
ItemNumber ItemNumber `xml:"item_number,omitempty"`
Abstract []Abstract `xml:"abstract"`
Program []Program `xml:"program"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list,omitempty"`
}
PostedContent represents posted content in Crossref XML metadata.
type PostedDate ¶ added in v0.2.8
type ProceedingsMetadata ¶ added in v0.2.8
type ProceedingsMetadata struct {
XMLName xml.Name `xml:"proceedings_metadata"`
Language string `xml:"language,attr"`
ProceedingsTitle string `xml:"proceedings_title"`
Publisher Publisher `xml:"publisher"`
PublicationDate []PublicationDate `xml:"publication_date"`
ISBN []ISBN `xml:"isbn"`
PublisherItem PublisherItem `xml:"publisher_item"`
DOIData DOIData `xml:"doi_data"`
}
type Program ¶ added in v0.2.8
type Program struct {
XMLName xml.Name `xml:"program"`
Xmlns string `xml:"xmlns,attr"`
Fr string `xml:"fr,attr,omitempty"`
Name string `xml:"name,attr,omitempty"`
Ai string `xml:"ai,attr,omitempty"`
Rel string `xml:"rel,attr,omitempty"`
Text string `xml:",chardata"`
Assertion []Assertion `xml:"assertion"`
LicenseRef []LicenseRef `xml:"license_ref"`
RelatedItem []RelatedItem `xml:"related_item"`
}
type PublicationDate ¶ added in v0.2.8
type PublisherItem ¶ added in v0.2.8
type Query ¶ added in v0.2.12
type Query struct {
Status string `xml:"status,attr"`
DOI DOI `xml:"doi"`
CRMItem []CRMItem `xml:"crm-item"`
DOIRecord DOIRecord `xml:"doi_record"`
}
type RelatedItem ¶ added in v0.2.8
type RelatedItem struct {
XMLName xml.Name `xml:"related_item"`
Text string `xml:",chardata"`
Description string `xml:"description,omitempty"`
InterWorkRelation *InterWorkRelation `xml:"inter_work_relation,omitempty"`
IntraWorkRelation *IntraWorkRelation `xml:"intra_work_relation,omitempty"`
}
type Resource ¶ added in v0.2.8
type Resource struct {
XMLName xml.Name `xml:"resource"`
Text string `xml:",chardata"`
MimeType string `xml:"mime_type,attr"`
}
Resource represents a resource in Crossref XML metadata.
type ReviewDate ¶ added in v0.2.8
type SAComponent ¶ added in v0.2.8
type SAComponent struct {
XMLName xml.Name `xml:"sa_component"`
ComponentList ComponentList `xml:"component_list"`
}
type SetMetadata ¶ added in v0.2.13
type Titles ¶ added in v0.2.8
type Titles struct {
XMLName xml.Name `xml:"titles"`
Title string `xml:"title,omitempty"`
Subtitle string `xml:"subtitle,omitempty"`
OriginalLanguageTitle *OriginalLanguageTitle `xml:"original_language_title,omitempty"`
}
Titles represents the titles in Crossref XML metadata.