Documentation
¶
Overview ¶
Package openalex provides functions to convert Openalex metadata to the commonmeta metadata format.
Index ¶
- Variables
- func GetAbstract(invertedIndex map[string][]int) string
- func GetContributors(authorships []Authorship) []commonmeta.Contributor
- func GetFiles(work *Work) []commonmeta.File
- func GetRelated(work *Work) commonmeta.Reference
- type Author
- type Authorship
- type Biblio
- type Funder
- type Grant
- type Institution
- type Location
- type Reader
- func (r *Reader) APIURL(id string, idType string) string
- func (r *Reader) Fetch(pid string) (commonmeta.Data, error)
- func (r *Reader) FetchAll(number int, page int, publisher string, type_ string, sample bool, ids string, ...) ([]commonmeta.Data, error)
- func (r *Reader) Get(pid string) (*Work, error)
- func (r *Reader) GetAll(number int, page int, publisher string, type_ string, sample bool, ids string, ...) ([]Work, error)
- func (r *Reader) GetContainer(work *Work) commonmeta.Container
- func (r *Reader) GetFunders(ids []string) ([]Funder, error)
- func (r *Reader) GetSource(sourceID string) (*Source, error)
- func (r *Reader) GetWorks(ids []string) ([]Work, error)
- func (r *Reader) ParseFunding(grants []Grant) ([]commonmeta.FundingReference, error)
- func (r *Reader) ParseReferences(referencedWorks []string) ([]commonmeta.Reference, error)
- func (r *Reader) QueryURL(number int, page int, publisher string, type_ string, sample bool, ids string, ...) string
- func (r *Reader) Read(work *Work) (commonmeta.Data, error)
- func (r *Reader) ReadAll(works []Work) ([]commonmeta.Data, error)
- type Source
- type SubfieldTopic
- type Topic
- type Work
Constants ¶
This section is empty.
Variables ¶
var OAToCMMappings = map[string]string{
"article": "Article",
"book": "Book",
"book-chapter": "BookChapter",
"dataset": "Dataset",
"dissertation": "Dissertation",
"editorial": "Document",
"erratum": "Other",
"grant": "Grant",
"letter": "Article",
"libguides": "InteractiveResource",
"other": "Other",
"paratext": "Component",
"peer-review": "PeerReview",
"preprint": "Article",
"reference-entry": "Other",
"report": "Report",
"retraction": "Other",
"review": "Article",
"standard": "Standard",
"supplementary-materials": "Component",
}
OAToCMMappings maps OpenAlex types to Commonmeta types
var OpenAlexContainerTypes = map[string]string{
"journal": "Journal",
"proceedings": "Proceedings",
"reference": "Collection",
"repository": "Repository",
"book-series": "BookSeries",
"book": "Book",
"report-series": "ReportSeries",
}
OpenAlexContainerTypes maps OpenAlex container types to Commonmeta container types
var OpenAlexIdentifierTypes = map[string]string{
"openalex": "OpenAlex",
"doi": "DOI",
"mag": "MAG",
"pmid": "PMID",
"pmcid": "PMCID",
}
OpenAlexIdentifierTypes maps OpenAlex identifier types to Commonmeta identifier types
var OpenAlexLicenses = map[string]string{
"cc-by": "CC-BY-4.0",
"cc0": "CC0-1.0",
}
OpenAlexLicenses maps OpenAlex license strings to SPDX licenseId
Functions ¶
func GetAbstract ¶
GetAbstract extracts the abstract from OpenAlex's inverted index format
func GetContributors ¶
func GetContributors(authorships []Authorship) []commonmeta.Contributor
GetContributors extracts contributor information from authorships
func GetFiles ¶
func GetFiles(work *Work) []commonmeta.File
GetFiles extracts file information from a work
func GetRelated ¶
func GetRelated(work *Work) commonmeta.Reference
GetRelated converts an OpenAlex work to a reference
Types ¶
type Author ¶
type Author struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
ORCID string `json:"orcid"`
}
Author represents an author in OpenAlex
type Authorship ¶
type Authorship struct {
Author Author `json:"author"`
Institutions []Institution `json:"institutions"`
}
Authorship represents author information in OpenAlex
type Biblio ¶
type Biblio struct {
Volume string `json:"volume"`
Issue string `json:"issue"`
FirstPage string `json:"first_page"`
LastPage string `json:"last_page"`
}
Biblio represents bibliographic information in OpenAlex
type Funder ¶
type Funder struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Ids struct {
ROR string `json:"ror"`
} `json:"ids"`
}
Funder represents funder information in OpenAlex
type Institution ¶
type Institution struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
ROR string `json:"ror"`
}
Institution represents an institution in OpenAlex
type Location ¶
type Location struct {
LandingPageURL string `json:"landing_page_url"`
PDFURL string `json:"pdf_url"`
Source Source `json:"source"`
License string `json:"license"`
}
Location represents a location in OpenAlex
type Reader ¶
type Reader struct {
Email string // Email for polite pool of OpenAlex API
}
Reader struct to hold any configuration for the Openalex reader
func (*Reader) Fetch ¶
func (r *Reader) Fetch(pid string) (commonmeta.Data, error)
Fetch retrieves and parses metadata from OpenAlex by ID
func (*Reader) FetchAll ¶
func (r *Reader) FetchAll(number int, page int, publisher string, type_ string, sample bool, ids string, year string, ror string, orcid string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool) ([]commonmeta.Data, error)
FetchAll retrieves and parses metadata from OpenAlex by query
func (*Reader) GetAll ¶
func (r *Reader) GetAll(number int, page int, publisher string, type_ string, sample bool, ids string, year string, ror string, orcid string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool) ([]Work, error)
GetAll gets the metadata for a list of works from the OpenAlex API
func (*Reader) GetContainer ¶
func (r *Reader) GetContainer(work *Work) commonmeta.Container
GetContainer extracts container information from a work
func (*Reader) GetFunders ¶
GetFunders fetches multiple funders from OpenAlex based on IDs
func (*Reader) ParseFunding ¶
func (r *Reader) ParseFunding(grants []Grant) ([]commonmeta.FundingReference, error)
ParseFunding processes funding information from a work
func (*Reader) ParseReferences ¶
func (r *Reader) ParseReferences(referencedWorks []string) ([]commonmeta.Reference, error)
ParseReferences fetches and processes references for a work
func (*Reader) QueryURL ¶
func (r *Reader) QueryURL(number int, page int, publisher string, type_ string, sample bool, ids string, year string, orcid string, ror string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, hasArchive bool) string
QueryURL constructs a URL for querying the OpenAlex API
type Source ¶
type Source struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
ISSN string `json:"issn_l"`
Type string `json:"type"`
HostOrganizationName string `json:"host_organization_name"`
HomepageURL string `json:"homepage_url"`
}
Source represents an OpenAlex source
type SubfieldTopic ¶
type SubfieldTopic struct {
DisplayName string `json:"display_name"`
}
SubfieldTopic represents a subfield topic in OpenAlex
type Topic ¶
type Topic struct {
ID string `json:"id"`
Subfield SubfieldTopic `json:"subfield"`
}
Topic represents a topic in OpenAlex
type Work ¶
type Work struct {
ID string `json:"id"`
DOI string `json:"doi"`
Title string `json:"title"`
DisplayName string `json:"display_name"`
Type string `json:"type"`
TypeCrossref string `json:"type_crossref"`
PublicationDate string `json:"publication_date"`
CreatedDate string `json:"created_date"`
Language string `json:"language"`
Version string `json:"version"`
AbstractInvertedIndex map[string][]int `json:"abstract_inverted_index"`
AuthorShips []Authorship `json:"authorships"`
Ids map[string]string `json:"ids"`
PrimaryLocation Location `json:"primary_location"`
BestOALocation Location `json:"best_oa_location"`
Topics []Topic `json:"topics"`
Biblio Biblio `json:"biblio"`
ReferencedWorks []string `json:"referenced_works"`
RelatedWorks []string `json:"related_works"`
Grants []Grant `json:"grants"`
}
Work represents an OpenAlex work