Documentation
¶
Overview ¶
Package commonmeta provides functions to read and write commonmeta metadata.
Index ¶
- Variables
- func Write(data Data) ([]byte, []gojsonschema.ResultError)
- func WriteAll(list []Data) ([]byte, []gojsonschema.ResultError)
- type Affiliation
- type Container
- type Contributor
- type Data
- type Date
- type Description
- type File
- type FundingReference
- type GeoLocation
- type GeoLocationBox
- type GeoLocationPoint
- type GeoLocationPolygon
- type Identifier
- type License
- type Publisher
- type Reader
- type Reference
- type Relation
- type Subject
- type Title
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ContainerTypes = map[string]string{
"BookChapter": "Book",
"Dataset": "Database",
"JournalArticle": "Journal",
"JournalIssue": "Journal",
"Book": "BookSeries",
"ProceedingsArticle": "Proceedings",
"Article": "Periodical",
}
ContainerTypes maps types to associated container types
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
var IdentifierTypes = []string{
"ARK",
"arXiv",
"Bibcode",
"DOI",
"Handle",
"ISBN",
"ISSN",
"PMID",
"PMCID",
"PURL",
"URL",
"URN",
"UUID",
"Other",
}
IdentifierTypes list of identifier types defined in the commonmeta schema.
Functions ¶
func Write ¶ added in v0.2.1
func Write(data Data) ([]byte, []gojsonschema.ResultError)
Write writes commonmeta metadata.
func WriteAll ¶ added in v0.2.13
func WriteAll(list []Data) ([]byte, []gojsonschema.ResultError)
WriteAll writes commonmeta metadata in slice format.
Types ¶
type Affiliation ¶ added in v0.2.1
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"`
ContentText string `db:"content" json:"content_text,omitempty"`
Contributors []Contributor `db:"contributors" json:"contributors,omitempty"`
Date Date `db:"date" json:"date,omitempty"`
Descriptions []Description `db:"descriptions" json:"descriptions,omitempty"`
FeatureImage string `db:"image" json:"feature_image,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.
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"`
AwardTitle string `json:"awardTitle,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
License represents the license of a publication, defined in the commonmeta JSON Schema.
type Publisher ¶ added in v0.2.1
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
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.