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 LoadList(filename string) ([]commonmeta.Data, error)
- func Read(content Content) (commonmeta.Data, error)
- func ReadList(content []Content) ([]commonmeta.Data, error)
- type Abstract
- type AcceptanceDate
- type Affiliation
- type ApprovalDate
- type Archive
- type ArchiveLocations
- type Assertion
- type Book
- type BookMetadata
- 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 DOIData
- type DOIRecord
- type Database
- type DatabaseMetadata
- type Dataset
- type Dissertation
- type EventMetadata
- type Format
- type ISBN
- type ISSN
- type Institution
- type Item
- type ItemNumber
- type Journal
- type JournalArticle
- type JournalIssue
- type JournalMetadata
- type JournalVolume
- type LicenseRef
- 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 Standard
- type Titles
Constants ¶
This section is empty.
Variables ¶
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
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 LoadList ¶ added in v0.2.11
func LoadList(filename string) ([]commonmeta.Data, error)
LoadList loads the metadata for a list of works from an XML file and converts it to the Commonmeta format
Types ¶
type AcceptanceDate ¶ added in v0.2.8
type Affiliation ¶ added in v0.2.8
Affiliation represents an affiliation in Crossref XML metadata.
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"`
Label string `xml:"label,attr"`
GroupName string `xml:"group_name,attr"`
GroupLabel string `xml:"group_label,attr"`
Order string `xml:"order,attr"`
Assertion []Assertion `xml:"assertion"`
}
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"`
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 Citation ¶ added in v0.2.8
type Citation struct {
XMLName xml.Name `xml:"citation"`
Key string `xml:"key,attr"`
JournalTitle string `xml:"journal_title"`
Author string `xml:"author"`
Volume string `xml:"volume"`
FirstPage string `xml:"first_page"`
CYear string `xml:"cYear"`
ArticleTitle string `xml:"article_title"`
Doi struct {
Text string `xml:",chardata"`
Provider string `xml:"provider,attr"`
} `xml:"doi"`
UnstructedCitation string `xml:"unstructured_citation"`
}
type CitationList ¶ added in v0.2.8
type CitationList struct {
Citation []Citation `xml:"citation"`
}
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"`
}
type Content ¶
type Content struct {
Crossrefxml
Query Query `xml:"query"`
CrossrefMetadata Query `xml:"crossref_metadata"`
}
Content represents the Crossref XML metadata returned from Crossref. The type is more flexible than the Crossrefxml type, allowing for different formats of some 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"`
}
type Contributors ¶ added in v0.2.8
type Contributors struct {
XMLName xml.Name `xml:"contributors"`
PersonName []PersonName `xml:"person_name"`
}
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 DOIRecord ¶ added in v0.2.8
type DOIRecord struct {
XMLName xml.Name `xml:"doi_record"`
Crossref struct {
Xmlns string `xml:"xmlns,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
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"`
} `xml:"crossref"`
}
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"`
}
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 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"`
JournalIssue JournalIssue `xml:"journal_issue"`
JournalMetadata JournalMetadata `xml:"journal_metadata"`
JournalArticle JournalArticle `xml:"journal_article"`
}
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"`
ReferenceDistributionOpts string `xml:"reference_distribution_opts,attr"`
Titles Titles `xml:"titles"`
Contributors Contributors `xml:"contributors"`
PublicationDate []PublicationDate `xml:"publication_date"`
PublisherItem struct {
ItemNumber ItemNumber `xml:"item_number"`
} `xml:"publisher_item"`
Abstract []Abstract `xml:"jats:abstract"`
Pages Pages `xml:"pages"`
ISSN []ISSN `xml:"issn"`
Program []Program `xml:"program"`
Crossmark Crossmark `xml:"crossmark"`
ArchiveLocations ArchiveLocations `xml:"archive_locations"`
DOIData DOIData `xml:"doi_data"`
CitationList CitationList `xml:"citation_list"`
}
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"`
Issue string `xml:"issue"`
DOIData DOIData `xml:"doi_data"`
}
type JournalMetadata ¶ added in v0.2.8
type JournalMetadata struct {
XMLName xml.Name `xml:"journal_metadata"`
Language string `xml:"language,attr"`
FullTitle string `xml:"full_title"`
ISSN []ISSN `xml:"issn"`
DOIData DOIData `xml:"doi_data"`
}
JournalMetadata represents journal metadata in Crossref XML metadata.
type JournalVolume ¶ added in v0.2.8
type LicenseRef ¶ added in v0.2.8
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"`
ORCID string `xml:"ORCID"`
Affiliations []Institution `xml:"affiliations>institution"`
Affiliation string `xml:"affiliation"`
}
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"`
GroupTitle string `xml:"group_title"`
Contributors Contributors `xml:"contributors"`
Titles Titles `xml:"titles"`
PostedDate PostedDate `xml:"posted_date"`
AcceptanceDate AcceptanceDate `xml:"acceptance_date"`
Institution Institution `xml:"institution"`
Abstract []Abstract `xml:"abstract"`
ItemNumber ItemNumber `xml:"item_number"`
Program []Program `xml:"program"`
DOIData DOIData `xml:"doi_data"`
CitationList struct {
Citation []Citation `xml:"citation"`
} `xml:"citation_list"`
}
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"`
Text string `xml:",chardata"`
Fr string `xml:"fr,attr"`
Name string `xml:"name,attr"`
Ai string `xml:"ai,attr"`
Rel string `xml:"rel,attr"`
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 RelatedItem ¶ added in v0.2.8
type RelatedItem struct {
XMLName xml.Name `xml:"related_item"`
Text string `xml:",chardata"`
Description string `xml:"description"`
InterWorkRelation struct {
Text string `xml:",chardata"`
IdentifierType string `xml:"identifier-type,attr"`
RelationshipType string `xml:"relationship-type,attr"`
} `xml:"inter_work_relation"`
IntraWorkRelation struct {
Text string `xml:",chardata"`
IdentifierType string `xml:"identifier-type,attr"`
RelationshipType string `xml:"relationship-type,attr"`
} `xml:"intra_work_relation"`
}
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 Titles ¶ added in v0.2.8
type Titles struct {
XMLName xml.Name `xml:"titles"`
Title string `xml:"title"`
Subtitle string `xml:"subtitle"`
OriginalLanguageTitle struct {
Text string `xml:",chardata"`
Language string `xml:"language,attr"`
} `xml:"original_language_title"`
}
Titles represents the titles in Crossref XML metadata.