db4o Developer Community

db4o open source object database, native to Java and .NET
Welcome to db4o Developer Community Sign in | Join

Limitations of NQ? / restricting to a given type

  •  11-17-2006, 03:50 AM

    Limitations of NQ? / restricting to a given type

    Is there a document anywhere where current limitations of Native Queries are listed?

    My problem today is writing the NQ equivalent of this SODA:

               com.db4o.query.Query q = _dataSource.Data.Query();
    q.Constrain(typeof(LanguageForm));
    q.Descend("_form").Constrain("findme");
    q.Descend("_parent").Constrain(typeof(LexicalFormMultiText));

    My native query attempt is:
                return f.Form == "findme" && f.Parent.GetType() == typeof( LexicalFormMultiText) ;
    or
                return f.Form == "findme" && f.Parent is LexicalFormMultiText ;

    In other words, I only want matches where the parent is of a particular type.  These do not optimize in 5.5 (.net).

    Of course, I can just drop the second part of the conjunction and do that in code, after the query has run, but the more I do in the query, the less objects will be activated.

    (We're using this to limit results on queries like this that are "bottom-up"... find leaves which may be what you want, then, in normal code, walk back up to reduce it to just those leaves which came from the correct path through the object graph.  When fast querying through collections is implemented, this won't be necessary.) 

     I apologize if this has been discussed earlier. I see hints of the problem in other posts, but I couldn't find the answer.

    Filed under: ,
View Complete Thread