Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cme-dev] Filtering query results

Hi Philip,
   I tried this out already and yes this does work as expected.
Thanks a lot anyway.

Regards 
Santosh

On Apr 5, 2005 11:39 PM, Philip Quitslund <pq@xxxxxxxxxx> wrote:
> Hi Santosh,
> 
>  >     What I am trying to do programatically is equivalent to running a
>  > query  like "class V*"
>  > and then adding all the obtained results to a new concern and then running
>  > a query like "call( * *(..))" on this concern.
> 
> I think the rub is that you need to take your results and explicitly add them to
> a concern *as well as* to the concern space:
> 
>      //create a concern
>      Concern vClasses = new ConcernImpl("vClasses",
>          IntensionalOrExtensionalGroup.GroupKind.INTENSIONAL, _space);
>      Pattern query = new PantherPatternImpl("class V*");
>      vClasses.setSpecificationDefinition(query);
>      //add it to the space
>      vClasses.addToContextForIntensionalSpecificationEvaluation(_space);
>      vClasses.evaluate(new UninterruptibleMonitor());
> 
> If I'm right, then having done this you can limit the scope of a query to your
> concern like this:
> 
>      QueryContext context = new QueryContextImpl();
>      context.setInputCollection(_space);
> 
>      Pattern allCallsinVClasses = new PantherPatternImpl("in(concern vClasses)
>          && call ( * *(..))");
>      context.setQuery(allCallsinVClasses);
>      Searchable result = context.evaluateQuery(new UninterruptibleMonitor());
> 
> Let me know if this helps...  I'm just trying to figure this all out myself!
> 
> -phil
> 
> 
> Santhosh Adiga wrote:
> > Hi all,
> >   I have been trying to explore the programmatic
> > support of CME. I went through the sample project
> > given in the CME demos folder, as given there
> > to run a query on the input concern model we do
> > something like this
> >
> >
> >>>>>// Indicate that the colleciton to be searched is to be the entire
> >
> > concern space.
> >
> >>>>>   context.setInputCollection(_space);
> >>>>>     // Set up the query itself, in the Panther query language.
> >>>>>           Pattern query = new PantherPatternImpl("class V*");
> >>>>>           context.setQuery(query);
> >
> >
> >>>>>           // Execute the query.
> >>>>>   SearchableRead result = context.evaluateQuery(new
> >
> > UninterruptibleMonitor());
> >
> >
> >            Now if I want to filter out the query results further, for
> > example running the
> > query "call ( * *(..))" on the query results obtained earlier how do I
> > do it?  I tried setting
> > the query context's input collection to hold the query result,  but
> > doing so would detach
> > the  original universal concern space, and is not giving me any results.
> >
> >
> >     What I am trying to do programatically is equivalent to running a
> > query  like "class V*"
> > and then adding all the obtained results to a new concern and then running
> > a query like "call( * *(..))" on this concern.
> >
> >    Any help on this will be greatly appreciated.
> >
> > Thanks and Regards
> > Santhosh.
> > _______________________________________________
> > cme-dev mailing list
> > cme-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/cme-dev
> >
> _______________________________________________
> cme-dev mailing list
> cme-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cme-dev
> 


-- 
If there is but a thin line seperating a fool and a genius, then I
must be the fool who crossed it


Back to the top