freebase

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: BSD-3-Clause, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package freebase provides access to the Freebase Search.

See https://developers.google.com/freebase/

Usage example:

import "google.golang.org/api/freebase/v1"
...
freebaseService, err := freebase.New(oauthHttpClient)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReconcileCall

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

func (*ReconcileCall) Confidence

func (c *ReconcileCall) Confidence(confidence float64) *ReconcileCall

Confidence sets the optional parameter "confidence": Required confidence for a candidate to match. Must be between .5 and 1.0

func (*ReconcileCall) Context

func (c *ReconcileCall) Context(ctx context.Context) *ReconcileCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ReconcileCall) Do

func (c *ReconcileCall) Do() (*ReconcileGet, error)

Do executes the "freebase.reconcile" call. Exactly one of *ReconcileGet or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *ReconcileGet.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ReconcileCall) Fields

func (c *ReconcileCall) Fields(s ...googleapi.Field) *ReconcileCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ReconcileCall) IfNoneMatch

func (c *ReconcileCall) IfNoneMatch(entityTag string) *ReconcileCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*ReconcileCall) Kind

func (c *ReconcileCall) Kind(kind string) *ReconcileCall

Kind sets the optional parameter "kind": Classifications of entity e.g. type, category, title.

func (*ReconcileCall) Lang

func (c *ReconcileCall) Lang(lang string) *ReconcileCall

Lang sets the optional parameter "lang": Languages for names and values. First language is used for display. Default is 'en'.

func (*ReconcileCall) Limit

func (c *ReconcileCall) Limit(limit int64) *ReconcileCall

Limit sets the optional parameter "limit": Maximum number of candidates to return.

func (*ReconcileCall) Name

func (c *ReconcileCall) Name(name string) *ReconcileCall

Name sets the optional parameter "name": Name of entity.

func (*ReconcileCall) Prop

func (c *ReconcileCall) Prop(prop string) *ReconcileCall

Prop sets the optional parameter "prop": Property values for entity formatted as :

type ReconcileCandidate

type ReconcileCandidate struct {
	// Confidence: Percentage likelihood that this candidate is the unique
	// matching entity. Value will be between 0.0 and 1.0
	Confidence float64 `json:"confidence,omitempty"`

	// Lang: Language code that candidate and notable names are displayed
	// in.
	Lang string `json:"lang,omitempty"`

	// Mid: Freebase MID of candidate entity.
	Mid string `json:"mid,omitempty"`

	// Name: Freebase name of matching entity in specified language.
	Name string `json:"name,omitempty"`

	// Notable: Type or profession the candidate is notable for.
	Notable *ReconcileCandidateNotable `json:"notable,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Confidence") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

func (*ReconcileCandidate) MarshalJSON

func (s *ReconcileCandidate) MarshalJSON() ([]byte, error)

type ReconcileCandidateNotable

type ReconcileCandidateNotable struct {
	// Id: MID of notable category.
	Id string `json:"id,omitempty"`

	// Name: Name of notable category in specified language.
	Name string `json:"name,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Id") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

ReconcileCandidateNotable: Type or profession the candidate is notable for.

func (*ReconcileCandidateNotable) MarshalJSON

func (s *ReconcileCandidateNotable) MarshalJSON() ([]byte, error)

type ReconcileGet

type ReconcileGet struct {
	// Candidate: If filled, then the listed candidates are potential
	// matches, and such should be evaluated by a more discerning algorithm
	// or human. The matches are ordered by confidence.
	Candidate []*ReconcileCandidate `json:"candidate,omitempty"`

	// Costs: Server costs for reconciling.
	Costs *ReconcileGetCosts `json:"costs,omitempty"`

	// Match: If filled, this entity is guaranteed to match at requested
	// confidence probability (default 99%).
	Match *ReconcileCandidate `json:"match,omitempty"`

	// Warning: If filled, then there were recoverable problems that
	// affected the request. For example, some of the properties were
	// ignored because they either are not valid Freebase predicates or are
	// not indexed for reconciliation. The candidates returned should be
	// considered valid results, with the caveat that sections of the
	// request were ignored as specified by the warning text.
	Warning []*ReconcileGetWarning `json:"warning,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Candidate") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

func (*ReconcileGet) MarshalJSON

func (s *ReconcileGet) MarshalJSON() ([]byte, error)

type ReconcileGetCosts

type ReconcileGetCosts struct {
	// Hits: Total number of hits found.
	Hits int64 `json:"hits,omitempty"`

	// Ms: Total milliseconds spent.
	Ms int64 `json:"ms,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Hits") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

ReconcileGetCosts: Server costs for reconciling.

func (*ReconcileGetCosts) MarshalJSON

func (s *ReconcileGetCosts) MarshalJSON() ([]byte, error)

type ReconcileGetWarning

type ReconcileGetWarning struct {
	// Location: Location of warning in the request e.g. invalid predicate.
	Location string `json:"location,omitempty"`

	// Message: Warning message to display to the user.
	Message string `json:"message,omitempty"`

	// Reason: Code for identifying classes of warnings.
	Reason string `json:"reason,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Location") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

func (*ReconcileGetWarning) MarshalJSON

func (s *ReconcileGetWarning) MarshalJSON() ([]byte, error)

type SearchCall

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

func (*SearchCall) AsOfTime

func (c *SearchCall) AsOfTime(asOfTime string) *SearchCall

AsOfTime sets the optional parameter "as_of_time": A mql as_of_time value to use with mql_output queries.

func (*SearchCall) Callback

func (c *SearchCall) Callback(callback string) *SearchCall

Callback sets the optional parameter "callback": JS method name for JSONP callbacks.

func (*SearchCall) Context

func (c *SearchCall) Context(ctx context.Context) *SearchCall

Context sets the context to be used in this call's Do and Download methods. Any pending HTTP request will be aborted if the provided context is canceled.

func (*SearchCall) Cursor

func (c *SearchCall) Cursor(cursor int64) *SearchCall

Cursor sets the optional parameter "cursor": The cursor value to use for the next page of results.

func (*SearchCall) Do

func (c *SearchCall) Do() error

Do executes the "freebase.search" call.

func (*SearchCall) Domain

func (c *SearchCall) Domain(domain string) *SearchCall

Domain sets the optional parameter "domain": Restrict to topics with this Freebase domain id.

func (*SearchCall) Download

func (c *SearchCall) Download() (*http.Response, error)

Download fetches the API endpoint's "media" value, instead of the normal API response value. If the returned error is nil, the Response is guaranteed to have a 2xx status code. Callers must close the Response.Body as usual.

func (*SearchCall) Encode

func (c *SearchCall) Encode(encode string) *SearchCall

Encode sets the optional parameter "encode": The encoding of the response. You can use this parameter to enable html encoding.

Possible values:

"html" - Encode certain characters in the response (such as tags

and ambersands) using html encoding.

"off" (default) - No encoding of the response. You should not print

the results directly on an web page without html-escaping the content first.

func (*SearchCall) Exact

func (c *SearchCall) Exact(exact bool) *SearchCall

Exact sets the optional parameter "exact": Query on exact name and keys only.

func (*SearchCall) Fields

func (c *SearchCall) Fields(s ...googleapi.Field) *SearchCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*SearchCall) Filter

func (c *SearchCall) Filter(filter string) *SearchCall

Filter sets the optional parameter "filter": A filter to apply to the query.

func (*SearchCall) Format

func (c *SearchCall) Format(format string) *SearchCall

Format sets the optional parameter "format": Structural format of the json response.

Possible values:

"ac" - Compact format useful for autocomplete/suggest UIs.
"classic" - [DEPRECATED] Same format as was returned by

api.freebase.com.

"entity" (default) - Basic information about the entities.
"guids" - [DEPRECATED] Ordered list of a freebase guids.
"ids" - Ordered list of freebase ids.
"mids" - Ordered list of freebase mids.

func (*SearchCall) Help

func (c *SearchCall) Help(help string) *SearchCall

Help sets the optional parameter "help": The keyword to request help on.

Possible values:

"langs" - The language codes served by the service.
"mappings" - The property/path mappings supported by the filter and

output request parameters.

"predicates" - The predicates and path-terminating properties

supported by the filter and output request parameters.

func (*SearchCall) IfNoneMatch

func (c *SearchCall) IfNoneMatch(entityTag string) *SearchCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*SearchCall) Indent

func (c *SearchCall) Indent(indent bool) *SearchCall

Indent sets the optional parameter "indent": Whether to indent the json results or not.

func (*SearchCall) Lang

func (c *SearchCall) Lang(lang string) *SearchCall

Lang sets the optional parameter "lang": The code of the language to run the query with. Default is 'en'.

func (*SearchCall) Limit

func (c *SearchCall) Limit(limit int64) *SearchCall

Limit sets the optional parameter "limit": Maximum number of results to return.

func (*SearchCall) Mid

func (c *SearchCall) Mid(mid string) *SearchCall

Mid sets the optional parameter "mid": A mid to use instead of a query.

func (*SearchCall) MqlOutput

func (c *SearchCall) MqlOutput(mqlOutput string) *SearchCall

MqlOutput sets the optional parameter "mql_output": The MQL query to run againist the results to extract more data.

func (*SearchCall) Output

func (c *SearchCall) Output(output string) *SearchCall

Output sets the optional parameter "output": An output expression to request data from matches.

func (*SearchCall) Prefixed

func (c *SearchCall) Prefixed(prefixed bool) *SearchCall

Prefixed sets the optional parameter "prefixed": Prefix match against names and aliases.

func (*SearchCall) Query

func (c *SearchCall) Query(query string) *SearchCall

Query sets the optional parameter "query": Query term to search for.

func (*SearchCall) Scoring

func (c *SearchCall) Scoring(scoring string) *SearchCall

Scoring sets the optional parameter "scoring": Relevance scoring algorithm to use.

Possible values:

"entity" (default) - Use freebase and popularity entity ranking.
"freebase" - Use freebase entity ranking.
"schema" - Use schema ranking for properties and types.

func (*SearchCall) Spell

func (c *SearchCall) Spell(spell string) *SearchCall

Spell sets the optional parameter "spell": Request 'did you mean' suggestions

Possible values:

"always" - Request spelling suggestions for any query at least

three characters long.

"no_results" - Request spelling suggestions if no results were

found.

"no_spelling" (default) - Don't request spelling suggestions.

func (*SearchCall) Stemmed

func (c *SearchCall) Stemmed(stemmed bool) *SearchCall

Stemmed sets the optional parameter "stemmed": Query on stemmed names and aliases. May not be used with prefixed.

func (*SearchCall) Type

func (c *SearchCall) Type(type_ string) *SearchCall

Type sets the optional parameter "type": Restrict to topics with this Freebase type id.

func (*SearchCall) With

func (c *SearchCall) With(with string) *SearchCall

With sets the optional parameter "with": A rule to match against.

func (*SearchCall) Without

func (c *SearchCall) Without(without string) *SearchCall

Without sets the optional parameter "without": A rule to not match against.

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Service, error)

func (*Service) Reconcile

func (s *Service) Reconcile() *ReconcileCall

Reconcile: Reconcile entities to Freebase open data.

func (*Service) Search

func (s *Service) Search() *SearchCall

Search: Search Freebase open data.

Jump to

Keyboard shortcuts

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