Documentation ¶
Overview ¶
Package datacite provides function to convert DataCite metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Fetch(str string) (commonmeta.Data, error)
- func FetchAll(number int, sample bool) ([]commonmeta.Data, error)
- func GetContributor(v ContentContributor) commonmeta.Contributor
- func Load(filename string) (commonmeta.Data, error)
- func LoadAll(filename string) ([]commonmeta.Data, error)
- func QueryURL(number int, sample bool) string
- func Read(content Content) (commonmeta.Data, error)
- func ReadAll(content []Content) ([]commonmeta.Data, error)
- func Write(data commonmeta.Data) ([]byte, []gojsonschema.ResultError)
- func WriteAll(list []commonmeta.Data) ([]byte, []gojsonschema.ResultError)
- type Affiliation
- type AlternateIdentifier
- type Container
- type Content
- type ContentContributor
- type Contributor
- type Datacite
- type Date
- type Description
- type FundingReference
- type GeoLocation
- type GeoLocationBox
- type GeoLocationPoint
- type NameIdentifier
- type Publisher
- type RelatedIdentifier
- type Rights
- type Subject
- type Title
- type Types
Constants ¶
This section is empty.
Variables ¶
var CMToDCMappings = map[string]string{
"Article": "Preprint",
"Audiovisual": "Audiovisual",
"Book": "Book",
"BookChapter": "BookChapter",
"Collection": "Collection",
"Dataset": "Dataset",
"Document": "Text",
"Entry": "Text",
"Event": "Event",
"Figure": "Image",
"Image": "Image",
"Instrument": "Instrument",
"JournalArticle": "JournalArticle",
"LegalDocument": "Text",
"Manuscript": "Text",
"Map": "Image",
"Patent": "Text",
"Performance": "Audiovisual",
"PersonalCommunication": "Text",
"Post": "Text",
"ProceedingsArticle": "ConferencePaper",
"Proceedings": "ConferenceProceeding",
"Report": "Report",
"Review": "PeerReview",
"Software": "Software",
"Sound": "Sound",
"Standard": "Standard",
"StudyRegistration": "StudyRegistration",
"WebPage": "Text",
}
var DCToCMMappings = map[string]string{
"Audiovisual": "Audiovisual",
"BlogPosting": "Article",
"Book": "Book",
"BookChapter": "BookChapter",
"Collection": "Collection",
"ComputationalNotebook": "ComputationalNotebook",
"ConferencePaper": "ProceedingsArticle",
"ConferenceProceeding": "Proceedings",
"DataPaper": "JournalArticle",
"Dataset": "Dataset",
"Dissertation": "Dissertation",
"Event": "Event",
"Image": "Image",
"Instrument": "Instrument",
"InteractiveResource": "InteractiveResource",
"Journal": "Journal",
"JournalArticle": "JournalArticle",
"Model": "Model",
"OutputManagementPlan": "OutputManagementPlan",
"PeerReview": "PeerReview",
"PhysicalObject": "PhysicalObject",
"Poster": "Presentation",
"Preprint": "Article",
"Report": "Report",
"Service": "Service",
"Software": "Software",
"Sound": "Sound",
"Standard": "Standard",
"StudyRegistration": "StudyRegistration",
"Text": "Document",
"Thesis": "Dissertation",
"Workflow": "Workflow",
"Other": "Other",
}
DCToCMMappings maps DataCite resource types to Commonmeta types source: https://github.com/datacite/schema/blob/master/source/meta/kernel-4/include/datacite-resourceType-v4.xsd
Functions ¶
func Fetch ¶ added in v0.2.1
func Fetch(str string) (commonmeta.Data, error)
Fetch fetches DataCite metadata for a given DOI and returns Commonmeta metadata.
func FetchAll ¶ added in v0.2.14
func FetchAll(number int, sample bool) ([]commonmeta.Data, error)
FetchAll gets the metadata for a list of works from the DataCite API and returns Commonmeta metadata.
func GetContributor ¶
func GetContributor(v ContentContributor) commonmeta.Contributor
GetContributor converts DataCite contributor metadata into the Commonmeta format
func Load ¶ added in v0.2.1
func Load(filename string) (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) ([]commonmeta.Data, error)
LoadAll loads a list of DataCite metadata from a JSON string and returns Commonmeta metadata.
func Read ¶ added in v0.2.1
func Read(content Content) (commonmeta.Data, error)
Read reads DataCite JSON response and return work struct in Commonmeta format
func ReadAll ¶ added in v0.2.13
func ReadAll(content []Content) ([]commonmeta.Data, error)
ReadAll reads a list of DataCite JSON responses and returns a list of works in Commonmeta format
func Write ¶ added in v0.2.4
func Write(data commonmeta.Data) ([]byte, []gojsonschema.ResultError)
Write writes commonmeta metadata.
func WriteAll ¶ added in v0.2.13
func WriteAll(list []commonmeta.Data) ([]byte, []gojsonschema.ResultError)
WriteAll writes a list of commonmeta metadata.
Types ¶
type Affiliation ¶ added in v0.2.4
type AlternateIdentifier ¶ added in v0.2.4
type AlternateIdentifier struct { AlternateIdentifier string `json:"alternateIdentifier,omitempty"` AlternateIdentifierType string `json:"alternateIdentifierType,omitempty"` }
AlternateIdentifier represents an alternate identifier in the DataCite metadata.
type Container ¶ added in v0.2.4
type Container struct { Type string `json:"type,omitempty"` Identifier string `json:"identifier,omitempty"` IdentifierType string `json:"identifierType,omitempty"` Title string `json:"title,omitempty"` Volume string `json:"volume,omitempty"` Issue string `json:"issue,omitempty"` FirstPage string `json:"firstPage,omitempty"` LastPage string `json:"lastPage,omitempty"` }
Container represents the container of the DataCite JSONAPI response.
type Content ¶
type Content struct { *Datacite Creators []ContentContributor `json:"creators"` Contributors []ContentContributor `json:"contributors"` PublicationYear json.RawMessage `json:"publicationYear"` Publisher json.RawMessage `json:"publisher"` }
Content represents the DataCite metadata returned from DataCite. The type is more flexible than the Datacite type, allowing for different formats of some metadata. Affiliation can be string or struct, PublicationYear can be int or string. Publisher can be string or struct.
func ReadJSONLines ¶ added in v0.2.4
ReadJSONLines reads JSON lines from a file and unmarshals them
type ContentContributor ¶ added in v0.2.4
type ContentContributor struct { *Contributor Affiliation json.RawMessage `json:"affiliation,omitempty"` }
ContentContributor represents a creator or contributor in the DataCite JSONAPI response.
type Contributor ¶
type Contributor struct { Name string `json:"name,omitempty"` GivenName string `json:"givenName,omitempty"` FamilyName string `json:"familyName,omitempty"` NameType string `json:"nameType"` Affiliation []string `json:"affiliation,omitempty"` NameIdentifiers []NameIdentifier `json:"nameIdentifiers,omitempty"` ContributorType string `json:"contributorType,omitempty"` }
Contributor represents the contributor of the DataCite JSONAPI response.
type Datacite ¶ added in v0.2.4
type Datacite struct { ID string `json:"id"` DOI string `json:"doi"` AlternateIdentifiers []AlternateIdentifier `json:"alternateIdentifiers,omitempty"` Creators []Contributor `json:"creators"` Publisher Publisher `json:"publisher"` Container Container `json:"container,omitempty"` PublicationYear int `json:"publicationYear"` Titles []Title `json:"titles"` URL string `json:"url"` Subjects []Subject `json:"subjects,omitempty"` Contributors []Contributor `json:"contributors,omitempty"` Dates []Date `json:"dates,omitempty"` Language string `json:"language,omitempty"` Types Types `json:"types"` RelatedIdentifiers []RelatedIdentifier `json:"relatedIdentifiers,omitempty"` Sizes []string `json:"sizes,omitempty"` Formats []string `json:"formats,omitempty"` Version string `json:"version,omitempty"` RightsList []Rights `json:"rightsList,omitempty"` Descriptions []Description `json:"descriptions,omitempty"` GeoLocations []GeoLocation `json:"geoLocations,omitempty"` FundingReferences []FundingReference `json:"fundingReferences,omitempty"` SchemaVersion string `json:"schemaVersion"` }
Datacite represents the DataCite metadata.
type Description ¶ added in v0.2.4
type FundingReference ¶ added in v0.2.4
type FundingReference struct { FunderName string `json:"funderName,omitempty"` FunderIdentifier string `json:"funderIdentifier,omitempty"` FunderIdentifierType string `json:"funderIdentifierType,omitempty"` AwardNumber string `json:"awardNumber,omitempty"` AwardURI string `json:"awardUri,omitempty"` }
type GeoLocation ¶ added in v0.2.1
type GeoLocation struct { GeoLocationPoint `json:"geoLocationPoint,omitempty"` GeoLocationBox `json:"geoLocationBox,omitempty"` GeoLocationPlace string `json:"geoLocationPlace,omitempty"` }
type GeoLocationBox ¶ added in v0.2.1
type GeoLocationBox struct { WestBoundLongitude float64 `json:"westBoundLongitude,string,omitempty"` EastBoundLongitude float64 `json:"eastBoundLongitude,string,omitempty"` SouthBoundLatitude float64 `json:"southBoundLatitude,string,omitempty"` NorthBoundLatitude float64 `json:"northBoundLatitude,string,omitempty"` }