[Mulgara-general] Mulgara as embedded engine

Paul Gearon gearon at ieee.org
Fri Dec 14 02:29:48 UTC 2007


On Dec 13, 2007, at 6:16 PM, Peter Becker wrote:
>> I'll confess that I've never liked the paradigm of inlining query
>> strings in my source code (it's bad enough in Java, but in C it
>> positively gives me nightmares).  I sometimes think that the last 20
>> years of frameworks have been little more than a series of attempts  
>> to
>> separate the query code out of the source.  :-)
>
> Yes, and I hate it :-) The last large project I worked on used  
> Struts and
> Hibernate and it is a pure PITA. You have to know at least 7 different
> languages to start with (Java, HTML, CSS, JS, SQL, Ant, Struts  
> config), plus
> the Hibernate annotations and possibly project-specific stuff (we  
> had an
> internal dialog machine used on top of Struts). And things are  
> fragile -- you
> change something here and seemingly magically it breaks somewhere  
> else. It
> all makes sense after half an hour of debugging, but not straight  
> away.
>
> What I would like to see is one conceptual model that is expressive  
> enough to
> handle all you need, unfortunately I haven't seen anything like that  
> yet. You
> can do a lot with Java+Annotations, but somehow annotations are  
> quite scary,
> too :-( Better than strings in your code or external XML files,  
> though.

There's always the option of building your query manually.  :-)

This might sound strange, but it provides a completely Java way of  
doing things.  I've done it myself, and I know Andrae does it too.   
It's not all that difficult, though it's not really documented  
(following code samples is really the way to learn to do this).  It  
was never intended as an API, but when you need to generate a query in  
code, then it actually makes sense.

The other way to do this is to build a TQL generating library.  I've  
also done this in the past.  I'd love to open source it, but it was  
commercial code.  :-(  Writing this kind of thing was time consuming,  
but makes debugging much easier.  Funnily enough, the API ended up  
being almost identical to the API for building queries directly.  :-)

Either way, you end up using an API that lets you build your query  
from scratch using purely Java code.  You just need to understand that  
constraints select a pattern for triples, and how to combine them  
using conjunctions (AND) and disjunctions (OR).

Paul



More information about the Mulgara-general mailing list