Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

query about how oclPS works

1 view
Skip to first unread message

Philip

unread,
Aug 1, 2008, 9:33:34 AM8/1/08
to
I have a huge table which is too slow to query with OCL, so I have to
use oclPS to query it.

When using the oclPS does it only fetch the object ID's or does it
fetch the actual object?

I want to do multiple oclPS queries, but some of the objects I am
going to modify.

On my next oclPS query, would I get the modified object, or would I
only get the modified object if I do an updatedatabase before my next
oclPS query

thanks :)

Philip

unread,
Aug 1, 2008, 10:38:15 AM8/1/08
to
On Fri, 1 Aug 2008 15:32:15 +0100, "Peter Morris"
<mrpmo...@SPAMgmail.com> wrote:

>> When using the oclPS does it only fetch the object ID's or does it
>> fetch the actual object?
>

>ID's only (aka "ObjectLocators")


>
>
>> I want to do multiple oclPS queries, but some of the objects I am
>> going to modify.
>

>How big do you expect the result set to be after the first query?
>
>

Only 1 object

>> On my next oclPS query, would I get the modified object, or would I
>> only get the modified object if I do an updatedatabase before my next
>> oclPS query
>

>Yes.
>

Was that a yes to "i'll get the modified object" or a yes to "i'll
only get the modified object if i run updatedatabase before the
query"?

>
>
>Pete

Peter Morris

unread,
Aug 1, 2008, 10:32:15 AM8/1/08
to
> When using the oclPS does it only fetch the object ID's or does it
> fetch the actual object?

ID's only (aka "ObjectLocators")


> I want to do multiple oclPS queries, but some of the objects I am
> going to modify.

How big do you expect the result set to be after the first query?


> On my next oclPS query, would I get the modified object, or would I
> only get the modified object if I do an updatedatabase before my next
> oclPS query

Yes.

Pete

Dmitriy Nagirnyak

unread,
Aug 2, 2008, 7:42:23 AM8/2/08
to
Hello Philip,

> I want to do multiple oclPS queries, but some of the objects I am
> going to modify.
>

You can do as many InPS queries as you need. You can modify objects between
InPs queries.
ECO will respect modified objects and all the following InPs queries will
return you actual objects, even if they are modified and not yet stored in
DB.

Cheers,
Dmitriy.


Philip

unread,
Aug 2, 2008, 7:48:39 AM8/2/08
to
unfortunatly I just stupidly realised that my select is dependant on a
field that I modify, so I do have to update the database or my select
returns the wrong data.

damn :)

Peter Morris

unread,
Aug 2, 2008, 8:15:50 AM8/2/08
to
From an example I just wrote for the new EcoServices document.... (age is a
derived attribute so cannot be evaluated in the DB)

//Execute the query to load object locators into memory
string psCriteria =
"Person.allInstances" +
"->select(firstName.sqlLikeCaseInsensitive('Pete%'))";
EcoSpace.OclPs.Execute(psCriteria);

//Now evaluate only on objects already loaded
string memoryCriteria =
"Person.allLoadedObjects" +
"->select(firstName.sqlLikeCaseInsensitive('Pete%'))" +
"->select(age >= 18)";
IElement people = EcoSpace.Ocl.Evaluate(memoryCriteria);


Is this of any use? Can you show your OCL expressions?

Pete

Philip

unread,
Aug 2, 2008, 8:42:27 AM8/2/08
to
In my case the sort is on a field that I modify, and I only want the
first result so im stuck :)

But thank for for the help - always learning around here!

Peter Morris

unread,
Aug 2, 2008, 11:28:06 AM8/2/08
to
Show the OCL!

Peter Morris

unread,
Aug 2, 2008, 12:07:08 PM8/2/08
to
This you can evaluate in memory, because either way you are fetching all
instances of Dog.

If however you are doing something like this

Dog.allInstances->select(type = #Dalmation)->orderBy(toys)

Then you could first evaluate in OclPs and then in IOclService by replacing
"allInstances" with "allLoadedObjects". If you want the dog with the least
number of toys then....

EcoSpace.OclPs.Execute(null, null, ocl, 0, 1); //selects the first item
according to the DB
ocl = ocl.Replace("allInstances", "allLoadedObjects") + "->first";
Dog d = EcoSpace.Ocl.Evaluate(ocl).GetValue<Dog>();

Any good? If not then you may need to be more specific :-)

Pete

Philip

unread,
Aug 2, 2008, 12:03:00 PM8/2/08
to
On Sat, 2 Aug 2008 16:28:06 +0100, "Peter Morris"
<mrpmo...@SPAMgmail.com> wrote:

>Show the OCL!


PS -> Dog.allinstances->orderby(Toys)

Dog.Toys:=Dog.toys+1

I've just changed toys...

so my next oclPS which needs to sort by toys will be inaccurate unless
i update the database...

0 new messages