man librasqal (Fonctions bibliothèques) - Rasqal RDF query library
NAME
librasqal - Rasqal RDF query library
SYNOPSIS
#include <rasqal.h>
rasqal_init();
rasqal_query_results *results;
raptor_uri *base_uri=raptor_new_uri(http://example.org/foo);
rasqal_query *rq=rasqal_new_query(rdql,NULL);
const char *query_string=select * from <http://example.org/data.rdf>;
rasqal_query_prepare(rq,query_string,base_uri);
results=rasqal_query_execute(rq);
while(!rasqal_query_results_finished(results)) {
for(i=0;i<rasqal_query_results_get_bindings_count(results);i++) {
const char *name=rasqal_query_results_get_binding_name(results,i);
rasqal_literal *value=rasqal_query_results_get_binding_value(results,i);
/* ... */
}
rasqal_query_results_next(results);
}
rasqal_free_query_results(results);
rasqal_free_query(rq);
raptor_free_uri(base_uri);
rasqal_finish();
cc `rasqal-config --cflags` file.c `rasqal-config --libs`
DESCRIPTION
The Rasqal library provides a high-level interface to RDF query parsing, query construction and query execution over an RDF graph. The library provides APIs to each of the steps in the process and provides support for handling multiple query language syntaxes. At present Rasqal supports RDQL and the draft W3C SPARQL query languages.
Rasqal uses the libraptor(3) library for providing URI handling, WWW content retrieval and other support functions.
LIBRARY INITIALISATION AND CLEANUP
- rasqal_init()
- rasqal_finish()
- Initialise and cleanup the library. These must be called before any Rasqal class is created or used.
LIBRARY FUNCTIONS
These functions provide general library features not associated to any particular class.
- int rasqal_languages_enumerate(const unsigned int counter, const char **name, const char **label, const unsigned char **uri_string)
- Return the name, label, uri_string (all optional) for a query language with a given integer counter, returning non-zero if no such query language at that offset exists. The counter should start from 0 and be incremented by 1 until the function returns non-zero.
- int rasqal_language_name_check(const char *name)
- Check name is a known query language name.
QUERY CONSTRUCTOR
- rasqal_query* rasqal_new_query(const char *name, const unsigned char *uri)
- Create a new rasqal query object for the query syntax with name name. Currently "rdql" for the RDF Data Query Language and "sparql" for the SPARQL query language are recognised. A language may alternatively be identified by a URI uri. If name and uri are both NULL the default query language is selected, currently "sparql".
QUERY DESTRUCTOR
- void rasqal_free_query(rasqal_query* query)
- Destroy a rasqal query object.
QUERY METHODS
- const char* rasqal_query_get_name(rasqal_query* query)
- Get the query language name.
- const char* rasqal_query_get_label(rasqal_query* query)
- Get the query language human readable label.
- void rasqal_query_set_fatal_error_handler(rasqal_query* query, void *user_data, raptor_message_handler handler)
- Set the fatal error handler callback.
- void rasqal_query_set_error_handler(rasqal_query* query, void *user_data, raptor_message_handler handler)
- Set the error handler callback.
- void rasqal_query_set_warning_handler(rasqal_query* query, void *user_data, raptor_message_handler handler)
- Set the warning handler callback.
- void rasqal_query_set_feature(rasqal_query* query, rasqal_feature feature, int value)
- Set a query feature feature to a particular value. Returns non 0 on failure or if the feature is unknown. No current features are defined.
- int rasqal_query_get_distinct(rasqal_query* query)
- Get the query distinct results flag, returning non-0 if the results should be distinct.
- void rasqal_query_set_distinct(rasqal_query* query, int distinct)
- Set the query distinct results flag.
- int rasqal_query_get_limit(rasqal_query* query)
- Get the query-specified limit on results returning >= 0 if a limit is given, otherwise not specified.
- void rasqal_query_set_limit(rasqal_query* query, int limit)
- Set the query results limit. No more than limit results will be returned.
- int rasqal_query_get_offset(rasqal_query* query)
- Get the query-specified offset on results returning >= 0 if a offset is given, otherwise not specified.
- void rasqal_query_set_offset(rasqal_query* query, int offset)
- Set the query results offset. The first offset results will be not be returned.
- void rasqal_query_add_variable(rasqal_query* query, rasqal_variable* var)
- Add a variable binding to the sequence of bindings in the query.
- raptor_sequence* rasqal_query_get_bound_variable_sequence(rasqal_query* query)
- Get the sequence of variables that are returning bindings in the query such as when explicitly chosen via SELECT in RDQL or SPARQL or all variables mentioned with SELECT *.
- raptor_sequence* rasqal_query_get_all_variable_sequence(rasqal_query* query)
- Get the sequence of all variables mentioned in the query.
- rasqal_variable* rasqal_query_get_variable(rasqal_query* query, int idx)
- Get one variable binding in the sequence of variable bindings in the query.
- int rasqal_query_has_variable(rasqal_query* query, const unsigned char *name)
- Return non-0 if the named variable is in the variable bindings of the query.
- int rasqal_query_set_variable(rasqal_query* query, const unsigned char *name, rasqal_literal* value)
- Set the query variable name to a literal value (the variable must already be in the sequence of variable bindings).
- raptor_sequence* rasqal_query_get_triple_sequence(rasqal_query* query)
- Get the sequence of triples to match in the query.
- rasqal_triple* rasqal_query_get_triple(rasqal_query* query, int idx)
- Get one triple in the sequences of triples to match in the query.
- void rasqal_query_add_prefix(rasqal_query* query, rasqal_prefix* prefix)
- Add one namespace prefix/URI to the sequence of prefixes in the query.
- raptor_sequence* rasqal_query_get_prefix_sequence(rasqal_query* query)
- Get the sequence of prefixes in the query.
- rasqal_prefix* rasqal_query_get_prefix(rasqal_query* query, int idx)
- Get one prefix in the sequence of prefixes in the query at index idx.
- raptor_sequence* rasqal_query_get_graph_pattern_sequence(rasqal_query* query)
- Get the sequence of graph patterns expressions in the query.
- rasqal_graph_pattern* rasqal_query_get_graph_pattern(rasqal_query* query, int idx)
- Get a graph pattern in the sequence of graph_pattern expressions in the query.
- void rasqal_query_print(rasqal_query* query, FILE* stream)
- Print a query in a debug format. This format may change in any release.
- int rasqal_query_prepare(rasqal_query* query, const unsigned char *query_string, raptor_uri *base_uri)
- Prepare a query string query_stringwith optional base URI uri_string for execution, parsing it and modifying the rasqal_query internals. Return non-0 on failure.
- rasqal_query_results* rasqal_query_execute(rasqal_query* query)
- Execute a query, returning a rasqal_query_results* object or NULL on failure.
- void rasqal_query_set_user_data(rasqal_query* query, void *user_data)
- Set some user data to be associated with the query.
- void* rasqal_query_get_user_data(rasqal_query* query)
- Get the user data associated with the query.
- int rasqal_query_add_data_graph(rasqal_query* query, raptor_uri* uri, raptor_uri* name_uri, int flags)
- Add a data graph to the query's data sources, constructing a new data graph object with URI uri, optional name URI name_uri and flags. See rasqal_new_data_graph for a description of the argumetns.
- raptor_sequence* rasqal_query_get_data_graph_sequence(rasqal_query* query)
- Get the sequence of data graphs in the query.
- rasqal_data_graph* rasqal_query_get_data_graph(rasqal_query* query, int idx)
- Get one prefix in the sequence of prefixes in the query at index idx.
- raptor_sequence* rasqal_query_get_order_conditions_sequence(rasqal_query* query)
- Get the sequence of all result ordering conditions in the query, each of which is a rasqal_expression.
- rasqal_expression* rasqal_query_get_order_condition(rasqal_query* query, int idx)
- Get one result ordering condition expression in the sequence.
- rasqal_query_verb rasqal_query_get_verb(rasqal_query* query)
- Get the main query verb.
- int rasqal_query_get_wildcard(rasqal_query* query)
- Get the query verb wildcard flag signifying * in RDQL and SPARQL after the query verb.
- rasqal_graph_pattern* rasqal_query_get_query_graph_pattern(rasqal_query* query)
- Get the top query graph pattern of query.
- void rasqal_query_set_default_generate_bnodeid_parameters(rasqal_query* rdf_query, char* prefix, int base)
- Control the default method for generation of IDs for blank nodes. The method uses a short string prefix and an integer base to generate the identifier which is not guaranteed to be a strict concatenation. If prefix is NULL, the default is used. If base is less than 1, it is initialised to 1.
- void rasqal_query_set_generate_bnodeid_handler(rasqal_query* query, void* user_data, rasqal_generate_bnodeid_handler handler)
- Allow full customisation of the generated IDs by setting a callback handler and associated user_data that is called whenever a blank node or bag identifier is required. The memory returned is deallocated inside rasqal. Some systems require this to be allocated inside the same library, in which case the rasqal_alloc_memory function may be useful.
- rasqal_query_verb_as_string(rasqal_query_verb verb)
- Get a string for the query verb.
- raptor_sequence* rasqal_query_get_construct_triples_sequence(rasqal_query* query)
- Get the sequence of triples for a construct.
- rasqal_triple* rasqal_query_get_construct_triple(rasqal_query* query, int idx)
- Get a triple in the sequence of construct triples.
GRAPH PATTERN CLASS
A class for graph patterns in a query - a set of triple patterns) with flags and possible sub-graph patterns
GRAPH PATTERN CONSTRUCTOR
There is no public constructor for this class, it is constructed when the query is prepared from a syntax. The query methods rasqal_query_get_graph_pattern_sequence and rasqal_query_get_graph_pattern provide access to the top-level graph patterns in a query.
- rasqal_triple* rasqal_graph_pattern_get_triple(rasqal_graph_pattern* graph_pattern, int idx)
- Get a rasqal_triple inside a graph pattern at index idx returning NULL when the index is out of range.
- void rasqal_graph_pattern_add_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, rasqal_graph_pattern* sub_graph_pattern)
- Add a sub-graph pattern sub_graph_pattern to the sequence of sub-graph patterns inside the graph pattern.
- raptor_sequence* rasqal_graph_pattern_get_sub_graph_pattern_sequence(rasqal_graph_pattern* graph_pattern)
- Get the sequence of sub-graph patterns inside the graph pattern returning NULL if there are no sub-graph patterns.
- rasqal_graph_pattern* rasqal_graph_pattern_get_sub_graph_pattern(rasqal_graph_pattern* graph_pattern, int idx)
- Get a sub-graph pattern inside the graph pattern at index idx returning NULL when the index is out of range.
- rasqal_graph_pattern_operator rasqal_graph_pattern_get_operator(rasqal_graph_pattern* graph_pattern)
- Get the graph pattern operator to determine how the graph pattern should be interpreted.
- int rasqal_graph_pattern_get_flags(rasqal_graph_pattern* graph_pattern)
- Deprecated. Use rasqal_graph_pattern_get_operator instead.
- int rasqal_graph_pattern_add_constraint(rasqal_graph_pattern* gp, rasqal_expression* expr)
- Add a constraint expression expr to the sequence of constraints in the graph pattern.
- raptor_sequence* rasqal_graph_pattern_get_constraint_sequence(rasqal_graph_pattern* gp)
- Get the sequence of constraints in the graph pattern.
- rasqal_expression* rasqal_graph_pattern_get_constraint(rasqal_graph_pattern* gp, int idx)
- Get one constraint expression in the sequences of constraint to match in the graph pattern at index idx.
- void rasqal_graph_pattern_print(rasqal_graph_pattern* graph_pattern, FILE* fh)
- Print a graph pattern in a debug format. This format may change in any release.
- const char* rasqal_graph_pattern_operator_as_string(rasqal_graph_pattern_operator op)
- Utility function to get a graph pattern operator as a string.
QUERY RESULTS CLASS
A class for the results of a query. The results can be in different formats - variable bindings, RDF graphs as a sequence of triples or a boolean result. The format returned is determined by the query which is query-language specific.
QUERY RESULTS CONSTRUCTOR
There is no public constructor for this class, the rasqal_query_results* is returned from rasqal_query_execute.
QUERY RESULTS DESTRUCTOR
- rasqal_free_query_results(rasqal_query_results *query_results)
- Destroy a rasqal query results object.
QUERY RESULTS METHODS
- int rasqal_query_results_is_bindings(rasqal_query_results *query_results)
- int rasqal_query_results_is_boolean(rasqal_query_results *query_results)
- int rasqal_query_results_is_graph(rasqal_query_results *query_results)
- Return non-0 if the rasqal_query_results is of the given format. Only one of these will be non-0 for any result.
- int rasqal_query_results_write(raptor_iostream *iostr, rasqal_query_results *results, raptor_uri *format_uri, raptor_uri *base_uri)
- Write the query results in a syntax to the iostr iostream, the format of the syntax is given by the format_uri URI, with an optional base URI base_uri that may be used. The values of format_uri currently supported are the URIs http://www.w3.org/TR/2005/WD-rdf-sparql-XMLres-20050527/ and http://www.w3.org/2001/sw/DataAccess/rf1/result2 for the second version of the SPARQL XML results format and the URIs http://www.w3.org/TR/2004/WD-rdf-sparql-XMLres-20041221/ and http://www.w3.org/2001/sw/DataAccess/rf1/result for the first version (do not use long term).
QUERY VARIABLE BINDINGS RESULTS METHODS
- int rasqal_query_results_get_count(rasqal_query_results *query_result)
- Get the current number of variable bindings results returned. (Variable bindings results only)
- int rasqal_query_results_next(rasqal_query_results *query_results)
- Move to the next variable bindings result, returning non-0 on failure or results are exhausted. (Variable bindings results only)
- int rasqal_query_results_finished(rasqal_query_results *query_results)
- Find out if the variable binding results are exhausted, return non-0 if results are finished or the query failed. (Variable bindings results only)
- int rasqal_query_results_get_bindings(rasqal_query_results *query_results, const unsigned char ***names, rasqal_literal ***values)
- Get all variable binding names and values for the current result. If names is not NULL, it is set to the address of a shared array of names of the bindings (an output parameter). If values is not NULL, it is set to the address of a shared array of rasqal_literal* binding values. Note that both the names or values are shared and must not be freed by the caller. Returns non-0 if the assignment failed. (Variable bindings results only)
- rasqal_literal* rasqal_query_results_get_binding_value(rasqal_query_results *query_results, int offset)
- Get one variable binding literal value for the current result. Returns the value of the variable indexed in the sequence of variable bindings at position offset. (Variable bindings results only)
- const unsigned char* rasqal_query_results_get_binding_name(rasqal_query_results *query_results, int offset)
- Get the name of the variable indexed in the sequence of variable bindings at position offset. (Variable bindings results only)
- rasqal_literal* rasqal_query_results_get_binding_value_by_name(rasqal_query_results *query_results, const unsigned char *name)
- Get the value of the variable in the sequence of variable bindings named name or NULL if not known or unbound. (Variable bindings results only)
- int rasqal_query_results_get_bindings_count(rasqal_query_results *query_results)
- Get the number of bound variables in the variable bindings result or <0 on failure. (Variable bindings results only)
QUERY BOOLEAN RESULTS METHODS
- int rasqal_query_results_get_boolean(rasqal_query_results *query_results)
- Return the value of a boolean query result. This is meaningless if the query result is not a boolean. (Boolean result format only).
QUERY RDF GRAPH RESULTS METHODS
- raptor_statement* rasqal_query_results_get_triple(rasqal_query_results *query_results)
- Return the current triple in the RDF graph results or NULL at end of results or on failure. The returned raptor_statement is a shared pointer. (Graph results format only).
- int rasqal_query_results_next_triple(rasqal_query_results *query_results)
- Move to the next triple in the RDF graph results, returning non-0 at end of results or on failure. (Graph results format only).
LITERAL CLASS
A class for the values returned as parts of triples and in variable bindings. The rasqal_literal structure is public and defined in rasqal.h however note that some fields are used for different literal types in different ways. The types of literals are defined in the rasqal_literal_type enum.
LITERAL CONSTRUCTORS
There a several constructors for rasqal_literal to build them from simple types and existing rasqal_literal objects. NOTE: Any objects or strings passed into these constructors becomed owned by the literal object except where noted.
- rasqal_literal* rasqal_new_integer_literal(rasqal_literal_type type, int integer)
- Create a new integer literal of an integral type, either type RASQAL_LITERAL_INTEGER or RASQAL_LITERAL_BOOLEAN.
- rasqal_literal* rasqal_new_floating_literal(double f)
- Create a new floating literal from a f.
- rasqal_literal* rasqal_new_uri_literal(raptor_uri* uri)
- Create a new URI literal from a raptor_uri uri.
- rasqal_literal* rasqal_new_pattern_literal(const unsigned char *pattern, const char *flags)
- Create a new regular expression literal from regex pattern and flags.
- rasqal_literal* rasqal_new_string_literal(const unsigned char *string, const char *language, raptor_uri *datatype, const unsigned char *datatype_qname)
- Create a new Rasqal string literal. The datatype and datatype_qname parameters are alternatives; the QName is a datatype that cannot be resolved till later since the prefixes have not yet been declared or checked at the time this constructor is called.
- If the string literal is datatyped and of certain types recognised (currently xsd:decimal, xsd:double) it may be internally converted to a different literal type.
- rasqal_literal* rasqal_new_simple_literal(rasqal_literal_type type, const unsigned char *string)
- Create a new Rasqal simple literal of type RASQAL_LITERAL_BLANK or RASQAL_LITERAL_BLANK_QNAME.
- rasqal_literal* rasqal_new_boolean_literal(int value)
- Create a new Raqal boolean literal, where value is non-0 for true, 0 for false.
- rasqal_literal* rasqal_new_variable_literal(rasqal_variable* variable)
- Create a new Rasqal variable literal using an existing variable object.
LITERAL COPY CONSTRUCTOR
- rasqal_literal* rasqal_new_literal_from_literal(rasqal_literal* literal)
- Copy an existing literal object.
LITERAL DESTRUCTOR
- void rasqal_free_literal(rasqal_uri* literal)
- Destroy a rasqal literal object.
LITERAL METHODS
- void rasqal_literal_print(rasqal_literal* literal, FILE* fh)
- Print a literal in a debug format. This format may change in any release.
- rasqal_variable* rasqal_literal_as_variable(rasqal_literal* literal)
- Return a rasqal literal as a variable, if it is one, otherwise return NULL.
- const unsigned char* rasqal_literal_as_string(rasqal_literal* literal)
- Return a rasqal literal as a string value. This always succeeds.
- rasqal_literal* rasqal_literal_as_node(rasqal_literal* literal)
- Return a new rasqal literal into one suitable for a node in an RDF triple or binding - as a URI, literal string (or datatyped) or blank node. The returned literal is owned by the caller and must be freed by rasqal_free_literal.
- int rasqal_literal_compare(rasqal_literal* literal1, rasqal_literal* literal2, int flags, int* error)
- Compare two literals with type promotion across their range. If the types are not the same, they are promoted. If one is a floating, the other is promoted to floating, otherwise for integers, otherwise as strings (all literals have a string value).
- flags affects string comparisons and if the RASQAL_COMPARE_NOCASE bit is set, a case independent comparison is made.
- The return value is comparable to strcmp(3), first before second returns <0. equal returns 0, and first after second returns >0. If there is no ordering, such as for URIs, the return value is 0 for equal, non-0 for different (using raptor_uri_equals).
- int rasqal_literal_equals(rasqal_literal* literal1, rasqal_literal* literal2)
- Compare two literals with no type promotion If literal2's value is a boolean, it will match the string "true" or "false" in literal1.
TRIPLE CLASS
A class for triples of three literals, used for matching triples in a query where the literals may be variables as well as in then interface between Rasqal and RDF systems using RDF triples, when the literals may not be literals. The structure of this class is public and defined in rasqal.h
TRIPLE CONSTRUCTOR
- rasqal_triple* rasqal_new_triple(rasqal_literal* subject, rasqal_literal* predicate, rasqal_literal* object)
- Create a new rasqal triple from three literals.
TRIPLE COPY CONSTRUCTOR
- rasqal_triple* rasqal_new_triple_from_triple(rasqal_triple* triple)
- Copy an existing rasqal triple object.
TRIPLE DESTRUCTOR
- void rasqal_free_triple(rasqal_triple* triple)
- Destroy a rasqal triple object.
TRIPLE METHODS
- void rasqal_triple_print(rasqal_triple* triple, FILE* fh)
- Print a triple in a debug format. This format may change in any release.
- void rasqal_triple_set_origin(rasqal_triple* triple, rasqal_literal *literal)
- Set the origin rasqal_literal of the triple, typically a URI literal.
- rasqal_literal* rasqal_triple_get_origin(rasqal_triple* triple)
- Get the origin rasqal_literal of the triple.
- void rasqal_triple_set_flags(rasqal_triple* triple, unsigned int flags)
- DEPRECATED in rasqal 0.9.9+. Do not use.
- unsigned int rasqal_triple_get_flags(rasqal_triple* triple)
- DEPRECATED in rasqal 0.9.9+. Do not use.
VARIABLE CLASS
A class for variable name and literal used to capture a variable with optional value binding such as returned as query results by various methods. The structure of this class is public and defined in rasqal.h
VARIABLE CONSTRUCTOR
- rasqal_variable* rasqal_new_variable(rasqal_query* query, const unsigned char *name, rasqal_literal* value)
- Create a new rasqal variable scoped to a Rasqal query, with required name and optional rasqal_literal value. This creates a variable of type RASQAL_VARIABLE_TYPE_NORMAL.
- rasqal_variable* rasqal_new_variable_typed(rasqal_query* rq, rasqal_variable_type type, const unsigned char *name, rasqal_literal* value)
- Create a new rasqal variable scoped to a Rasqal query, with required name, optional rasqal_literal value and type type either RASQAL_VARIABLE_TYPE_NORMAL or RASQAL_VARIABLE_TYPE_ANONYMOUS
VARIABLE DESTRUCTOR
- void rasqal_free_variable(rasqal_variable* variable)
- Destroy a rasqal variable object.
VARIABLE METHODS
- void rasqal_variable_print(rasqal_variable* variable, FILE* fh)
- Print a variable in a debug format. This format may change in any release.
- void rasqal_variable_set_value(rasqal_variable* variable, rasqal_literal* literal)
- Set the value of a rasqal variable to an rasqal_literal value, freeing any current value. The new literal may be NULL.
PREFIX CLASS
A class for namespace name/URI prefix association used to shorten URIs in some query languages using XML-style QNames. The structure of this class is public and defined in rasqal.h
PREFIX CONSTRUCTOR
- rasqal_prefix* rasqal_new_prefix(const unsigned char* prefix, raptor_uri* uri)
- Create a new namespace prefix with the given short prefix and URI uri.
PREFIX DESTRUCTOR
- void rasqal_free_prefix(rasqal_prefix* prefix)
- Destroy a rasqal prefix object.
- void rasqal_prefix_print(rasqal_prefix* prefix, FILE* fh)
- Print a prefix in a debug format. This format may change in any release.
EXPRESSION CLASS
A class for constraint expressions over literals and variables. The expression operators are defined in rasqal.h as enum rasqal_op and take one, two or more complex parameters.
EXPRESSION CONSTRUCTORS
- rasqal_expression* rasqal_new_1op_expression(rasqal_op op, rasqal_expression* arg)
- Create a new expression with a 1-argument operator.
- rasqal_expression* rasqal_new_2op_expression(rasqal_op op, rasqal_expression* arg1, rasqal_expression* arg2)
- Create a new expression with a 2-argument operator.
- rasqal_expression* rasqal_new_string_op_expression(rasqal_op op, rasqal_expression* arg1, rasqal_literal* literal)
- Create a new expression with a 2-argument operator, the second of which is a literal string.
- rasqal_expression* rasqal_new_literal_expression(rasqal_literal* literal)
- Create a new expression over an existing rasqal literal.
- rasqal_expression* rasqal_new_variable_expression(rasqal_variable* variable)
- Create a new expression over an existing rasqal variable.
- rasqal_expression* rasqal_new_function_expression(raptor_uri* name, raptor_sequence* args)
- Create a new expression for a function named name and with sequence of rasqal_literal* arguments args.
- rasqal_expression* rasqal_new_cast_expression(raptor_uri* name, rasqal_expression* value)
- Create a new expression for a casting of value to a datatype with URI name.
EXPRESSION DESTRUCTOR
- void rasqal_free_expression(rasqal_expression* expression)
- Destroy a rasqal expression object.
EXPRESSION METHODS
- void rasqal_expression_print_op(rasqal_expression* expression, FILE* fh)
- Print an expression operator in a debug format. This format may change in any release.
- void rasqal_expression_print(rasqal_expression* expression, FILE* fh)
- Print an expression in a debug format. This format may change in any release.
- rasqal_literal* rasqal_expression_evaluate(rasqal_query* query, rasqal_expression* expression)
- Evalute an expression, returning a rasqal boolean with the result or NULL on failure.
- int rasqal_expression_foreach(rasqal_expression* expression, rasqal_expression_foreach_fn fn, void *user_data)
- Apply the function fn recursively over the expression and it's sub-expressions. The order is the first expression at hand and then the arguments, if any. function fn is called at each point with the arguments of user_data and the expression.
DATA GRAPH CLASS
A class for graph data sources to query over from a source URI with an optional name URI.
DATA GRAPH CONSTRUCTOR
- rasqal_data_graph* rasqal_new_data_graph(raptor_uri* uri, raptor_uri* name_uri, int flags)
- Create a new data graph with source URI uri and optional name URI name_uri. Flags can be RASQAL_DATA_GRAPH_NONE, RASQAL_DATA_GRAPH_NAMED or RASQAL_DATA_GRAPH_BACKGROUND.
DATA GRAPH DESTRUCTOR
- void rasqal_free_data_graph(rasqal_data_graph* dg)
- Destroy a rasqal data_graph object.
- void rasqal_data_graph_print(rasqal_data_graph* dg, FILE* fh)
- Print a data graph in a debug format. This format may change in any release.
API CHANGES
0.9.10
Added an rasqal_graph_pattern_operator enumerated type. with the following (useful) values: RASQAL_GRAPH_PATTERN_OPERATOR_BASIC (for triple patterns), RASQAL_GRAPH_PATTERN_OPERATOR_OPTIONAL (for SPARQL OPTIONAL), RASQAL_GRAPH_PATTERN_OPERATOR_UNION, RASQAL_GRAPH_PATTERN_OPERATOR_GROUP and RASQAL_GRAPH_PATTERN_OPERATOR_GRAPH (for SPARQL GRAPH).
Added graph pattern method rasqal_graph_pattern_get_operator Deprecated rasqal_graph_pattern_get_flags replaced by the above. Added helper function rasqal_graph_pattern_operator_as_string.
Modified the type of the final argument of rasqal_new_graph_pattern_from_sequence and rasqal_graph_pattern_add_triples from an integer to a rasqal_graph_pattern_operator enumeration.
Removed documentation of removed functions deprecated in 0.9.9.
0.9.9
Added query methods rasqal_query_get_construct_triple, rasqal_query_get_construct_triples_sequence, rasqal_query_get_offset, rasqal_query_get_order_condition, rasqal_query_get_order_conditions_sequence, rasqal_query_get_query_graph_pattern, rasqal_query_get_verb, rasqal_query_get_wildcard. rasqal_query_set_default_generate_bnodeid_parameters, rasqal_query_set_distinct, rasqal_query_set_generate_bnodeid_handler, rasqal_query_set_limit and rasqal_query_set_offset.
Added expressions RASQAL_EXPR_ORDER_COND_ASC, RASQAL_EXPR_ORDER_COND_DESC and RASQAL_EXPR_ORDER_COND_NONE.
Added enum rasqal_variable_type for typing variables.
Added variable constructor rasqal_new_variable_typed to create typed variables.
Added enum rasqal_query_verb for the main query verbs with values RASQAL_QUERY_VERB_SELECT, RASQAL_QUERY_VERB_CONSTRUCT RASQAL_QUERY_VERB_DESCRIBE and RASQAL_QUERY_VERB_ASK.
Added rasqal_query_verb_as_string to get a strign for a query verb.
Deprecated the rasqal_triple flags field and the triple methods rasqal_triple_set_flags and rasqal_triple_get_flags.
0.9.8
Added a Data Graph class with constructor rasqal_new_data_graph, destructor rasqal_free_data_graph and debug method rasqal_data_graph_print.
Added casting expressions with type RASQAL_EXPR_CAST and expression constructor rasqal_new_cast_expression
Added a no-arg graph pattern constructor rasqal_new_graph_pattern
Added graph pattern methods rasqal_graph_pattern_add_triples to add triples to a graph pattern and rasqal_graph_pattern_add_sub_graph_pattern to add a sub-graph pattern to a graph pattern.
Added graph pattern methods rasqal_graph_pattern_add_constraint, rasqal_graph_pattern_get_constraint_sequence and rasqal_graph_pattern_get_constraint to add constraints to a graph pattern.
Added query methods for data graphs: rasqal_query_add_data_graph, rasqal_query_get_data_graph_sequence, rasqal_query_get_data_graph.
Deprecated query methods: rasqal_query_add_constraint, rasqal_query_get_constraint_sequence rasqal_query_get_constraint, rasqal_query_add_source, rasqal_query_get_source_sequence and rasqal_query_get_source.
Removed deprecated query methods: rasqal_query_get_variable_sequence and rasqal_query_add_triple.
0.9.7
Export rasqal_graph_pattern typedef for graph patterns and added access methods: rasqal_query_get_graph_pattern_sequence rasqal_query_get_graph_pattern, rasqal_graph_pattern_get_triple, rasqal_graph_pattern_get_sub_graph_pattern_sequence, rasqal_graph_pattern_get_sub_graph_pattern, rasqal_graph_pattern_get_flags and exported previously internal rasqal_graph_pattern_print Export rasqal_pattern_flags enum for graph pattern flags.
Added rasqal_query_get_bound_variable_sequence and rasqal_query_get_all_variable_sequence.
Deprecate rasqal_query_get_variable_sequence prefering rasqal_query_get_bound_variable_sequence
Added rasqal_query_get_distinct and rasqal_query_get_limit to get access to query flags.
Deleted RASQAL_EXPR_PATTERN which was never used.
0.9.6
Added new 1-argument expressions to the expression constructor; rasqal_op enum gained the following values: RASQAL_EXPR_LANG, RASQAL_EXPR_DATATYPE, RASQAL_EXPR_BOUND, RASQAL_EXPR_ISURI, RASQAL_EXPR_ISBLANK and RASQAL_EXPR_ISLITERAL
Added user-defined function expressions to the expression constructor: rasqal_op enum gained RASQAL_EXPR_FUNCTION value; rasqal_expression gained name and args fields and added rasqal_new_function_expression to construct a function expression.
Added rasqal_query_results_is_bindings, rasqal_query_results_is_boolean and rasqal_query_results_is_graph to test the format of query result.
Added rasqal_query_results_get_boolean to get the value of a boolean query result.
Added rasqal_query_results_get_triple and rasqal_query_results_next_triple to return an RDF graph query result.
Added rasqal_new_triple_from_triple triple copy constructor.
0.9.5
Added rasqal_query_results_write to format query results into a syntax, written to a raptor iostream.
Changed rasqal_new_floating_literal to take a double argument.
Added flags for triples with rasqal_triple_get_flags and rasqal_triple_set_flags to get and set them.
Added rasqal_triple_parts enum and updated the bind_match factory method of the rasqal_triples_match structure to take and return them.
Added a rasqal_triple_parts type field parts to the rasqal_triple_meta structure
0.9.4
No API changes.
0.9.3
The struct rasqal_prefix gained a declared field.
The struct rasqal_triple gained an origin field; not used at present but intended to support work on tracking triple provenance such as provided by Redland Contexts.
Added methods rasqal_triple_set_origin and rasqal_triple_get_origin to support the above.
struct rasqal_triple_meta now takes a 4-array of bindings, the fourth being the origin.
Exported function rasqal_set_triples_source_factory publically as intended.
0.9.2
Several functions changed their parameters or return values from char* to unsigned char* or const unsigned char* to reflect the actual use.
Changed to return a const unsigned char*:
rasqal_literal_as_string
Changed to take const unsigned char* (or add const):
rasqal_new_floating_literal
rasqal_new_pattern_literal
rasqal_new_prefix
rasqal_new_simple_literal
rasqal_new_string_literal
rasqal_new_variable
rasqal_query_has_variable
rasqal_query_results_get_binding_name
rasqal_query_results_get_binding_value_by_name
rasqal_query_results_get_bindings
rasqal_query_set_variable
0.9.1
Added the rasqal_query_results class and moved the results methods from rasqal_query.
Made rasqal_query_execute return a rasqal_query_result*.
Renamed all rasqal_query*result* methods to be rasqal_query_result_* Added rasqal_free_query_results to tidy up.
OLD API (0.9.0) NEW API (0.9.1+)
rasqal_query_get_result_count rasqal_query_results_get_count
rasqal_query_next_result rasqal_query_results_next
rasqal_query_results_finished rasqal_query_results_finished
rasqal_query_get_result_bindings rasqal_query_results_get_bindings
rasqal_query_get_result_binding_value rasqal_query_results_get_binding_value
rasqal_query_get_result_binding_name rasqal_query_results_get_binding_name
rasqal_query_get_result_binding_by_name rasqal_query_results_get_binding_value_by_name
rasqal_query_get_bindings_count rasqal_query_results_get_bindings_count
0.9.0
All new.
CONFORMING TO
RDQL - A Query Language for RDF, Andy Seaborne, W3C Member Submission 9 January 2004 http://www.w3.org/Submission/2004/SUBM-RDQL-20040109/
SPARQL Query Language for RDF, Eric Prud'hommeaux and Andy Seaborne (ed), W3C Working Draft, 17 February 2005. http://www.w3.org/TR/2005/WD-rdf-sparql-query-20050217/
SPARQL Variable Binding Results XML Format, Dave Beckett (ed), W3C Working Draft, 21 December 2004. http://www.w3.org/TR/2004/WD-rdf-sparql-XMLres-20041221/
SEE ALSO
roqet(1),rasqal-config(1)
AUTHOR
Dave Beckett -
http://purl.org/net/dajobe/
Institute for Learning and Research Technology (ILRT)
http://www.ilrt.bristol.ac.uk/
University of Bristol
http://www.bristol.ac.uk/