Service

## Service Service — Execute queries remotely via a SPARQL HTTP Protocol service. |

## Synopsis

    typedef             rasqal_service;
    rasqal_service *    rasqal_new_service                  (rasqal_world *world,
                                                             raptor_uri *service_uri,
                                                             const unsigned char *query_string,
                                                             raptor_sequence *data_graphs);
    void                rasqal_free_service                 (rasqal_service *svc);
    rasqal_query_results * rasqal_service_execute           (rasqal_service *svc);
    int                 rasqal_service_set_format           (rasqal_service *svc,
                                                             const char *format);
    int                 rasqal_service_set_www              (rasqal_service *svc,
                                                             raptor_www *www);

## Description

The SPARQL Protocol defines an HTTP binding that enables remote queries to be executed over specified default and named graphs. This class allows that to be constructed and executed, returning a Rasqal query results rasqal_query_results that may be used, for example, with a formatter to generate output.

## Details

### rasqal_service

    typedef struct rasqal_service_s rasqal_service;

Rasqal SPARQL Protocol Service

### rasqal_new_service ()

    rasqal_service *    rasqal_new_service                  (rasqal_world *world,
                                                             raptor_uri *service_uri,
                                                             const unsigned char *query_string,
                                                             raptor_sequence *data_graphs);

Constructor - create a new rasqal protocol service object.

Create a structure to execute a sparql protocol service at `service_uri` running the query `query_string` and returning a sparql result set.

All arguments are copied by the service object

`world` : | rasqal_world object
`service_uri` : | sparql protocol service URI
`query_string` : | query string (or NULL)
`data_graphs` : | sequence of rasqal_data_graph graphs for service
Returns : | a new rasqal_query object or NULL on failure

### rasqal_free_service ()

    void                rasqal_free_service                 (rasqal_service *svc);

Destructor - destroy a rasqal_service object.

`svc` : | rasqal_service object

### rasqal_service_execute ()

    rasqal_query_results * rasqal_service_execute           (rasqal_service *svc);

Execute a rasqal sparql protocol service

`svc` : | rasqal service
Returns : | query results or NULL on failure

### rasqal_service_set_format ()

    int                 rasqal_service_set_format           (rasqal_service *svc,
                                                             const char *format);

Set the MIME Type to use in HTTP Accept when executing the service

`svc` : | rasqal_service service object
`format` : | service mime type (or NULL)
Returns : | non 0 on failure

### rasqal_service_set_www ()

    int                 rasqal_service_set_www              (rasqal_service *svc,
                                                             raptor_www *www);

Set the WWW object to use when executing the service

`svc` : | rasqal_service service object
`www` : | WWW object (or NULL)
Returns : | non 0 on failure