Documentation
¶
Overview ¶
Package schemaorg converts Schema.org metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Fetch(url string, match bool) (commonmeta.Data, error)
- func GetContributor(v Contributor) commonmeta.Contributor
- func Load(filename string, match bool) (commonmeta.Data, error)
- func Read(content Content) (commonmeta.Data, error)
- func Write(data commonmeta.Data) ([]byte, error)
- func WriteAll(list []commonmeta.Data) ([]byte, error)
- type Citation
- type CodeRepository
- type Content
- type Contributor
- type DataCatalog
- type Editor
- type MediaObject
- type Organization
- type Periodical
- type Person
- type Provider
- type Publisher
- type Schemaorg
Constants ¶
This section is empty.
Variables ¶
var SOToCMMappings = map[string]string{
"Article": "Article",
"BlogPosting": "BlogPost",
"Book": "Book",
"BookChapter": "BookChapter",
"CreativeWork": "Other",
"Dataset": "Dataset",
"DigitalDocument": "Document",
"Dissertation": "Dissertation",
"Instrument": "Instrument",
"NewsArticle": "Article",
"Legislation": "LegalDocument",
"Report": "Report",
"ScholarlyArticle": "JournalArticle",
"SoftwareSourceCode": "Software",
}
SOToCMMappings maps Schema.org types to Commonmeta types.
Functions ¶
func Fetch ¶ added in v0.6.28
func Fetch(url string, match bool) (commonmeta.Data, error)
Fetch fetches Schemaorg metadata for a given URL and returns Commonmeta metadata.
func GetContributor ¶ added in v0.6.28
func GetContributor(v Contributor) commonmeta.Contributor
GetContributor converts Schemaorg contributor metadata into the Commonmeta format
func Load ¶ added in v0.6.28
func Load(filename string, match bool) (commonmeta.Data, error)
Load loads the metadata for a single work from a JSON file
func Read ¶ added in v0.2.1
func Read(content Content) (commonmeta.Data, error)
Read reads Schema.org metadata and converts it to commonmeta.
Types ¶
type Citation ¶ added in v0.2.7
type Citation struct {
ID string `json:"@id,omitempty"`
Type string `json:"@type,omitempty"`
Name string `json:"name,omitempty"`
}
Citation represents a citation or reference to another creative work, such as another publication, web page, scholarly article, etc.
type Content ¶
type Content struct {
Schemaorg
Author json.RawMessage `json:"author,omitempty"`
Creator json.RawMessage `json:"creator,omitempty"`
Contributor json.RawMessage `json:"contributor,omitempty"`
Editor json.RawMessage `json:"editor,omitempty"`
Identifier json.RawMessage `json:"identifier,omitempty"`
Keywords json.RawMessage `json:"keywords,omitempty"`
Version interface{} `json:"version,omitempty"`
}
Content represents the Schemaorg metadata returned from Schemaorg sources. The type is more flexible than the Schemaorg type, allowing for different formats of some metadata. Identifier can be string or []string.
type Contributor ¶ added in v0.6.28
type Contributor struct {
ID string `json:"@id,omitempty"`
Type string `json:"@type,omitempty"`
GivenName string `json:"givenName,omitempty"`
FamilyName string `json:"familyName"`
Name string `json:"name,omitempty"`
Affiliation Organization `json:"affiliation,omitempty"`
}
Contributor represents the author, creator or contributor of this CreativeWork.
type DataCatalog ¶ added in v0.2.6
type DataCatalog struct {
ID string `json:"@id,omitempty"`
Type string `json:"@type,omitempty"`
Name string `json:"name,omitempty"`
}
Datacatalog represents a collection of datasets.
type MediaObject ¶ added in v0.2.6
type MediaObject struct {
Type string `json:"@type"`
ContentURL string `json:"contentUrl"`
EncodingFormat string `json:"encodingFormat,omitempty"`
Name string `json:"name,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Size string `json:"size,omitempty"`
}
MediaObject represents a media object, such as an image, video, audio, or text object embedded in a web page or a downloadable dataset i.e. DataDownload.
type Organization ¶ added in v0.2.6
type Organization struct {
ID string `json:"@id,omitempty"`
SameAs string `json:"sameAs,omitempty"`
Name string `json:"name"`
}
Organization represents an organization such as a school, NGO, corporation, club, etc.
type Periodical ¶ added in v0.2.6
type Periodical struct {
ID string `json:"@id,omitempty"`
Type string `json:"@type"`
Name string `json:"name,omitempty"`
ISSN string `json:"issn,omitempty"`
}
Periodical represents a publication in any medium issued in successive parts bearing numerical or chronological designations and intended to continue indefinitely, such as a magazine, scholarly journal, or newspaper.
type Person ¶ added in v0.2.6
type Person struct {
ID string `json:"@id,omitempty"`
GivenName string `json:"givenName,omitempty"`
FamilyName string `json:"familyName"`
}
Person represents a person (alive, dead, undead, or fictional).
type Schemaorg ¶ added in v0.6.28
type Schemaorg struct {
Context string `json:"@context"`
ID string `json:"@id"`
Type string `json:"@type"`
AdditionalType string `json:"additionalType,omitempty"`
Author []Contributor `json:"author,omitempty"`
Citation []Citation `json:"citation,omitempty"`
CodeRepository string `json:"codeRepository,omitempty"`
ContentURL []string `json:"contentUrl,omitempty"`
Contributor []Contributor `json:"contributor,omitempty"`
Creator []Contributor `json:"creator,omitempty"`
DateCreated string `json:"dateCreated,omitempty"`
DatePublished string `json:"datePublished,omitempty"`
DateModified string `json:"dateModified,omitempty"`
Description string `json:"description,omitempty"`
Distribution []MediaObject `json:"distribution,omitempty"`
Editor []Editor `json:"editor,omitempty"`
Encoding []MediaObject `json:"encoding,omitempty"`
Headline string `json:"headline,omitempty"`
Identifier []string `json:"identifier,omitempty"`
IncludedInDataCatalog DataCatalog `json:"includedInDataCatalog,omitempty"`
InLanguage string `json:"inLanguage,omitempty"`
Keywords string `json:"keywords,omitempty"`
License string `json:"license,omitempty"`
Name string `json:"name,omitempty"`
PageStart string `json:"pageStart,omitempty"`
PageEnd string `json:"pageEnd,omitempty"`
Periodical Periodical `json:"periodical,omitempty"`
Provider Provider `json:"provider,omitempty"`
Publisher Publisher `json:"publisher,omitempty"`
URL string `json:"url,omitempty"`
Version string `json:"version,omitempty"`
}
Schemaorg represents the Schema.org metadata.