Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [hyades-dev] saved statistical models

Hi Antony,

I see now where is the problem, whenever  you create an object you need to
make sure that is added to its container (this is an EMF rule, in order to
persist the model instance, any EMF object requires a container otherwise
should be a root in the resource, we have only one root in this case and
that one is TRCAgent), in SDContiguousObservation case the container is
SDSampleWindow (see "main" UML diagram in "statistical" package).

So you just need to add:

      observation.setWindow(sampleWindow);

    or

      sampleWindow.getObservations().add(observation);

I attached a simple test class as an example (it doesn't set all
non-containment associations).

Add this fragment to your plugin.xml in order to use this class (it is an
Eclipse application):

   <extension
         id="StatisticalInstanceModel"
         point="org.eclipse.core.runtime.applications">
      <application>
         <run
               class="model.tests.StatisticalInstanceModel">
         </run>
      </application>
   </extension>

and then Run as Run-time Workbench by setting the application name.

Thanks !
Marius Slavescu

Friday, August 08, 2003 10:10 AM
To: <hyades-dev@xxxxxxxxxxx>
cc:
From: "Antony Miguel" <antony.miguel@xxxxxxxxxxxxx>
Subject: [hyades-dev] saved statistical models



Thanks for this Marius,  I have the statistical model loading ok now but as
I suspected from looking at the file, the SDContiguousObservations are not
being saved.

Here's what I'm doing to attach the observations to the descriptors:

    SDCounterDescriptor descriptor = factory.createSDCounterDescriptor();
    descriptor.setName("mycounter");
    descriptor.setParent(root_descriptor);

    SDContiguousObservation observation =
    factory.createSDContiguousObservation();
    observation.setMemberDescriptor(descriptor);

    descriptor.getSnapshotObservation().add(observation);

I later add some data to the "times" and "values" lists in the observation.
I can traverse the entire model and the observations are definitely there
and hold data in the lists no problem but when I save and view/load the
model there seems to be no mention of them - only the descriptors.

Can anyone shed any light on this?

cheers

Antony Miguel

antony.miguel@xxxxxxxxxxxxx

----- Original Message -----
From: "Marius Slavescu" <slavescu@xxxxxxxxxx>
To: <hyades-dev@xxxxxxxxxxx>
Sent: Friday, August 08, 2003 2:13 PM
Subject: Re: [hyades-dev] saved statistical models


>
> Hi Antony,
>
> There is a small bug in the plugin.xml of
> org.eclipse.hyades.models.statistical plugin, it register a different URI
> then the one defined in the generated code.
>
> There are two quick workarounds until we get it fixed in CVS:
>
> 1. replace in plugin.xml
>    <extension
>          point="org.eclipse.emf.ecore.generated_package">
>       <package
>             uri="http://www.eclipse.org/hyades/models/statistical.xmi";
>             class
> ="org.eclipse.hyades.models.statistical.StatisticalPackage">
>       </package>
>    </extension>
>
> with
>    <extension
>          point="org.eclipse.emf.ecore.generated_package">
>       <package
>             uri="http://www.eclipse.org/hyades/statistical.xmi";
>             class
> ="org.eclipse.hyades.models.statistical.StatisticalPackage">
>       </package>
>    </extension>
>
> or
>
> 2. call StatisticalPackageImpl.init() before you use the model code (you
> can do this in your Plugin class for example in the startup() method)
>
>
> Thanks !
> Marius Slavescu
>
>
>
>
>                       "Antony Miguel"
>                       <antony.miguel@sca        To:
<hyades-dev@xxxxxxxxxxx>
>                       patech.com>               cc:
>                       Sent by:                  Subject:  [hyades-dev]
saved statistical models
>                       hyades-dev-admin@e
>                       clipse.org
>
>
>                       08/08/2003 06:41
>                       AM
>                       Please respond to
>                       hyades-dev
>
>
>
>
>
> Hi,
>
> I have been saving some statistical models made up primarily of
> SDMemberDescriptors, SDCounterDescriptors and SDContiguousObservations.
>
> I can save the model ok but then when I try to load it I get a socket
> connect IOException.  On changing the proxy settings It would appear that
> the XML parser is looking for the file
>
> http://www.eclipse.org/hyades/statistical.xmi
>
> presumably because it is referenced in the model here:
>
>
> <?xml version="1.0" encoding="ASCII"?>
>
>
> <Statistical:SDDescriptor xmi:version="2.0" xmlns:xmi="
> http://www.omg.org/XMI"; xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"; xmlns:Statistical="
> http://www.eclipse.org/hyades/statistical.xmi"; name="Scapa Statistical
> Model Trace">
>
>
> ...
>
>
> The file doesn't exist and the load fails.
>
> I've loaded ExecutionHistory files in the same way and had no problems.
is
> there something missing from the statistical model stuff or is this a
bug?
> or is there something I might be doing wrong?
>
> Also,  when I look at the saved statistical model in a text editor I
can't
> see any references to SDContiguousObservations which were there when I
> saved the model.  Should the SDContiguousObservation stuff be in the
saved
> file? is it stored somewhere else? has the saving not been implemented
yet?
>
> (I need to get saving/loading statistical models working asap - any help
> from anyone would be much appreciated)
>
> cheers
>
> Antony Miguel
>
> antony.miguel@xxxxxxxxxxxxx
>
>
>
> _______________________________________________
> hyades-dev mailing list
> hyades-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/hyades-dev
>

_______________________________________________
hyades-dev mailing list
hyades-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/hyades-dev
(See attached file: StatisticalInstanceModel.java)

Attachment: StatisticalInstanceModel.java
Description: Binary data


Back to the top