datacite

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package datacite provides function to convert DataCite metadata to/from the commonmeta metadata format.

Index

Constants

This section is empty.

Variables

View Source
var DCToCMTranslations = 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",
}

DCToCMTranslations 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 FetchList added in v0.2.1

func FetchList(number int, sample bool) ([]commonmeta.Data, error)

FetchList gets the metadata for a list of works from the DataCite API and returns Commonmeta metadata.

func GetContributor

func GetContributor(v Contributor) 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 LoadList added in v0.2.1

func LoadList(filename string) ([]commonmeta.Data, error)

LoadList loads a list of DataCite metadata from a JSON string and returns Commonmeta metadata.

func QueryURL added in v0.2.1

func QueryURL(number int, sample bool) string

QueryURL returns the URL for the DataCite API query

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 ReadList added in v0.2.1

func ReadList(content []Content) ([]commonmeta.Data, error)

ReadList reads a list of DataCite JSON responses and returns a list of works in Commonmeta format

Types

type Attributes

type Attributes struct {
	DOI                  string `json:"doi"`
	Prefix               string `json:"prefix"`
	Suffix               string `json:"suffix"`
	AlternateIdentifiers []struct {
		AlternateIdentifier     string `json:"alternateIdentifier"`
		AlternateIdentifierType string `json:"alternateIdentifierType"`
	} `json:"alternateIdentifiers"`
	Creators  []Contributor `json:"creators"`
	Publisher string        `json:"publisher"`
	Container struct {
		Type           string `json:"type"`
		Identifier     string `json:"identifier"`
		IdentifierType string `json:"identifierType"`
		Title          string `json:"title"`
		Volume         string `json:"volume"`
		Issue          string `json:"issue"`
		FirstPage      string `json:"firstPage"`
		LastPage       string `json:"lastPage"`
	} `json:"container"`
	PublicationYear int `json:"publicationYear"`
	Titles          []struct {
		Title     string `json:"title"`
		TitleType string `json:"titleType"`
		Lang      string `json:"lang"`
	} `json:"titles"`
	URL      string `json:"url"`
	Subjects []struct {
		Subject string `json:"subject"`
	} `json:"subjects"`
	Contributors []Contributor `json:"contributors"`
	Dates        []struct {
		Date            string `json:"date"`
		DateType        string `json:"dateType"`
		DateInformation string `json:"dateInformation"`
	} `json:"dates"`
	Language string `json:"language"`
	Types    struct {
		ResourceTypeGeneral string `json:"resourceTypeGeneral"`
		ResourceType        string `json:"resourceType"`
	} `json:"types"`
	RelatedIdentifiers []struct {
		RelatedIdentifier     string `json:"relatedIdentifier"`
		RelatedIdentifierType string `json:"relatedIdentifierType"`
		RelationType          string `json:"relationType"`
	} `json:"relatedIdentifiers"`
	Sizes      []string `json:"sizes"`
	Formats    []string `json:"formats"`
	Version    string   `json:"version"`
	RightsList []struct {
		Rights                 string `json:"rights"`
		RightsURI              string `json:"rightsUri"`
		SchemeURI              string `json:"schemeUri"`
		RightsIdentifier       string `json:"rightsIdentifier"`
		RightsIdentifierScheme string `json:"rightsIdentifierScheme"`
	}
	Descriptions []struct {
		Description     string `json:"description"`
		DescriptionType string `json:"descriptionType"`
		Lang            string `json:"lang"`
	} `json:"descriptions"`
	GeoLocations      []GeoLocation `json:"geoLocations"`
	FundingReferences []struct {
		FunderName           string `json:"funderName"`
		FunderIdentifier     string `json:"funderIdentifier"`
		FunderIdentifierType string `json:"funderIdentifierType"`
		AwardNumber          string `json:"awardNumber"`
		AwardURI             string `json:"awardUri"`
	} `json:"fundingReferences"`
}

Attributes represents the attributes of the DataCite JSONAPI response.

type Content

type Content struct {
	ID         string     `json:"id"`
	Type       string     `json:"type"`
	Attributes Attributes `json:"attributes"`
}

Content represents the DataCite metadata.

func Get added in v0.2.1

func Get(pid string) (Content, error)

Get gets DataCite metadata for a given DOI

func GetList added in v0.2.1

func GetList(number int, sample bool) ([]Content, error)

GetList gets the metadata for a list of works from the DataCite API

type Contributor

type Contributor struct {
	Name            string `json:"name"`
	GivenName       string `json:"givenName"`
	FamilyName      string `json:"familyName"`
	NameType        string `json:"nameType"`
	NameIdentifiers []struct {
		SchemeURI            string `json:"schemeUri"`
		NameIdentifier       string `json:"nameIdentifier"`
		NameIdentifierScheme string `json:"nameIdentifierScheme"`
	} `json:"nameIdentifiers"`
	Affiliation     []string `json:"affiliation"`
	ContributorType string   `json:"contributorType"`
}

Contributor represents the contributor of the DataCite JSONAPI response.

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 GeoLocationPoint added in v0.2.1

type GeoLocationPoint struct {
	PointLongitude float64 `json:"pointLongitude,string,omitempty"`
	PointLatitude  float64 `json:"pointLatitude,string,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL