Rasqal RDF Query Library Manual | ||||
---|---|---|---|---|
Top | Description |
typedef rasqal_query_results_formatter; enum rasqal_query_results_format_flags; int rasqal_query_results_formats_check (rasqal_world *world
,const char *name
,raptor_uri *uri
,const char *mime_type
,int flags
); int rasqal_query_results_formats_check2 (rasqal_world *world
,const char *name
,raptor_uri *uri
,const char *mime_type
,int flags
); rasqal_query_results_formatter * rasqal_new_query_results_formatter (rasqal_world *world
,const char *name
,const char *mime_type
,raptor_uri *format_uri
); rasqal_query_results_formatter * rasqal_new_query_results_formatter_for_content (rasqal_world *world
,raptor_uri *uri
,const char *mime_type
,const char *buffer
,size_t len
,const unsigned char *identifier
); void rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter
); int rasqal_query_results_formatter_read (rasqal_world *world
,raptor_iostream *iostr
,rasqal_query_results_formatter *formatter
,rasqal_query_results *results
,raptor_uri *base_uri
); int rasqal_query_results_formatter_write (raptor_iostream *iostr
,rasqal_query_results_formatter *formatter
,rasqal_query_results *results
,raptor_uri *base_uri
);
Variable bindings and boolean query results can be formatted into different syntaxes such as SPARQL Query Results Format or JSON. The rasqal_query_results_formatter class allows choosing a formatter for a particular syntax and writing the syntax to a raptor_iostream which allows turning the syntax into a string, writing to a file handle or other custom destination.
rasqal_graph_query_results_formatter* query_results_formatter;
Rasqal query results formatter class.
typedef enum { RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER = 1, RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER = 2 } rasqal_query_results_format_flags;
Bitflags for rasqal_query_results_formats_check()
to find formats with features.
int rasqal_query_results_formats_check (rasqal_world *world
,const char *name
,raptor_uri *uri
,const char *mime_type
,int flags
);
Check if a query results formatter exists for the requested format.
Deprecated
: use rasqal_query_results_formats_check2()
since the
implementation of this function returned an inverted boolean result.
|
rasqal_world object |
|
the query results format name (or NULL) |
|
raptor_uri query results format uri (or NULL) |
|
mime type name |
|
bitmask of flags to signify that format is needed for reading (RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER ) |
Returns : |
0 if a formatter exists. |
int rasqal_query_results_formats_check2 (rasqal_world *world
,const char *name
,raptor_uri *uri
,const char *mime_type
,int flags
);
Check if a query results formatter exists for the requested format.
|
rasqal_world object |
|
the query results format name (or NULL) |
|
raptor_uri query results format uri (or NULL) |
|
mime type name |
|
bitmask of flags to signify that format is needed for reading (RASQAL_QUERY_RESULTS_FORMAT_FLAG_READER ) or writing ( RASQAL_QUERY_RESULTS_FORMAT_FLAG_WRITER ) |
Returns : |
non-0 if a formatter exists. |
rasqal_query_results_formatter * rasqal_new_query_results_formatter (rasqal_world *world
,const char *name
,const char *mime_type
,raptor_uri *format_uri
);
Constructor - create a new rasqal_query_results_formatter for an identified format.
A query results format can be found by name, mime type or URI, all of which are optional. If multiple fields are given, the first match is given that matches the name, URI, mime_type in that order. The default query results format will be used if all are format identifying fields are NULL.
See rasqal_world_get_query_results_format_description()
for
obtaining the supported format URIs at run time.
|
rasqal_world object |
|
the query results format name (or NULL) |
|
the query results format mime type (or NULL) |
|
raptor_uri query results format uri (or NULL) |
Returns : |
a new rasqal_query_results_formatter object or NULL on failure |
rasqal_query_results_formatter * rasqal_new_query_results_formatter_for_content (rasqal_world *world
,raptor_uri *uri
,const char *mime_type
,const char *buffer
,size_t len
,const unsigned char *identifier
);
Constructor - create a new queryresults formatter for an identified format.
Uses rasqal_world_guess_query_results_format_name()
to find a
query results formatter by scoring recognition of the syntax by a
block of characters, the content identifier or a mime type. The
content identifier is typically a filename or URI or some other
identifier.
|
world object |
|
URI identifying the syntax (or NULL) |
|
mime type identifying the content (or NULL) |
|
buffer of content to guess (or NULL) |
|
length of buffer |
|
identifier of content (or NULL) |
Returns : |
a new rasqal_query_results_formatter object or NULL on failure |
void rasqal_free_query_results_formatter (rasqal_query_results_formatter *formatter
);
Destructor - destroy a rasqal_query_results_formatter object.
|
rasqal_query_results_formatter object |
int rasqal_query_results_formatter_read (rasqal_world *world
,raptor_iostream *iostr
,rasqal_query_results_formatter *formatter
,rasqal_query_results *results
,raptor_uri *base_uri
);
Read the query results using the given formatter from an iostream
See rasqal_world_get_query_results_format_description()
for
obtaining the supported format URIs at run time.
|
rasqal world object |
|
raptor_iostream to read the query from |
|
rasqal_query_results_formatter object |
|
rasqal_query_results query results format |
|
raptor_uri base URI of the input format |
Returns : |
non-0 on failure |
int rasqal_query_results_formatter_write (raptor_iostream *iostr
,rasqal_query_results_formatter *formatter
,rasqal_query_results *results
,raptor_uri *base_uri
);
Write the query results using the given formatter to an iostream
Note that after calling this method, the query results will be
empty and rasqal_query_results_finished()
will return true (non-0)
See rasqal_world_get_query_results_format_description()
for
obtaining the supported format URIs at run time.
|
raptor_iostream to write the query to |
|
rasqal_query_results_formatter object |
|
rasqal_query_results query results format |
|
raptor_uri base URI of the output format (or NULL) |
Returns : |
non-0 on failure |