Data Graphs

Data Graphs — RDF graph sources for triples.

Synopsis

                    rasqal_data_graph;
rasqal_data_graph * rasqal_new_data_graph_from_data_graph
                                                        (rasqal_data_graph *dg);
rasqal_data_graph * rasqal_new_data_graph_from_iostream (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         raptor_uri *base_uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);
rasqal_data_graph * rasqal_new_data_graph_from_uri      (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);
void                rasqal_free_data_graph              (rasqal_data_graph *dg);
enum                rasqal_data_graph_flags;
int                 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 {
  rasqal_world* world;
  raptor_uri* uri;
  raptor_uri* name_uri;
  unsigned int flags;
  char* format_type;
  char* format_name;
  raptor_uri* format_uri;
  raptor_iostream* iostr;
  raptor_uri* base_uri;
  int usage;
} rasqal_data_graph;

A source of RDF data for querying.

If iostr is present, the graph can be constructed by parsing the iostream and using base_uri as a base uri. Otherwise the graph can be constructed from the graph at URI uri.

In either case the name_uri is the graph name as long as flags is RASQAL_DATA_GRAPH_NAMED

rasqal_world *world;

rasqal_world object

raptor_uri *uri;

source URI

raptor_uri *name_uri;

name of graph for RASQAL_DATA_GRAPH_NAMED

unsigned int flags;

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

char *format_type;

MIME Type of data format at uri (or NULL)

char *format_name;

Raptor parser Name of data format at uri (or NULL)

raptor_uri *format_uri;

URI of data format at uri (or NULL)

raptor_iostream *iostr;

Raptor iostream for content, overriding uri if present (or NULL)

raptor_uri *base_uri;

base URI for reading from iostream

int usage;

usage count of this object

rasqal_new_data_graph_from_data_graph ()

rasqal_data_graph * rasqal_new_data_graph_from_data_graph
                                                        (rasqal_data_graph *dg);

Copy Constructor - create a new rasqal_data_graph object from an existing rasqal_data_graph object.

dg :

rasqal_data_graph object to copy or NULL

Returns :

a new rasqal_data_graph object or NULL if dg was NULL.

rasqal_new_data_graph_from_iostream ()

rasqal_data_graph * rasqal_new_data_graph_from_iostream (rasqal_world *world,
                                                         raptor_iostream *iostr,
                                                         raptor_uri *base_uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);

Constructor - create a new rasqal_data_graph from iostream content

The name_uri is used when the flags are RASQAL_DATA_GRAPH_NAMED.

The base_uri is used to provide the Raptor parser a base URI. If a base URI is required but none is given, the parsing will fail and the query that uses this data source will fail.

world :

rasqal_world object

iostr :

source graph format iostream

base_uri :

base URI for iostream content

name_uri :

name of graph (or NULL)

flags :

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

format_type :

MIME Type of data format at uri (or NULL)

format_name :

Raptor parser Name of data format at uri (or NULL)

format_uri :

URI of data format at uri (or NULL)

Returns :

a new rasqal_data_graph or NULL on failure.

rasqal_new_data_graph_from_uri ()

rasqal_data_graph * rasqal_new_data_graph_from_uri      (rasqal_world *world,
                                                         raptor_uri *uri,
                                                         raptor_uri *name_uri,
                                                         unsigned int flags,
                                                         const char *format_type,
                                                         const char *format_name,
                                                         raptor_uri *format_uri);

Constructor - create a new rasqal_data_graph.

The name_uri is only used when the flags are RASQAL_DATA_GRAPH_NAMED.

world :

rasqal_world object

uri :

source URI

name_uri :

name of graph (or NULL)

flags :

RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND

format_type :

MIME Type of data format at uri (or NULL)

format_name :

Raptor parser Name of data format at uri (or NULL)

format_uri :

URI of data format at uri (or NULL)

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_new_data_graph_from_uri() and rasqal_new_data_graph_from_iostream(). 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 ()

int                 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

Returns :

non-0 on failure