Documentation
¶
Overview ¶
Package datacite provides function to convert DataCite metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Fetch(str string, match bool) (commonmeta.Data, error)
- func FetchAll(number int, page int, client_ string, type_ string, sample bool, year string, ...) ([]commonmeta.Data, error)
- func GetContributor(v ContentContributor, match bool) commonmeta.Contributor
- func Load(filename string, match bool) (commonmeta.Data, error)
- func LoadAll(filename string, match bool) ([]commonmeta.Data, error)
- func ParseGeoCoordinate(gc interface{}) float64
- func QueryURL(number int, page int, client_ 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)
- func Upsert(record commonmeta.APIResponse, account Account, data commonmeta.Data) (commonmeta.APIResponse, error)
- func UpsertAll(list []commonmeta.Data, account Account) ([]commonmeta.APIResponse, error)
- func Write(data commonmeta.Data) ([]byte, error)
- func WriteAll(list []commonmeta.Data) ([]byte, error)
- type Account
- type Affiliation
- type AlternateIdentifier
- type Container
- type Content
- func Get(id string) (Content, error)
- func GetAll(number int, page int, client_ string, type_ string, sample bool, year string, ...) ([]Content, error)
- func ReadJSON(filename string) (Content, error)
- func ReadJSONLines(filename string) ([]Content, error)
- func ReadJSONList(filename string) ([]Content, error)
- type ContentContributor
- type Contributor
- type Data
- type Datacite
- type DataciteWithEvent
- type Date
- type Description
- type FundingReference
- type GeoCoordinate
- type GeoLocation
- type GeoLocationBox
- type GeoLocationBoxInterface
- type GeoLocationInterface
- type GeoLocationPoint
- type GeoLocationPointInterface
- type Identifier
- 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",
"BlogPost": "Preprint",
"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",
"Poster": "Poster",
"Presentation": "Audiovisual",
"ProceedingsArticle": "ConferencePaper",
"Proceedings": "ConferenceProceeding",
"Report": "Report",
"Review": "PeerReview",
"Software": "Software",
"Sound": "Sound",
"Standard": "Standard",
"StudyRegistration": "StudyRegistration",
"WebPage": "Text",
}
var CMToDataciteRelationTypeMappings = map[string]string{
"IsReviewOf": "Reviews",
"HasReview": "IsReviewedby",
}
CMToDataciteRelationTypeMappings maps Commonmeta relation_types to Datacite relation_types
var DCToCMMappings = map[string]string{
"Audiovisual": "Audiovisual",
"BlogPosting": "BlogPost",
"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": "Poster",
"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
var DataciteToCMRelationTypeMappings = map[string]string{
"Reviews": "IsReviewOf",
"IsReviewedby": "HasReview",
}
DataciteToCMRelationTypeMappings maps Datacite relation_types to Commonmeta relation_types
Functions ¶
func Fetch ¶ added in v0.2.1
func Fetch(str string, match bool) (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, page int, client_ string, type_ string, sample bool, year string, language string, orcid string, ror string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool, match 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, match bool) commonmeta.Contributor
GetContributor converts DataCite contributor metadata into 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 a list of DataCite metadata from a JSON string and returns Commonmeta metadata.
func ParseGeoCoordinate ¶ added in v0.6.10
func ParseGeoCoordinate(gc interface{}) float64
func QueryURL ¶ added in v0.2.1
func QueryURL(number int, page int, client_ string, type_ string, sample bool, year string, language string, orcid string, ror string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool) string
QueryURL returns the URL for the DataCite API query
func Read ¶ added in v0.2.1
func Read(content Content, match bool) (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, match bool) ([]commonmeta.Data, error)
ReadAll reads a list of DataCite JSON responses and returns a list of works in Commonmeta format
func Upsert ¶ added in v0.6.19
func Upsert(record commonmeta.APIResponse, account Account, data commonmeta.Data) (commonmeta.APIResponse, error)
Upsert updates or creates datacite metadata.
func UpsertAll ¶ added in v0.6.19
func UpsertAll(list []commonmeta.Data, account Account) ([]commonmeta.APIResponse, error)
UpsertAll updates or creates a list of DataCite 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 interface{} `json:"publicationYear"`
Publisher json.RawMessage `json:"publisher"`
GeoLocations []GeoLocationInterface `json:"geoLocations,omitempty"`
}
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. GeoLocationPoint can be float64 or string.
func GetAll ¶ added in v0.2.14
func GetAll(number int, page int, client_ string, type_ string, sample bool, year string, language string, orcid string, ror string, hasORCID bool, hasROR bool, hasReferences bool, hasRelation bool, hasAbstract bool, hasAward bool, hasLicense bool) ([]Content, error)
GetAll gets the metadata for a list of works from the DataCite API
func ReadJSONLines ¶ added in v0.2.4
ReadJSONLines reads JSON lines from a file and unmarshals them
func ReadJSONList ¶ added in v0.6.10
ReadJSONList reads JSON list from a file and unmarshals it
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 {
DOI string `json:"doi"`
Identifiers []Identifier `json:"identifiers,omitempty"`
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,omitempty"`
}
Datacite represents the DataCite metadata.
type DataciteWithEvent ¶ added in v0.6.20
trigger creation of findable or registered DOI
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"`
AwardTitle string `json:"awardTitle,omitempty"`
AwardURI string `json:"awardUri,omitempty"`
}
type GeoCoordinate ¶ added in v0.6.10
type GeoCoordinate float64
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"`
}
type GeoLocationBoxInterface ¶ added in v0.6.10
type GeoLocationBoxInterface struct {
WestBoundLongitude interface{} `json:"westBoundLongitude,string,omitempty"`
EastBoundLongitude interface{} `json:"eastBoundLongitude,string,omitempty"`
SouthBoundLatitude interface{} `json:"southBoundLatitude,string,omitempty"`
NorthBoundLatitude interface{} `json:"northBoundLatitude,string,omitempty"`
}
type GeoLocationInterface ¶ added in v0.6.10
type GeoLocationInterface struct {
GeoLocationPointInterface `json:"geoLocationPoint,omitempty"`
GeoLocationBoxInterface `json:"geoLocationBox,omitempty"`
GeoLocationPlace string `json:"geoLocationPlace,omitempty"`
}
type GeoLocationPoint ¶ added in v0.2.1
type GeoLocationPointInterface ¶ added in v0.6.10
type GeoLocationPointInterface struct {
PointLongitude interface{} `json:"pointLongitude,string,omitempty"`
PointLatitude interface{} `json:"pointLatitude,string,omitempty"`
}