wikidata

package
v0.0.0-...-8568aec Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LangEnglish       = "en"
	QueryIDs          = "ids"
	QueryProps        = "props"
	ActionGetEntities = "wbgetentities"
	BasicsProps       = "labels|descriptions|info|aliases"
)

* wbgetentities API https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities * @params props: * info, sitelinks, sitelinks/urls, aliases, labels, descriptions, claims, datatype * (default: info|sitelinks|aliases|labels|descriptions|claims|datatype)

View Source
const (
	ActionGetClaims = "wbgetclaims"
	PropertyImage   = "P18"
	ImgEndpoint     = "https://upload.wikimedia.org/wikipedia/commons"
)

wbgetclaims API

View Source
const (
	Endpoint   = "https://www.wikidata.org/w/api.php"
	FormatJson = "json"
)

Variables

This section is empty.

Functions

func IsItem

func IsItem(entity string) bool

func IsProperty

func IsProperty(entity string) bool

Types

type AliasList

type AliasList []StringValue

type Basics

type Basics struct {
	Entities map[string]Entity `json:"entities"`
	Success  int               `json:"success"`
}

func GetBasics

func GetBasics(c *Client, entities string) (b Basics, err error)

type Claim

type Claim []Property

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cl utils.HTTPRequester) *Client

func (*Client) Action

func (c *Client) Action(action string) *Client

func (*Client) Languages

func (c *Client) Languages(lang string) *Client

func (*Client) Query

func (c *Client) Query(v url.Values) ([]byte, error)

type DataValueObj

type DataValueObj struct {
	Value json.RawMessage `json:"value"`
	Type  string          `json:"type"`
}

type Entity

type Entity struct {
	Pageid       int                    `json:"pageid"`
	Ns           int                    `json:"ns"`
	Title        string                 `json:"title"`
	Lastrevid    int                    `json:"lastrevid"`
	Modified     time.Time              `json:"modified"`
	Type         string                 `json:"type"`
	ID           string                 `json:"id"`
	Labels       map[string]StringValue `json:"labels"`
	Descriptions map[string]StringValue `json:"descriptions"`
	Aliases      map[string]AliasList   `json:"aliases"`
}

type EntityID

type EntityID struct {
	EntityType string `json:"entity-type"`
	NumericID  int    `json:"numeric-id"`
	ID         string `json:"id"`
}

type ImageClaim

type ImageClaim struct {
	Claims struct {
		P18 Claim `json:"P18"`
	} `json:"claims"`
}

type Property

type Property struct {
	Mainsnak   Snak        `json:"mainsnak"`
	Type       string      `json:"type"`
	ID         string      `json:"id"`
	Rank       string      `json:"rank"`
	References []Reference `json:"references"`
}

type Reference

type Reference struct {
	Hash       string          `json:"hash"`
	Snaks      map[string]Snak `json:"snaks"`
	SnaksOrder []string        `json:"snaks-order"`
}

type Snak

type Snak struct {
	Snaktype  string       `json:"snaktype"`
	Property  string       `json:"property"`
	DataValue DataValueObj `json:"datavalue"`
	Datatype  string       `json:"datatype"`
}

type StringValue

type StringValue struct {
	Language string `json:"language"`
	Value    string `json:"value"`
}

Jump to

Keyboard shortcuts

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