schema

package
v0.0.0-...-1cdef85 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeUpdate           = "update"
	EventTypeCreate           = "create"
	EventTypeDelete           = "delete"
	EventTypeVisibilityChange = "visibility-change"
)

Type of events supported by the system.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	// Name is the name of the article.
	Name string `json:"name,omitempty"`

	// Abstract is a summary of the article.
	Abstract string `json:"abstract,omitempty"`

	// Identifier is a unique identifier for the article (in scope of a single project).
	Identifier int `json:"identifier,omitempty"`

	// DateCreated is the date and time the article was created.
	DateCreated *time.Time `json:"date_created,omitempty"`

	// DateModified is the date and time the article was last modified.
	DateModified *time.Time `json:"date_modified,omitempty"`

	// DatePreviouslyModified is the date and time the article was previously modified.
	DatePreviouslyModified *time.Time `json:"date_previously_modified,omitempty"`

	// Protection specifies the access restrictions for the article.
	Protection []*Protection `json:"protection,omitempty"`

	// Version is the metadata about the version of the article.
	Version *Version `json:"version,omitempty"`

	// PreviousVersion is the metadata about the previous version of the article.
	PreviousVersion *PreviousVersion `json:"previous_version,omitempty"`

	// URL is the URL of the article.
	URL string `json:"url,omitempty"`

	// WatchersCount is the number of watchers for the article.
	WatchersCount int `json:"watchers_count,omitempty"`

	// Namespace is the namespace of the article.
	Namespace *Namespace `json:"namespace,omitempty"`

	// InLanguage is the language of the article.
	InLanguage *Language `json:"in_language,omitempty"`

	// MainEntity is the main (Wikidata) entity of the article.
	MainEntity *Entity `json:"main_entity,omitempty"`

	// AdditionalEntities are the additional (Wikidata) entities used in the article.
	AdditionalEntities []*Entity `json:"additional_entities,omitempty"`

	// Categories are the categories of the article.
	Categories []*Category `json:"categories,omitempty"`

	// Templates are the templates used in the article.
	Templates []*Template `json:"templates,omitempty"`

	// Redirects are the redirects for the article.
	Redirects []*Redirect `json:"redirects,omitempty"`

	// IsPartOf is the project that the article belongs to.
	IsPartOf *Project `json:"is_part_of,omitempty"`

	// ArticleBody is the body of the article.
	ArticleBody *ArticleBody `json:"article_body,omitempty"`

	// License specifies the license for the article.
	License []*License `json:"license,omitempty"`

	// Visibility specifies the visibility of the article.
	Visibility *Visibility `json:"visibility,omitempty"`

	// Event specifies the event related to the article.
	Event *Event `json:"event,omitempty"`

	// Image specifies the image related to the article.
	Image *Image `json:"image,omitempty"`
}

Article schema for wikipedia article. Tries to compliant with https://schema.org/Article.

type ArticleBody

type ArticleBody struct {
	HTML     string `json:"html,omitempty"`
	WikiText string `json:"wikitext,omitempty"`
}

ArticleBody schema for article content. Not fully compliant with https://schema.org/articleBody, we need multiple article bodies.

type Batch

type Batch struct {
	Name         string     `json:"name,omitempty"`          // Name of the batch.
	Identifier   string     `json:"identifier,omitempty"`    // Unique identifier for the batch.
	Version      string     `json:"version,omitempty"`       // Version of the batch.
	DateModified *time.Time `json:"date_modified,omitempty"` // Time the batch was last modified.
	IsPartOf     *Project   `json:"is_part_of,omitempty"`    // The project that this batch belongs to.
	InLanguage   *Language  `json:"in_language,omitempty"`   // The language of the contents of the batch.
	Namespace    *Namespace `json:"namespace,omitempty"`     // The namespace of the batch.
	Size         *Size      `json:"size,omitempty"`          // The size of the batch.
}

Batch represents metadata for the realtime batch in WME API.

type Category

type Category struct {
	// Name is the name of the category.
	Name string `json:"name,omitempty"`

	// URL is the URL of the category.
	URL string `json:"url,omitempty"`
}

Category article category representation.

type Code

type Code struct {
	// Identifier is the unique identifier for this code.
	Identifier string `json:"identifier,omitempty"`
	// Name is the human-readable name of this code.
	Name string `json:"name,omitempty"`
	// Description is a description of this code.
	Description string `json:"description,omitempty"`
}

Code is a project code representation in WME API.

type Delta

type Delta struct {
	Increase             int `json:"increase,omitempty"`
	Decrease             int `json:"decrease,omitempty"`
	Sum                  int `json:"sum,omitempty"`
	ProportionalIncrease int `json:"proportional_increase,omitempty"`
	ProportionalDecrease int `json:"proportional_decrease,omitempty"`
}

Delta represents the change description between two versions for certain dataset.

type Diff

type Diff struct {
	LongestNewRepeatedCharacter int    `json:"longest_new_repeated_character,omitempty"`
	Words                       *Delta `json:"words,omitempty"`
	NonWords                    *Delta `json:"non_words,omitempty"`
	NonSafeWords                *Delta `json:"non_safe_words,omitempty"`
	InformalWords               *Delta `json:"informal_words,omitempty"`
	UppercaseLetters            *Delta `json:"uppercase_letters,omitempty"`
	Size                        *Size  `json:"size,omitempty"`
}

Diff representats the difference between current and previous version.

type Editor

type Editor struct {
	Identifier        int        `json:"identifier,omitempty"`
	Name              string     `json:"name,omitempty"`
	EditCount         int        `json:"edit_count,omitempty"`
	Groups            []string   `json:"groups,omitempty"`
	IsBot             bool       `json:"is_bot,omitempty"`
	IsAnonymous       bool       `json:"is_anonymous,omitempty"`
	IsAdmin           bool       `json:"is_admin,omitempty"`
	IsPatroller       bool       `json:"is_patroller,omitempty"`
	HasAdvancedRights bool       `json:"has_advanced_rights,omitempty"`
	DateStarted       *time.Time `json:"date_started,omitempty"`
}

Editor for the article version. Combines Person and CreativeWork with custom properties, link https://schema.org/editor.

type Entity

type Entity struct {
	Identifier string   `json:"identifier,omitempty"`
	URL        string   `json:"url,omitempty"`
	Aspects    []string `json:"aspects,omitempty"`
}

Entity schema for wikidata article. Right now will just be a copy of initial wikidata schema. Partially uses https://schema.org/Thing.

type Event

type Event struct {
	Identifier    string     `json:"identifier,omitempty"`
	Type          string     `json:"type,omitempty"`
	DateCreated   *time.Time `json:"date_created,omitempty"`
	FailCount     int        `json:"fail_count,omitempty"`
	FailReason    string     `json:"fail_reason,omitempty"`
	DatePublished *time.Time `json:"date_published,omitempty"`
	Partition     *int       `json:"partition,omitempty"`
	Offset        *int64     `json:"offset,omitempty"`
}

Event meta data for every event that happens in the system.

type Headers

type Headers struct {
	ContentLength int        `json:"content_length,omitempty"`
	ETag          string     `json:"etag,omitempty"`
	LastModified  *time.Time `json:"last_modified,omitempty"`
	ContentType   string     `json:"content_type,omitempty"`
	AcceptRanges  string     `json:"accept_ranges,omitempty"`
}

Headers is representation of headers is in the response of HEAD request.

type Image

type Image struct {
	// ContentUrl is the URL of the image.
	ContentUrl string `json:"content_url,omitempty" avro:"contentUrl"`

	// Width is the width of the image.
	Width int `json:"width,omitempty" avro:"width"`

	// Height is the height of the image.
	Height int `json:"height,omitempty" avro:"height"`

	// AlternativeText is the alternative text of the image.
	AlternativeText string `json:"alternative_text,omitempty"`

	// Caption is the caption of the image.
	Caption string `json:"caption,omitempty"`
}

Image schema for article image. Compliant with https://schema.org/ImageObject,

type Language

type Language struct {
	Identifier    string `json:"identifier,omitempty"`
	Name          string `json:"name,omitempty"`
	AlternateName string `json:"alternate_name,omitempty"`
	Direction     string `json:"direction,omitempty"`
}

Language representation accroding to https://schema.org/Language.

type License

type License struct {
	Name       string `json:"name,omitempty"`
	Identifier string `json:"identifier,omitempty"`
	URL        string `json:"url,omitempty"`
}

License representation according to https://schema.org/license.

type Link struct {
	// URL is the URL of the link.
	URL string `json:"url,omitempty"`

	// Text is the text of the link.
	Text string `json:"text,omitempty"`

	// Images are the images included inside  the link.
	Images []*Image `json:"images,omitempty"`
}

Link represents a link that can be found on a Wikipedia page.

type Namespace

type Namespace struct {
	Name          string `json:"name,omitempty"`
	AlternateName string `json:"alternate_name,omitempty"`
	Identifier    int    `json:"identifier"`
	Event         *Event `json:"event,omitempty"`
}

Namespace representation of mediawiki namespace. There's nothing related to this in https://schema.org/, we used https://schema.org/Thing.

type PreviousVersion

type PreviousVersion struct {
	Identifier         int `json:"identifier,omitempty"`
	NumberOfCharacters int `json:"number_of_characters,omitempty"`
}

PreviousVersion is the representation for an article's previous version.

type Probability

type Probability struct {
	False float64 `json:"false,omitempty"`
	True  float64 `json:"true,omitempty"`
}

Probability numeric probability values form ORES models.

type ProbabilityScore

type ProbabilityScore struct {
	Prediction  bool         `json:"prediction,omitempty"`
	Probability *Probability `json:"probability,omitempty"`
}

ProbabilityScore probability score representation for ORES models.

type Project

type Project struct {
	Name           string     `json:"name,omitempty"`
	Identifier     string     `json:"identifier,omitempty"`
	URL            string     `json:"url,omitempty"`
	Version        string     `json:"version,omitempty"`
	AdditionalType string     `json:"additional_type,omitempty"`
	DateModified   *time.Time `json:"date_modified,omitempty"`
	InLanguage     *Language  `json:"in_language,omitempty"`
	Size           *Size      `json:"size,omitempty"` // note that there's intentional `sizes` instead of `size` because size is ksqldb keyword
	Event          *Event     `json:"event,omitempty"`
}

Project representation of mediawiki project according to https://schema.org/Project.

type Protection

type Protection struct {
	Type   string `json:"type,omitempty"`
	Level  string `json:"level,omitempty"`
	Expiry string `json:"expiry,omitempty"`
}

Protection level for the article, does not comply with https://schema.org/ custom data.

type Redirect

type Redirect struct {
	// Name is the name of the redirect.
	Name string `json:"name,omitempty"`

	// URL is the URL of the redirect.
	URL string `json:"url,omitempty"`
}

Redirect article redirect representation.

type Scores

type Scores struct {
	Damaging  *ProbabilityScore `json:"damaging,omitempty"`
	GoodFaith *ProbabilityScore `json:"goodfaith,omitempty"`
}

Scores ORES scores representation, has nothing on https://schema.org/, it's a custom dataset. For more info https://ores.wikimedia.org/.

type Size

type Size struct {
	Value    float64 `json:"value,omitempty"`
	UnitText string  `json:"unit_text,omitempty"`
}

Size representation according to https://schema.org/QuantitativeValue.

type Snapshot

type Snapshot struct {
	Name         string     `json:"name,omitempty"`          // Name of the snapshot.
	Identifier   string     `json:"identifier,omitempty"`    // Unique identifier for the snapshot.
	Version      string     `json:"version,omitempty"`       // Version of the snapshot.
	DateModified *time.Time `json:"date_modified,omitempty"` // Time the snapshot was last modified.
	IsPartOf     *Project   `json:"is_part_of,omitempty"`    // The project that this snapshot belongs to.
	InLanguage   *Language  `json:"in_language,omitempty"`   // The language of the contents of the snapshot.
	Namespace    *Namespace `json:"namespace,omitempty"`     // The namespace of the snapshot.
	Size         *Size      `json:"size,omitempty"`          // The size of the snapshot.
}

Batch represents metadata for the daily snapshot in WME API.

type Template

type Template struct {
	// Name is the name of the template.
	Name string `json:"name,omitempty"`

	// URL is the URL of the template.
	URL string `json:"url,omitempty"`
}

Template article template representation.

type Thing

type Thing struct {
	// Name is the name of the thing (article).
	Name string `json:"name,omitempty"`

	// Identifier is a unique identifier for the thing (article, in scope of a single project).
	Identifier int `json:"identifier,omitempty"`

	// Abstract is a summary of the thing (article).
	Abstract string `json:"abstract,omitempty"`

	// Version is the metadata about the version of the thing (article).
	Version *Version `json:"version,omitempty"`

	// URL is the URL of the thing (article).
	URL string `json:"url,omitempty"`

	// DateCreated is the date and time the thing (article) was created.
	DateCreated *time.Time `json:"date_created,omitempty"`

	// DateModified is the date and time the thing (article) was last modified.
	DateModified *time.Time `json:"date_modified,omitempty"`

	// MainEntity is the main (Wikidata) entity of the thing (article).
	MainEntity *Entity `json:"main_entity,omitempty"`

	// AdditionalEntities are the additional (Wikidata) entities used in the thing (article).
	AdditionalEntities []*Entity `json:"additional_entities,omitempty"`

	// IsPartOf is the project that the thing (article) belongs to.
	IsPartOf *Project `json:"is_part_of,omitempty"`

	// InLanguage is the language of the thing (article).
	InLanguage *Language `json:"in_language,omitempty"`

	// HasParts are the parts included inside the thing (article).
	HasParts []*ThingPart `json:"has_parts,omitempty"`

	// Image specifies the image related to the thing (article).
	Image *Image `json:"image,omitempty"`
}

Thing schema for Machine Readable entity. Tries to compliant with https://schema.org/Thing.

type ThingPart

type ThingPart struct {
	// Name is the name of the part.
	Name string `json:"name,omitempty"`

	// Type is the type of the part, for example 'field' or 'section'.
	Type string `json:"type,omitempty"`

	// Value is the value of the part.
	Value string `json:"value,omitempty"`

	// Values are the values of the part (if there are are more than single value).
	Values []string `json:"values,omitempty"`

	// Images are the images included inside the part.
	Images []*Image `json:"images,omitempty"`

	// Links are the links included inside the part.
	Links []*Link `json:"links,omitempty"`

	// HasParts are the parts included inside the part (recursively parts can contain parts).
	HasParts []*ThingPart `json:"has_parts,omitempty"`
}

ThingPart represents a part of a thing (section, field etc.).

type Version

type Version struct {
	Identifier          int      `json:"identifier,omitempty"`
	Comment             string   `json:"comment,omitempty"`
	Tags                []string `json:"tags,omitempty"`
	IsMinorEdit         bool     `json:"is_minor_edit,omitempty"`
	IsFlaggedStable     bool     `json:"is_flagged_stable,omitempty"`
	IsBreakingNews      bool     `json:"is_breaking_news,omitempty"`
	HasTagNeedsCitation bool     `json:"has_tag_needs_citation,omitempty"`
	Scores              *Scores  `json:"scores,omitempty"`
	Editor              *Editor  `json:"editor,omitempty"`
	NumberOfCharacters  int      `json:"number_of_characters,omitempty"`
	Size                *Size    `json:"size,omitempty"`
	Event               *Event   `json:"event,omitempty"`
}

Version representation for the article. Mainly modeled after https://schema.org/Thing.

type Visibility

type Visibility struct {
	Text    bool `json:"text,omitempty"`
	Editor  bool `json:"editor,omitempty"`
	Comment bool `json:"comment,omitempty"`
}

Visibility representing visibility changes for parts of the article. Custom dataset, not modeletd after https://schema.org/.

Jump to

Keyboard shortcuts

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