## Data Graphs

Data Graphs — RDF graph sources for triples.

## Synopsis

                        rasqal_data_graph;
    rasqal_data_graph*  rasqal_new_data_graph               (raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);
    void                rasqal_free_data_graph              (rasqal_data_graph *dg);
    enum                rasqal_data_graph_flags;
    void                rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                             FILE *fh);

## Description

Data graphs are used in the query to describe RDF graphs that can be used to query against. The graphs can be used either with raptor_uri to name the graph, or without a name. The query language determines which graphs are used in the query.

## Details

### rasqal_data_graph

    typedef struct {
      raptor_uri* uri;
      raptor_uri* name_uri;
      int flags;
    } rasqal_data_graph;

A source of RDF data for querying.

The uri is the original source (base URI) of the content. It may also have an additional name `name_uri` as long as `flags` is `RASQAL_DATA_NAMED`

raptor_uri *`uri`; | source URI
raptor_uri *`name_uri`; | name of graph for `RASQAL_DATA_NAMED`
int `flags`; | `RASQAL_DATA_GRAPH_NAMED` or `RASQAL_DATA_GRAPH_BACKGROUND`

### rasqal_new_data_graph ()

    rasqal_data_graph*  rasqal_new_data_graph               (raptor_uri *uri,
                                                             raptor_uri *name_uri,
                                                             int flags);

Constructor - create a new rasqal_data_graph.

The name_uri is only used when the flags are `RASQAL_DATA_GRAPH_NAMED`.

`uri` : | source URI
`name_uri` : | name of graph (or NULL)
`flags` : | `RASQAL_DATA_GRAPH_NAMED` or `RASQAL_DATA_GRAPH_BACKGROUND`
Returns : | a new rasqal_data_graph or NULL on failure.

### rasqal_free_data_graph ()

    void                rasqal_free_data_graph              (rasqal_data_graph *dg);

Destructor - destroy a rasqal_data_graph object.

`dg` : | rasqal_data_graph object

### enum rasqal_data_graph_flags

    typedef enum {
      RASQAL_DATA_GRAPH_NONE  = 0,
      RASQAL_DATA_GRAPH_NAMED = 1,
      RASQAL_DATA_GRAPH_BACKGROUND = 2,
    } rasqal_data_graph_flags;

Flags for the type of rasqal_data_graph.

These are used by `rasqal_query_add_data_graph()`. See rasqal_data_graph.

`RASQAL_DATA_GRAPH_NONE` | Internal.
`RASQAL_DATA_GRAPH_NAMED` | Graphs with a source and name.
`RASQAL_DATA_GRAPH_BACKGROUND` | Graphs with a source only.

### rasqal_data_graph_print ()

    void                rasqal_data_graph_print             (rasqal_data_graph *dg,
                                                             FILE *fh);

Print a Rasqal data graph in a debug format.

The print debug format may change in any release.

`dg` : | rasqal_data_graph object
`fh` : | the FILE* handle to print to