On 19/09/14 05:18, Bruno P. Kinoshita wrote:
Hello Claude,
I didn't understand what QueryBuilder was supposed to do at first, or how to
use it. Luckily there are tests in the project, kudos for writing those, very
helpful. I liked the idea, and for users familiar with Java Jooq, PHP and Ruby
ActiveRecord that's definitely an intuitive API.
In order to test it, I first created some dummy data.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://example.org/>
INSERT DATA
{
:bruno foaf:name "Bruno" .
:jorge foaf:name "Jorge" .
:bruno :brotherOf :jorge
}
Then I retrieved the data with a simple SELECT.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX : <http://example.org/>
SELECT *
{
?a ?b ?c
}
---------------------------------
| a | b | c |
=================================
| :bruno | foaf:name | "Bruno" |
| :bruno | :brotherOf | :jorge |
| :jorge | foaf:name | "Jorge" |
---------------------------------
I tried to recreate the same query with QueryBuilder, but alas it didn't work.
I have probably made something really stupid [1]. My output is always:
PREFIX : <http://example.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WHERE
{ ?a ?b ?c . }
I just wanted to validate that I could recreate the same query with QueryBuilder. But I couldn't
figure how that works. Looking at WhereClauseTest, I thought that addVar("*") would
result in "SELECT *". The prefixes is not keeping the order it was added, thus that's
probably not an issue.
The SelectBuilder throws ParseException, which extends Exception. I think
**if** the Query Builder is supposed to be used by programmers for writing
their Web applications or similar, then perhaps it could extend a
RuntimeException?
Just my 0.002 cents
Thanks
Bruno
[1] https://gist.github.com/kinow/b50a5d3b875f2155b7bb
Ditto.
(I have just pushed a fix to Wherehandler.testTriple.)
Andy