commonmeta

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Overview

Package commonmeta provides functions to read and write commonmeta metadata.

Index

Constants

This section is empty.

Variables

View Source
var ContributorRoles = []string{
	"Author",
	"Editor",
	"Chair",
	"Reviewer",
	"ReviewAssistant",
	"StatsReviewer",
	"ReviewerExternal",
	"Reader",
	"Translator",
	"ContactPerson",
	"DataCollector",
	"DataManager",
	"Distributor",
	"HostingInstitution",
	"Producer",
	"ProjectLeader",
	"ProjectManager",
	"ProjectMember",
	"RegistrationAgency",
	"RegistrationAuthority",
	"RelatedPerson",
	"ResearchGroup",
	"RightsHolder",
	"Researcher",
	"Sponsor",
	"WorkPackageLeader",
	"Conceptualization",
	"DataCuration",
	"FormalAnalysis",
	"FundingAcquisition",
	"Investigation",
	"Methodology",
	"ProjectAdministration",
	"Resources",
	"Software",
	"Supervision",
	"Validation",
	"Visualization",
	"WritingOriginalDraft",
	"WritingReviewEditing",
	"Maintainer",
	"Other",
}

ContributorRoles list of contributor roles defined in commonmeta schema.

from commonmeta schema

Functions

func Write added in v0.2.1

func Write(data Data) ([]byte, []gojsonschema.ResultError)

Write writes commonmeta metadata.

func WriteList added in v0.2.1

func WriteList(list []Data) ([]byte, []gojsonschema.ResultError)

WriteList writes commonmeta metadata in slice format.

Types

type Affiliation added in v0.2.1

type Affiliation struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Affiliation represents the affiliation of a contributor, defined in the commonmeta JSON Schema.

type Container added in v0.2.1

type Container struct {
	Identifier     string `json:"identifier,omitempty"`
	IdentifierType string `json:"identifierType,omitempty"`
	Type           string `json:"type,omitempty"`
	Title          string `json:"title,omitempty"`
	FirstPage      string `json:"firstPage,omitempty"`
	LastPage       string `json:"lastPage,omitempty"`
	Volume         string `json:"volume,omitempty"`
	Issue          string `json:"issue,omitempty"`
}

Container represents the container of a publication, defined in the commonmeta JSON Schema.

type Contributor added in v0.2.1

type Contributor struct {
	ID               string        `json:"id,omitempty"`
	Type             string        `json:"type,omitempty"`
	Name             string        `json:"name,omitempty"`
	GivenName        string        `json:"givenName,omitempty"`
	FamilyName       string        `json:"familyName,omitempty"`
	Affiliations     []Affiliation `json:"affiliations,omitempty"`
	ContributorRoles []string      `json:"contributorRoles,omitempty"`
}

Contributor represents a contributor of a publication, defined in the commonmeta JSON Schema.

type Data added in v0.2.1

type Data struct {
	// required fields
	ID   string `db:"id" json:"id"`
	Type string `db:"type" json:"type"`

	// optional fields
	AdditionalType    string             `db:"additional_type" json:"additionalType,omitempty"`
	ArchiveLocations  []string           `db:"archive_locations" json:"archiveLocations,omitempty"`
	Container         Container          `db:"container" json:"container,omitempty"`
	Contributors      []Contributor      `db:"contributors" json:"contributors,omitempty"`
	Date              Date               `db:"date" json:"date,omitempty"`
	Descriptions      []Description      `db:"descriptions" json:"descriptions,omitempty"`
	Files             []File             `db:"files" json:"files,omitempty"`
	FundingReferences []FundingReference `db:"funding_references" json:"fundingReferences,omitempty"`
	GeoLocations      []GeoLocation      `db:"geo_locations" json:"geoLocations,omitempty"`
	Identifiers       []Identifier       `db:"identifiers" json:"identifiers,omitempty"`
	Language          string             `db:"language" json:"language,omitempty"`
	License           License            `db:"license" json:"license,omitempty"`
	Provider          string             `db:"provider" json:"provider,omitempty"`
	Publisher         Publisher          `db:"publisher" json:"publisher,omitempty"`
	References        []Reference        `db:"references" json:"references,omitempty"`
	Relations         []Relation         `db:"relations" json:"relations,omitempty"`
	Subjects          []Subject          `db:"subjects" json:"subjects,omitempty"`
	Titles            []Title            `db:"titles" json:"titles,omitempty"`
	URL               string             `db:"url" json:"url,omitempty"`
	Version           string             `db:"version" json:"version,omitempty"`
}

Data represents the commonmeta metadata, defined in the commonmeta JSON Schema.

func Read added in v0.2.1

func Read(content Data) (Data, error)

Read reads commonmeta metadata.

type Date added in v0.2.1

type Date struct {
	Created     string `json:"created,omitempty"`
	Submitted   string `json:"submitted,omitempty"`
	Accepted    string `json:"accepted,omitempty"`
	Published   string `json:"published,omitempty"`
	Updated     string `json:"updated,omitempty"`
	Accessed    string `json:"accessed,omitempty"`
	Available   string `json:"available,omitempty"`
	Copyrighted string `json:"copyrighted,omitempty"`
	Collected   string `json:"collected,omitempty"`
	Valid       string `json:"valid,omitempty"`
	Withdrawn   string `json:"withdrawn,omitempty"`
	Other       string `json:"other,omitempty"`
}

Date represents the date of a publication, defined in the commonmeta JSON Schema.

type Description added in v0.2.1

type Description struct {
	Description string `json:"description"`
	Type        string `json:"type,omitempty"`
	Language    string `json:"language,omitempty"`
}

Description represents the description of a publication, defined in the commonmeta JSON Schema.

type File added in v0.2.1

type File struct {
	Bucket   string `json:"bucket,omitempty"`
	Key      string `json:"key,omitempty"`
	Checksum string `json:"checksum,omitempty"`
	URL      string `json:"url"`
	Size     int    `json:"size,omitempty"`
	MimeType string `json:"mimeType,omitempty"`
}

File represents a file of a publication, defined in the commonmeta JSON Schema.

type FundingReference added in v0.2.1

type FundingReference struct {
	FunderIdentifier     string `json:"funderIdentifier,omitempty"`
	FunderIdentifierType string `json:"funderIdentifierType,omitempty"`
	FunderName           string `json:"funderName,omitempty"`
	AwardNumber          string `json:"awardNumber,omitempty"`
	AwardURI             string `json:"award_uri,omitempty"`
}

FundingReference represents the funding reference of a publication, defined in the commonmeta JSON Schema.

type GeoLocation added in v0.2.1

type GeoLocation struct {
	GeoLocationPlace string           `json:"geoLocationPlace,omitempty"`
	GeoLocationPoint GeoLocationPoint `json:"geoLocationPoint,omitempty"`
	GeoLocationBox   GeoLocationBox   `json:"geoLocationBox,omitempty"`
}

GeoLocation represents the geographical location of a publication, defined in the commonmeta JSON Schema.

type GeoLocationBox added in v0.2.1

type GeoLocationBox struct {
	EastBoundLongitude float64 `json:"eastBoundLongitude,omitempty"`
	WestBoundLongitude float64 `json:"westBoundLongitude,omitempty"`
	SouthBoundLatitude float64 `json:"southBoundLatitude,omitempty"`
	NorthBoundLatitude float64 `json:"northBoundLatitude,omitempty"`
}

GeoLocationBox represents a box in a geographical location, defined in the commonmeta JSON Schema.

type GeoLocationPoint added in v0.2.1

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

GeoLocationPoint represents a point in a geographical location, defined in the commonmeta JSON Schema.

type GeoLocationPolygon added in v0.2.1

type GeoLocationPolygon struct {
	PolygonPoints  []GeoLocationPoint `json:"polygon_points,omitempty"`
	InPolygonPoint GeoLocationPoint   `json:"in_polygon_point,omitempty"`
}

GeoLocationPolygon represents a polygon in a geographical location, defined in the commonmeta JSON Schema.

type Identifier added in v0.2.1

type Identifier struct {
	Identifier     string `json:"identifier"`
	IdentifierType string `json:"identifierType"`
}

Identifier represents the identifier of a publication, defined in the commonmeta JSON Schema.

type License added in v0.2.1

type License struct {
	ID  string `json:"id,omitempty"`
	URL string `json:"url,omitempty"`
}

License represents the license of a publication, defined in the commonmeta JSON Schema.

type Publisher added in v0.2.1

type Publisher struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
}

Publisher represents the publisher of a publication, defined in the commonmeta JSON Schema.

type Reference added in v0.2.1

type Reference struct {
	Key             string `json:"key"`
	ID              string `json:"id,omitempty"`
	Type            string `json:"type,omitempty"`
	Title           string `json:"title,omitempty"`
	PublicationYear string `json:"publicationYear,omitempty"`
	Unstructured    string `json:"unstructured,omitempty"`
}

Reference represents the reference of a publication, defined in the commonmeta JSON Schema.

type Relation added in v0.2.1

type Relation struct {
	ID   string `json:"id"`
	Type string `json:"type"`
}

Relation represents the relation of a publication, defined in the commonmeta JSON Schema.

type Subject added in v0.2.1

type Subject struct {
	Subject string `json:"subject"`
}

Subject represents the subject of a publication, defined in the commonmeta JSON Schema.

type Title added in v0.2.1

type Title struct {
	Title    string `json:"title,omitempty"`
	Type     string `json:"type,omitempty"`
	Language string `json:"language,omitempty"`
}

Title represents the title of a publication, defined in the commonmeta JSON Schema.

Jump to

Keyboard shortcuts

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