On Tue, Jul 28, 2009 at 13:15, Niclas Hedhman<[email protected]> wrote:
> Update on Named Query support;
>
> Since I received no feedback, I went ahead with the following approach;

Opps..

> Also, there is a NamedSparqlDescriptor class that implements the
> NamedQueryDescriptor, so that during bootstrap, one does something
> like this;
>
>    NamedQueries namedQueries = new NamedQueries();
>    namedQueries.add( "findPredatorsOfFlyingAnimals", new
> NamedSparqlDescriptor( "PREFIX ... SELECT DISTINCT.... WHERE { ... }"
> ) );
>    :
>    :
>    module.addServices( RdfQueryService.class ).setMetaInfo( namedQueries );

Few questions:
1. Is it possible for each qi4j module to add named queries.
    One use case would be, if the client doesn't require module A, all
named queries associated with module A will not be added.
2. Named query syntax validation. Can this be done during application
startup and if the application is in development mode?
3. Is it possible to do this without handwritten the query? e.g. Use
query builder API?
    e.g. we gained refactoring capabilities. Not error prone and
somewhat future proof, e.g. if we're not going for sparql in the
future.

> But for OrderBy, the story is much more complicated, and I have
> currently not reached a satisfactory solution. The problem is somewhat
> two fold;
>
> 1. The Query Runtime is pretty tightly tied into the Property model
> for picking the sort keys. I don't want to modify the Query (and half
> a dozen internal classes) to support "orderBy( String name )". The
> good news is that the templateFor() to obtain sorting properties are
> QueryBuilder agnostic, so that works.
>
> 2. But, since the query is handwritten, it is really(!) hard to figure
> out which Sparql 'variable' that a particular property refers to.

Agree. Perhaps we just have to leave this to the user.
if they supplied handwritten sparql, we can't be expected to know whether
they have done the required "join" to perform order by etcs.

> So since the code says that the order should be Ascending (the
> default), the DESC() declarations are changed to ASC() when the query
> is executed. BUT if the query.orderBy() sends in a directives of
> either other properties, or those in a different order, the wrong
> result will occur.

ok.

> The only other choice I can think of, is to not support orderBy
> changes in the Query at all.

Hmm.. no opinion for this.

Regards,
Edward Yakop

_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to