Documentation
¶
Overview ¶
Package schemaorg converts Schema.org metadata to/from the commonmeta metadata format.
Index ¶
- Variables
- func Read(content Content) (commonmeta.Data, error)
- func Write(data commonmeta.Data) ([]byte, []gojsonschema.ResultError)
- func WriteAll(list []commonmeta.Data) ([]byte, []gojsonschema.ResultError)
- type Author
- type Citation
- type CodeRepository
- type Content
- 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 CMToSOMappings = map[string]string{
"Article": "Article",
"Audiovisual": "CreativeWork",
"Book": "Book",
"BookChapter": "BookChapter",
"Collection": "CreativeWork",
"Dataset": "Dataset",
"Dissertation": "Dissertation",
"Document": "CreativeWork",
"Entry": "CreativeWork",
"Event": "CreativeWork",
"Figure": "CreativeWork",
"Image": "CreativeWork",
"Instrument": "Instrument",
"JournalArticle": "ScholarlyArticle",
"LegalDocument": "Legislation",
"Software": "SoftwareSourceCode",
"Presentation": "PresentationDigitalDocument",
}
CMToSOMappings maps Commonmeta types to Schema.org types.
Functions ¶
func Read ¶ added in v0.2.1
func Read(content Content) (commonmeta.Data, error)
Read reads Schema.org metadata and converts it to commonmeta.
func Write ¶ added in v0.2.6
func Write(data commonmeta.Data) ([]byte, []gojsonschema.ResultError)
Write writes schemaorg metadata.
func WriteAll ¶ added in v0.2.13
func WriteAll(list []commonmeta.Data) ([]byte, []gojsonschema.ResultError)
WriteAll writes a list of schemaorg metadata.
Types ¶
type Author ¶ added in v0.2.6
type Author 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"`
Affiliations []Organization `json:"affiliations,omitempty"`
}
Author represents the author of this CreativeWork.
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
Identifier json.RawMessage `json:"identifier"`
}
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 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 Editor ¶ added in v0.2.6
type Editor 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"`
Affiliations []Organization `json:"affiliations,omitempty"`
}
Editor represents
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
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.2.6
type SchemaOrg struct {
Context string `json:"@context"`
ID string `json:"@id"`
Type string `json:"@type"`
AdditionalType string `json:"additionalType,omitempty"`
Author []Author `json:"author,omitempty"`
Citation []Citation `json:"citation,omitempty"`
CodeRepository string `json:"codeRepository,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"`
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,omitempyt"`
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.