GDataFreebaseService

GDataFreebaseService — GData Freebase service object

Stability Level

Stable, unless otherwise indicated

Properties

gchar * developer-key Read / Write / Construct Only

Object Hierarchy

    GObject
    ╰── GDataService
        ╰── GDataFreebaseService

Includes

#include <gdata/services/freebase/gdata-freebase-service.h>

Description

GDataFreebaseService is a subclass of GDataService for communicating with the Google Freebase API. It supports queries in MQL format, that allows highly flexible queries on any topic. MQL is a JSON based query language, MQL requests consist of a mix of defined and empty values for types in the Freebase schema, those "placeholder" values will be filled in on the reply. For more information and examples, see the MQL overview page.

For more details of Google Freebase API, see the online documentation.

Functions

gdata_freebase_service_new ()

GDataFreebaseService *
gdata_freebase_service_new (const gchar *developer_key,
                            GDataAuthorizer *authorizer);

Creates a new GDataFreebaseService using the given GDataAuthorizer. If authorizer is NULL, all requests are made as an unauthenticated user. Having both developer_key and authorizer set to NULL is allowed, but this should be reserved for debugging situations, as there is a certain key-less quota for those purposes. If this service is used on any code intended to be deployed, one or both of developer_key and authorizer should be non-NULL and valid.

Parameters

developer_key

developer key to use the API, or NULL.

[allow-none]

authorizer

a GDataAuthorizer to authorize the service's requests, or NULL.

[allow-none]

Returns

a new GDataFreebaseService; unref with g_object_unref().

[transfer full]

Since 0.15.1


gdata_freebase_service_get_primary_authorization_domain ()

GDataAuthorizationDomain *
gdata_freebase_service_get_primary_authorization_domain
                               (void);

The primary GDataAuthorizationDomain for interacting with Freebase. This will not normally need to be used, as it's used internally by the GDataFreebaseService methods. However, if using the plain GDataService methods to implement custom queries or requests which libgdata does not support natively, then this domain may be needed to authorize the requests.

The domain never changes, and is interned so that pointer comparison can be used to differentiate it from other authorization domains.

Returns

the service's authorization domain.

[transfer none]

Since 0.9.0


gdata_freebase_service_query ()

GDataFreebaseResult *
gdata_freebase_service_query (GDataFreebaseService *self,
                              GDataFreebaseQuery *query,
                              GCancellable *cancellable,
                              GError **error);

Performs a MQL query on the service, you can find out more about MQL in the online MQL documentation.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseQuery with the MQL query

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

error

a GError, or NULL.

[allow-none]

Returns

a GDataFreebaseResult containing the query result; unref with g_object_unref().

[transfer full]

Since 0.15.1


gdata_freebase_service_query_async ()

void
gdata_freebase_service_query_async (GDataFreebaseService *self,
                                    GDataFreebaseQuery *query,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Performs a MQL query on the service. self and query are all reffed when this function is called, so can safely be unreffed after this function returns. When the query is replied, or fails, callback will be executed, and the result can be obtained through gdata_service_query_single_entry_finish().

For more details, see gdata_freebase_service_query(), which is the synchronous version of this function.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseQuery with the MQL query

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when authentication is finished

 

user_data

data to pass to the callback function.

[closure]

Since 0.15.1


gdata_freebase_service_get_topic ()

GDataFreebaseTopicResult *
gdata_freebase_service_get_topic (GDataFreebaseService *self,
                                  GDataFreebaseTopicQuery *query,
                                  GCancellable *cancellable,
                                  GError **error);

Queries information about a topic, identified through a Freebase ID. You can find out more about topic queries in the

online documentation.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseTopicQuery containing the topic ID

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

error

a GError, or NULL.

[allow-none]

Returns

a GDataFreebaseTopicResult containing information about the topic; unref with g_object_unref().

[transfer full]

Since 0.15.1


gdata_freebase_service_get_topic_async ()

void
gdata_freebase_service_get_topic_async
                               (GDataFreebaseService *self,
                                GDataFreebaseTopicQuery *query,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Queries information about a topic, identified through a Freebase ID. self and query are all reffed when this function is called, so can safely be unreffed after this function returns. When the query is replied, or fails, callback will be executed, and the result can be obtained through gdata_service_query_single_entry_finish().

For more details, see gdata_freebase_service_get_topic(), which is the synchronous version of this function.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseQuery with the MQL query

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when authentication is finished

 

user_data

data to pass to the callback function.

[closure]

Since 0.15.1


gdata_freebase_service_search ()

GDataFreebaseSearchResult *
gdata_freebase_service_search (GDataFreebaseService *self,
                               GDataFreebaseSearchQuery *query,
                               GCancellable *cancellable,
                               GError **error);

Performs a search for any given search term, filters can be set on query to narrow down the results. The results returned are ordered by relevance. You can find out more about topic queries in the

online documentation.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseSearchQuery containing the topic ID

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

error

a GError, or NULL.

[allow-none]

Returns

a GDataFreebaseSearchResult containing the results for the given search query; unref with g_object_unref().

[transfer full]

Since 0.15.1


gdata_freebase_service_search_async ()

void
gdata_freebase_service_search_async (GDataFreebaseService *self,
                                     GDataFreebaseSearchQuery *query,
                                     GCancellable *cancellable,
                                     GAsyncReadyCallback callback,
                                     gpointer user_data);

Performs a search for any given search term. self and query are all reffed when this function is called, so can safely be unreffed after this function returns.

For more details, see gdata_freebase_service_search(), which is the synchronous version of this function.

Parameters

self

a GDataFreebaseService

 

query

a GDataFreebaseQuery with the MQL query

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

callback

a GAsyncReadyCallback to call when authentication is finished

 

user_data

data to pass to the callback function.

[closure]

Since 0.15.1


gdata_freebase_service_get_image ()

GInputStream *
gdata_freebase_service_get_image (GDataFreebaseService *self,
                                  GDataFreebaseTopicValue *value,
                                  GCancellable *cancellable,
                                  guint max_width,
                                  guint max_height,
                                  GError **error);

Creates an input stream to an image object returned in a topic query. If max_width and max_height are unspecified (i.e. set to 0), the image returned will be the smallest available.

Parameters

self

a GDataFreebaseService

 

value

a GDataFreebaseTopicValue from a topic result

 

cancellable

optional GCancellable object, or NULL.

[allow-none]

max_width

maximum width of the image returned, or 0

 

max_height

maximum height of the image returned, or 0

 

error

a GError, or NULL.

[allow-none]

Returns

a GInputStream opened to the image; unref with g_object_unref().

[transfer full]

Since 0.15.1

Types and Values

GDataFreebaseService

typedef struct _GDataFreebaseService GDataFreebaseService;

All the fields in the GDataFreebaseService structure are private and should never be accessed directly.

Since 0.15.1


GDataFreebaseServiceClass

typedef struct {
} GDataFreebaseServiceClass;

All the fields in the GDataFreebaseServiceClass structure are private and should never be accessed directly.

Since 0.15.1

Property Details

The “developer-key” property

  “developer-key”            gchar *

The developer key your application has registered with the Freebase API. For more information, see the online documentation.

Flags: Read / Write / Construct Only

Default value: NULL

Since 0.15.1