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 :)
>> 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
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
> 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.
damn :)
//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
But thank for for the help - always learning around here!
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
>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...