2007-04-22  Dave Beckett  <dave@dajobe.org>

	* Snapshotted rasqal_0_9_14 for 0.9.14 release (SVN 12127)

	* docs/librasqal.3: rasqal_query_get_explain

	* docs/librasqal.3: 0.9.14 from 6 months ago

	* autogen.sh: Update autogen.sh

	* rasqal.pc.in: Add Libs.private

	* src/rasqal-config.in, src/rasqal_engine.c, src/rasqal_literal.c,
	src/rasqal_query.c, src/rasqal_query_results.c,
	src/rasqal_raptor.c, utils/roqet.c: casts for C++

	* docs/tmpl/section-expression.sgml, docs/tmpl/section-query.sgml,
	docs/tmpl/section-query_results.sgml,
	docs/tmpl/section-query_results_formatter.sgml: docs

2007-04-21  Dave Beckett  <dave@dajobe.org>


	* src/rasqal.h: variable has @expression field.

	* src/rasqal_engine.c, src/rasqal_internal.h: Revert query engine
	back to 'working' optionals.  At least working as well as they did
	in the last release

	* src/rasqal.h: rasqal_expression has no variable

	* docs/tmpl/section-unused.sgml: expression no variable

	* docs/tmpl/section-query.sgml: rasqal_query_set_distinct

	* src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Make
	static, only used here.

	* src/sparql_parser.y: (SelectTerm): Renamed from
	SelectExpressionTerm
	(SelectExpression): Uses AggregateExpression or Expression.
	(AggregateExpression): Added, just using CountAggregateExpression.
	(CountAggregateExpression): Added for COUNT(expr) and COUNT(*)

	* tests/laqrs/syntax/Makefile.am, tests/laqrs/syntax/count1.rq,
	tests/laqrs/syntax/count2.rq, tests/laqrs/syntax/count3.rq,
	tests/laqrs/syntax/count4.rq: more COUNT tests

	* utils/roqet.c: Declare any query namespaces in the output
	serializer

	* utils/roqet.c: Allow -r to take a serializer argument.  Check it
	with raptor_serializer_syntax_name_check

	* tests/Makefile.am: No local_tests here for 6 months

	* tests/laqrs/Makefile.am, tests/laqrs/check-laqrs: remove
	check-laqrs

	* tests/laqrs/syntax/Makefile.am: renames

	* tests/laqrs/syntax/bad-select-expr.rq: comment

	* src/sparql_parser.y: (SelectExpressionTerm): Do not allow a
	select expression to contain the variable name it is named for.
	(SelectExpression): Tidy error returns.

	* src/rasqal_internal.h: Added rasqal_expression_mentions_variable
	prototype

	* src/rasqal_expr.c: (rasqal_expression_has_variable): Added.
	(rasqal_expression_mentions_variable): Added to check if an
	expression mentions a rasqal_variable.

	* src/rasqal.h: rasqal_expression does not need a rasqal_variable
	field.

	* tests/laqrs, tests/laqrs/Makefile.am, tests/laqrs/check-laqrs,
	tests/laqrs/syntax, tests/laqrs/syntax/Makefile.am,
	tests/laqrs/syntax/bad-select-expr.rq,
	tests/laqrs/syntax/bug156.rq, tests/laqrs/syntax/coverage.rq,
	tests/laqrs/syntax/data.n3, tests/laqrs/syntax/delete.rq,
	tests/laqrs/syntax/explain.rq: laqrs

	* src/sparql_parser.y: (SelectExpressionListTail): A list or a
	wildcard.
	(SelectExpressionListTail): Added to ensure select expression list
	is always 1 or more item.
	(SelectExpressionTerm): A variable ?var or a select expression
	assigned to a name
	(SelectExpression): Docs and forbid COUNT in sparql.

	* src/sparql_parser.y: Move '*' to SelectExpressionList from
	SelectQuery

	* src/sparql_parser.y: Add getopt() simple handling for -d and -i
	LANGUAGE for sparql and laqrs.

	* configure.ac: Added tests/laqrs/syntax/Makefile

	* configure.ac: add tests/laqrs/Makefile

	* tests/Makefile.am: Add laqrs sub dir

	* src/rdql_lexer.l: Allow '-' in language tags

	* src/sparql_lexer.l: Allow '-' in language tags
	Fixes Issue#0000182 http://bugs.librdf.org/mantis/view.php?id=182

	* src/sparql_lexer.l: Make <_:NAME> (an illegal URI) act like _:NAME.
	Fixes Issue#0000152 http://bugs.librdf.org/mantis/view.php?id=152

	* tests/sparql/syntax/Makefile.am,
	tests/sparql/syntax/blankuri.rq: added blankuri.rq

2007-04-15  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: (rasqal_engine_query_result_row_compare):
	Only do distinct=1 DISTINCT, no code for REDUCE yet.

	* src/rasqal_query_results.c:
	(rasqal_query_results_write_xml_result3): Allow for a potential
	new output argument reduced=true/false.  Not yet enabled.

	* src/rasqal_query.c: (rasqal_query_get_distinct): Rename arg to
	distinct_mode.
	(rasqal_query_set_distinct): Rename arg to distinct_mode and
	accept values 0, 1 and 2.
	(rasqal_query_print, rasqal_query_write_sparql_20060406): Print
	distinct or reduced.

2007-04-14  Dave Beckett  <dave@dajobe.org>

	* src/rasqal.h: Alter rasqal_query_set_distinct arg to be named
	distinct_mode (no API change)

	* src/rasqal_internal.h: (struct rasqal_query_s): distinct now
	takes 0, 1 or 2 to allow for REDUCED.

	* src/sparql_parser.y: Add REDUCED token
	(SelectQuery): Add REDUCED wherever DISTINCT can go

	* src/sparql_lexer.l: Add REDUCED keyword

	* tests/rdql/testsuite/check-rdql: add debug if RASQAL_DEBUG set

	* tests/sparql/check-sparql: hardcode turtle as input type add
	debug if RASQAL_DEBUG set

	* tests/rdql/testsuite/check-rdql: hardcode turtle as input type

2007-04-08  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c:
	(rasqal_engine_triple_graph_pattern_get_next_match): Fix revision
	with an exact match in a 1 TP query.

2007-03-25  Dave Beckett  <dave@dajobe.org>

	* utils/roqet.c: Print all informational and help messages to
	stderr.  Only results of querying and the help (-h/--help) message
	goes to stdout now.

2007-03-07  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: (rasqal_optional_graph_pattern_execute_init,
	rasqal_optional_graph_pattern_execute_bind): Restored.

2007-03-06  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: Removed rasqal_engine_gp_data unused fields
	optional_graph_pattern, optional_graph_pattern_matches_count,
	matches_returned Added rasqal_engine_gp_data field matches
	(rasqal_engine_triple_graph_pattern_get_next_match): Side effect
	return matches count.
	(rasqal_basic_graph_pattern_execute_bind): Count matches.
	(rasqal_group_graph_pattern_execute_init): Init start and current
	graph patterns.
	(rasqal_group_graph_pattern_execute_bind): Count matches, use
	start_graph_pattern for backtracing.
	(asqal_engine_graph_pattern_init): Merged
	rasqal_engine_graph_pattern_reset and
	rasqal_engine_graph_pattern_init
	(rasqal_engine_move_to_graph_pattern): Deleted.
	(rasqal_engine_execute_run_graph_pattern): Return step
	(rasqal_engine_execute_run): Use step and pass on counts.

	* src/rasqal_internal.h: removed new_bindings_count

2007-03-04  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: Add STEP_IGNORE to handle things such as
	empty group graph patterns that neither bind nor otherwise affect
	the results.  Restore rasqal_engine_step_names table.
	rasqal_engine_execute_gp_handler method execute_bind returns a
	rasqal_engine_step
	(rasqal_basic_graph_pattern_execute_bind): Return step. Still
	works.
	(rasqal_optional_graph_pattern_execute_bind): Return steps. Still
	untested.
	(rasqal_group_graph_pattern_execute_init): Added. Works.
	(rasqal_group_graph_pattern_execute_bind): Added. Works.
	(rasqal_engine_execute_run_graph_pattern): Convert from step to
	rc.  Testing state: src/ tests/rdql tests all work.

	* src/rasqal_query.c: Define RASQAL_NO_GP_MERGE to enable/disable
	empty graph merging

	* src/rasqal_engine.c: Remove
	rasqal_engine_group_graph_pattern_get_next_match

	* src/rasqal_engine.c: docs

	* src/rasqal_engine.c: Here we go.  Throughout replace "graph
	pattern POINTER" with "graph pattern INDEX"
	(rasqal_basic_graph_pattern_execute_init): Added, with code from
	rasqal_engine_graph_pattern_reset for triples.
	(rasqal_basic_graph_pattern_execute_bind): Added, with code from
	rasqal_engine_do_step for triples and calling
	rasqal_engine_triple_graph_pattern_get_next_match to do the triple
	pattern matching.  WORKS on a trivial example.
	(rasqal_optional_graph_pattern_execute_bind): Added, with code
	from rasqal_engine_do_optional_step. UNTESTED.
	rasqal_engine_execute_gp_handlers table does basic init/bind,
	optional bind.
	(rasqal_engine_graph_pattern_order): Removed.
	(rasqal_engine_graph_pattern_reset): Do less, moved into
	gp-specific init.
	(rasqal_engine_graph_pattern_init): Can return failure.
	(rasqal_engine_do_step, rasqal_engine_do_optional_step): Merged
	above.
	(rasqal_engine_store_query_results): Debug messages here.
	(rasqal_engine_execute_run_graph_pattern): Added to call the
	execute_bind handler method.
	(rasqal_engine_execute_run): Remove outer_gp and old code, use
	rasqal_engine_execute_run_graph_pattern to do the work.

	* src/rasqal_engine.c: struct rasqal_engine_gp_data gains matched,
	finished fields
	(rasqal_engine_graph_pattern_reset): Init matched, finished fields
	(rasqal_engine_graph_pattern_init): Remove sort.
	(rasqal_engine_do_step, rasqal_engine_do_optional_step,
	rasqal_engine_execute_run): use gp_data->matched, finished

	* src/rasqal_internal.h: struct rasqal_graph_pattern loses
	matched, finished fields

	* src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Lose
	finished field.

	* src/rasqal_engine.c: (rasqal_engine_execute_init): Remove hack
	to restructure top-level GP

	* src/rasqal_engine.c: typedef rasqal_engine_execute_gp_handler
	Added handler field to rasqal_engine_gp_data
	(rasqal_new_engine_gp_data): Error checking Added NULL
	rasqal_engine_execute_gp_handlers array.
	(rasqal_new_engine_execution_data): Init handler field.

	* src/rasqal_engine.c: Rename rasqal_new_engine_gp_data from
	rasqal_new_gp_data

	* src/rasqal_engine.c, src/rasqal_graph_pattern.c,
	src/rasqal_internal.h, src/rasqal_query.c: Docucomments.
	(rasqal_new_graph_pattern): Add op arg and use it.

	* src/rasqal_engine.c: Docs.  Use rasqal_query_results_reset call
	replacing rasqal_query_results_init

	* src/rasqal_query_results.c: (rasqal_query_results_reset) Renamed
	from rasqal_query_results_init

	* src/rasqal_internal.h: rasqal_query_results_reset renamed from
	rasqal_query_results_init

	* src/rasqal_query.c: (rasqal_query_execute): Handle failing to
	make query results object.

	* src/sparql_parser.y: Use
	rasqal_engine_new_basic_graph_pattern_from_formula.

	* src/rdql_parser.y: Use rasqal_new_basic_graph_pattern.

	* src/rasqal_engine.c:
	(rasqal_engine_new_basic_graph_pattern_from_formula): renamed from
	rasqal_engine_new_graph_pattern_from_formula
	Use rasqal_new_basic_graph_pattern.

	* src/rasqal_internal.h: Added rasqal_new_basic_graph_pattern
	renamed from rasqal_new_graph_pattern_from_triples.  Removed
	rasqal_graph_pattern_add_triples Added
	rasqal_engine_new_basic_graph_pattern_from_formula renamed from
	rasqal_engine_new_graph_pattern_from_formula

	* src/rasqal_graph_pattern.c: (rasqal_new_graph_pattern): Warning
	this is mostly internal and does not init all fields.
	(rasqal_new_basic_graph_pattern): Renamed from
	rasqal_new_graph_pattern_from_triples - API change.
	(rasqal_new_graph_pattern_from_sequence): Tidied.
	(rasqal_graph_pattern_add_triples): Removed - API change.

2007-02-27  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: (rasqal_engine_execute_run): Pull out
	invariants to top.

	* src/rasqal_engine.c: (rasqal_engine_execute_run): Tidy inlining more

	* src/rasqal_engine.c: (rasqal_engine_execute_run): Tidy inlining

2007-02-26  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_engine.c: (rasqal_engine_execute_run): Inline
	rasqal_engine_get_next_result into here.

	* src/rasqal_query_results.c: (rasqal_query_results_get_boolean):
	Remove rasqal_engine_get_next_result and use
	rasqal_engine_execute_run then look for sequence size.

	* src/rasqal_query.c: (rasqal_query_get_genid): one more byte

	* src/rasqal_engine.c, src/rasqal_internal.h: (rasqal_engine_run):
	Removed, never called

	* src/rasqal_engine.c: removed rasqal_engine_query_results_update

	* src/rasqal_engine.c: tidy

	* src/rasqal_engine.c,
	src/rasqal_internal.h: (rasqal_engine_store_query_results): Added.
	Store offset in rasqal_engine_execution_data

	* src/rasqal_engine.c, src/rasqal_internal.h, src/rasqal_query.c:
	Move rasqal_map inside rasqal_engine_execute_data

	* src/rasqal_engine.c: (rasqal_engine_execute_order): Do less work
	when not ordering or distinct, just store results in seq.

	* src/rasqal_engine.c: (rasqal_engine_execute_next): LAZY removal:
	Always use results in order_conditions_sequence.

	* src/rasqal_engine.c: (order_conditions_sequence): LAZY removal:
	Always store results in order_conditions_sequence.

	* docs/tmpl/section-query.sgml: new docs

2007-02-21  Dave Beckett  <dave@dajobe.org>

	* src/sparql_lexer.l: Added LAQRS DELETE and INSERT

	* src/sparql_parser.y: (DeleteQuery, InsertQuery): Added.

	* src/rasqal_query.c: Add rasqal_query_verb_labels labels for
	DELETE and INSERT.

	* src/rasqal_engine.c: (rasqal_engine_expand_wildcards):
	Handle switch RASQAL_QUERY_VERB_DELETE and RASQAL_QUERY_VERB_INSERT
	(rasqal_engine_assign_variables): Init size to 0

	* src/rasqal.h: Added LAQRS RASQAL_QUERY_VERB_DELETE and
	RASQAL_QUERY_VERB_INSERT

2007-02-17  Dave Beckett  <dave@dajobe.org>

	* utils/roqet.1: -r words

2007-02-09  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_raptor.c: rasqal_raptor_triples_source_user_data
	gains query field, source_uri field replacing list of URIs and
	mapped_id_base, mapped_id_base_len.
	(rasqal_raptor_generate_id_handler): Added, to either add the
	user_bnodeid to a graph-specific base, or to generate an ID
	otherwise.
	(rasqal_raptor_new_triples_source): Init uris each time, keep
	literals around till destruction.  Set the generated ID handler
	for raptor to rasqal_raptor_generate_id_handler.
	(rasqal_raptor_free_triples_source): Do not free URIs in list, or
	uris array.

	* src/rasqal_query.c: (rasqal_query_get_genid): Added simple genid
	generation from a single counter held in the query plus a given
	base.

	* src/rasqal_internal.h: Remove genid_bsae again

	* src/rasqal_internal.h: Added rasqal_query_get_genid

2007-02-08  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_query.c: (rasqal_query_write_sparql_graph_pattern):
	Write GRAPH parameter correctly in output.

2007-02-07  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_query_results.c: (rasqal_query_results_get_triple,
	rasqal_query_results_next_triple): Simplify and use
	rasqal_engine_execute_next to handle limit and offset.  This patch
	with the previous commits
	Fixes Issue#0000167 http://bugs.librdf.org/mantis/view.php?id=167

	* src/rasqal_engine.c: (rasqal_engine_assign_variables): Abstract
	from assigning variables just for a select, also assign them for a
	construct but put them in the variables_sequence.
	(rasqal_engine_get_next_result,
	rasqal_engine_query_result_row_update,
	rasqal_engine_new_query_result_row): Use size of variables from
	either variables_sequence for construct, otherwise
	select_variables_count.
	(rasqal_engine_query_result_row_update,
	rasqal_engine_new_query_result_row,
	rasqal_engine_query_results_update): Allow graph results to call
	this.
	(rasqal_engine_query_result_row_print): Work for construct too.
	(rasqal_engine_bind_construct_variables): Added, to substitute in
	variable bindings from a ordered query result row.
	(rasqal_engine_execute_order): Run
	rasqal_engine_bind_construct_variables after ordering.
	(rasqal_engine_execute_next): Run
	rasqal_engine_bind_construct_variables after getting next result.

	* src/rasqal_internal.h: docs - variables may be bound when
	constructs triples are present as well as when selects variables
	are around

	* src/rasqal_query_results.c: (rasqal_query_results_get_triple,
	rasqal_query_results_next_triple): Check limit when getting
	results for triples, such as SPARQL CONSTRUCT.  offset may work
	but not tested much.  Addresses issue
	http://bugs.librdf.org/mantis/view.php?id=167

2007-01-24  Dave Beckett  <dave@dajobe.org>

	* utils/roqet.c: (roqet_query_write_variable): Added.
	(roqet_query_walk): Use above to print out a variable with
	possible expression value.

	* configure.ac: Added LAQRS query language - maintainer only.

2007-01-23  Dave Beckett  <dave@dajobe.org>

	* src/sparql_parser.y: Added LAQRS tokens EXPLAIN GROUP COUNT AS
	protected by sparql->extended flag.
	(ExplainOpt): Added for optional EXPLAIN
	(SelectQuery): VarList is now a SelectExpressionList
	(SelectExpressionList): Can take SelectExpression AS VarName when
	extended.
	(SelectExpression): Added, to handle variables as well as
	COUNT(expr), COUNT(*) generating a VARSTAR expression.
	(GroupClauseOpt): Add GROUP BY to sorting.
	(Var): Takes a VarName.
	(rasqal_sparql_query_engine_init): Init extended flag based on
	language name.
	(rasqal_init_query_engine_laqrs): Added.

	* src/sparql_lexer.l: Added LAQRS keywords - EXPLAIN, GROUP,
	COUNT, AS New state SPID for variable names after AS

	* src/sparql_common.h: rasqal_sparql_query_engine_s gains SPARQL
	extended flag

	* src/rasqal_engine.c: (rasqal_query_build_declared_in): Do not
	warn if a variable expression is given.

	* src/rasqal_general.c: (rasqal_init): Init LAQRS if enabled.

	* src/rasqal_query.c: (rasqal_new_query, rasqal_free_query):
	Free/init new group_conditions_sequence sequence.
	(rasqal_query_get_explain, rasqal_query_set_explain): Added to
	get/set explain flag.
	(rasqal_query_print): Print explain flag, group conditions
	sequence.
	(rasqal_query_get_group_conditions_sequence,
	rasqal_query_get_group_condition): Added to get all or one group
	condition.
	(rasqal_query_write_sparql_variable): Modified to display variable
	expressions when present.
	(rasqal_sparql_op_labels): Add LAQRS labels.
	(rasqal_query_write_sparql_expression,
	rasqal_query_write_sparql_graph_pattern, ): Handle new LAQRS
	expressions, group condition sequences and query flags.

	* src/rasqal_expr.c: (rasqal_free_variable): Free new optional
	expression field.
	(rasqal_variable_print): Print new optional expression field.
	(rasqal_new_0op_expression): Added no-arg (constant) expression
	constructor.  Initially for RASQAL_EXPR_VARSTAR.
	(rasqal_new_1op_expression): Handle docs mentioning new 1-op
	expressions RASQAL_EXPR_GROUP_COND_ASC,
	RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_COUNT.
	(rasqal_expression_clear, rasqal_expression_visit,
	rasqal_expression_evaluate, rasqal_expression_print,
	rasqal_expression_is_constant): Handle new expressions above

	* src/rasqal.h: rasqal_variable gains expression field.  Added
	expression types RASQAL_EXPR_GROUP_COND_ASC,
	RASQAL_EXPR_GROUP_COND_DESC, RASQAL_EXPR_COUNT and
	RASQAL_EXPR_VARSTAR Added prototypes for query methods
	rasqal_query_get_explain, rasqal_query_set_explain,
	rasqal_query_get_group_conditions_sequence,
	rasqal_query_get_group_condition.  Added rasqal_new_0op_expression
	expression constructor with no arguments, a constant.

	* NEWS.html, configure.ac, src/win32_rasqal_config.h: Bumped
	version to 0.9.14

	* src/rasqal_query_results.c: (rasqal_query_results_write): Allow
	serializing of finished/empty results.

	* configure.ac: Fix GNU bison check again, using raptor style.

2007-01-22  Dave Beckett  <dave@dajobe.org>

	* configure.ac: make bison version check work on V1 version
	message format

2007-01-20  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_internal.h: Ensure  rasqal_strcasecmp and
	rasqal_strncasecmp get prototypes.
	Fixes Issue#0000160 http://bugs.librdf.org/mantis/view.php?id=160

2007-01-16  Dave Beckett  <dave@dajobe.org>

	* utils/roqet.c: 2007
	Use rasqal_license_string and rasqal_home_url_string
	Add some more rasqal_finish() before exit

	* src/rasqal.h: Added prototypes for rasqal_license_string and
	rasqal_home_url_string

	* src/rasqal_general.c: 2007
	Added rasqal_license_string and rasqal_home_url_string

2007-01-07  Dave Beckett  <dave@dajobe.org>

	* src/rasqal_query_results.c:
	(rasqal_query_results_format_register_factory):
	Gains mime_type arg.
	(rasqal_init_query_results): Add mime type to query result format
	registrations.
	(rasqal_query_results_is_bindings,
	rasqal_query_results_is_boolean, rasqal_query_results_is_graph):
	True only if no results formatter is specified.
	(rasqal_query_results_is_syntax): Added to check if a query result
	is a syntax.
	(rasqal_query_results_formats_enumerate_full): Added to return
	mime type also.
	(rasqal_get_query_results_formatter_factory): Add mime type arg.
	(rasqal_query_results_formats_check): Added to check if a
	formatter exists for the given name, uri and/or mime type.
	(rasqal_new_query_results_formatter_by_mime_type): Added to
	construct a formatter by mime type alone.
	(rasqal_query_results_formatter_get_mime_type): Added to get the
	mime type of a built formatter.

	* src/rasqal.h: Added prototypes for
	rasqal_query_results_is_syntax,
	rasqal_query_results_formats_enumerate_full,
	rasqal_query_results_formats_check,
	rasqal_new_query_results_formatter_by_mime_type and
	rasqal_query_results_formatter_get_mime_type.

	* src/rasqal_query.c: (rasqal_free_query): Free
	query_results_formatter_name if set.

	* src/rasqal_internal.h: struct rasqal_query_s gains
	query_results_formatter_name field

