Skip to main content



      Home
Home » Modeling » OCL » org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource
org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource [message #36348] Mon, 03 September 2007 03:04 Go to next message
Eclipse UserFriend
Originally posted by: krzysztof_kaczmarski.o2.pl

Hi All,

(Forgive me sending a copy to OCL news since I don't know who could
help here.)

I continue to discover problems with OCL types and their integration
with UML models. Perhaps someone could help me with this:

when I change "UML getting started" example to use OCL collection type
I cannot serialize the model correctly to a file. I receive IOException:

The object 'org.eclipse.ocl.uml.impl.BagTypeImpl@88e2dd (name:
<unset>, visibility: <unset>) (isLeaf: false, visibility: public,
isAbstract: false) (startPosition: -1, endPosition: -1,
typeStartPosition: -1, typeEndPosition: -1)' is not contained in a
resource.

An example use in the code looks like this:
sequence.createVariable( "TEST_VAR",
org.eclipse.ocl.uml.UMLFactory.eINSTANCE.createBagType());

What could be the possible problem here?
ocl, ocl.ecore and ocl.uml are included in the classpath.
Maybe this is somehow connected to the previous problem I asked about
concerning reading OCL primitive tyeps from oclstdlib.uml.

Regards,
Krzysztof Kaczmarski
Re: org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource [message #36378 is a reply to message #36348] Wed, 05 September 2007 09:30 Go to previous messageGo to next message
Eclipse UserFriend
Hi Krzysztof ,

This sounds like an OCL issue. Christian should be back from vacation next
week.

- James.

"Krzysztof Kaczmarski" <krzysztof_kaczmarski@o2.pl> wrote in message
news:fbgbld$4fr$1@build.eclipse.org...
> Hi All,
>
> (Forgive me sending a copy to OCL news since I don't know who could
> help here.)
>
> I continue to discover problems with OCL types and their integration
> with UML models. Perhaps someone could help me with this:
>
> when I change "UML getting started" example to use OCL collection type
> I cannot serialize the model correctly to a file. I receive IOException:
>
> The object 'org.eclipse.ocl.uml.impl.BagTypeImpl@88e2dd (name:
> <unset>, visibility: <unset>) (isLeaf: false, visibility: public,
> isAbstract: false) (startPosition: -1, endPosition: -1,
> typeStartPosition: -1, typeEndPosition: -1)' is not contained in a
> resource.
>
> An example use in the code looks like this:
> sequence.createVariable( "TEST_VAR",
> org.eclipse.ocl.uml.UMLFactory.eINSTANCE.createBagType());
>
> What could be the possible problem here?
> ocl, ocl.ecore and ocl.uml are included in the classpath.
> Maybe this is somehow connected to the previous problem I asked about
> concerning reading OCL primitive tyeps from oclstdlib.uml.
>
> Regards,
> Krzysztof Kaczmarski
Re: org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource [message #36735 is a reply to message #36348] Tue, 11 September 2007 16:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

OCL handles collection types by implicitly instanting template datatypes
whenever it needs a particular collection type (such as "Bag(Apple)") for
the first time.

The problem is, that OCL offers no guidance as to where to persist these
implicitly created types for serialization. The easiest way in an XMI
serialization is just to add them as additional root elements of your
resource. Unless you find some meaningful place in some resource to save
the BagType instance, EMF will not be able to determine a URI for it to
save a reference from your Variable instance.

HTH,

Christian


Krzysztof Kaczmarski wrote:

> Hi All,
>
> (Forgive me sending a copy to OCL news since I don't know who could
> help here.)
>
> I continue to discover problems with OCL types and their integration
> with UML models. Perhaps someone could help me with this:
>
> when I change "UML getting started" example to use OCL collection type
> I cannot serialize the model correctly to a file. I receive IOException:
>
> The object 'org.eclipse.ocl.uml.impl.BagTypeImpl@88e2dd (name:
> <unset>, visibility: <unset>) (isLeaf: false, visibility: public,
> isAbstract: false) (startPosition: -1, endPosition: -1,
> typeStartPosition: -1, typeEndPosition: -1)' is not contained in a
> resource.
>
> An example use in the code looks like this:
> sequence.createVariable( "TEST_VAR",
> org.eclipse.ocl.uml.UMLFactory.eINSTANCE.createBagType());
>
> What could be the possible problem here?
> ocl, ocl.ecore and ocl.uml are included in the classpath.
> Maybe this is somehow connected to the previous problem I asked about
> concerning reading OCL primitive tyeps from oclstdlib.uml.
>
> Regards,
> Krzysztof Kaczmarski
Re: org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource [message #38286 is a reply to message #36735] Tue, 25 September 2007 03:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztof_kaczmarski.o2.pl

Hi,

as a OCL-UML newbie I am not really sure what are you talking about guys:)

Should I do something like this:

1. Create appropriate type by
CollectionType collType = UMLFactory.eINSTANCE.createBagType();

2. When serializing the model first serialize the type?
res.getContents().add(0, collType);

3. Then serialize the model.

Thanks,
KK

Ed Willink wrote:
> Christian W. Damus wrote:
>> The problem is, that OCL offers no guidance as to where to persist these
>> implicitly created types for serialization. The easiest way in an XMI
>> serialization is just to add them as additional root elements of your
>> resource. Unless you find some meaningful place in some resource to save
>> the BagType instance, EMF will not be able to determine a URI for it to
>> save a reference from your Variable instance.
>>
>
> The solution adopted by QVT is that the type must be defined in some
> transformation package and that A::Bag(Integer) is the same type as
> B::Bag(Integer).
>
> Regards
>
> Ed Willink
>
Re: org.eclipse.ocl.uml.impl.BagTypeImpl not contained in the resource [message #38384 is a reply to message #38286] Tue, 25 September 2007 09:31 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Krzysztof,

No, you don't want to be creating your own instances of these collection
types because the parser creates them, itself, on demand and pools them.

The default implementation of the OCL Environment API will store these
collection types (and others) in a bunch of packages in a resource that it
creates to gather them all. Have a look at the TypeResolver interface and
its hierarchy, in particular AbstractTypeResolver. After you have parsed
your constraint(s), you can get the packages in this resource and, as Ed
suggested, store them in some separate transformation-specific resource or
wherever you need them.

You just need to be sure that the exact instances referenced by your OCL AST
model are persisted somewhere that EMF can get a URI for them and
deserialize them later.

HTH,

Christian


Krzysztof Kaczmarski wrote:

> Hi,
>
> as a OCL-UML newbie I am not really sure what are you talking about guys:)
>
> Should I do something like this:
>
> 1. Create appropriate type by
> CollectionType collType = UMLFactory.eINSTANCE.createBagType();
>
> 2. When serializing the model first serialize the type?
> res.getContents().add(0, collType);
>
> 3. Then serialize the model.
>
> Thanks,
> KK
>
> Ed Willink wrote:
>> Christian W. Damus wrote:
>>> The problem is, that OCL offers no guidance as to where to persist these
>>> implicitly created types for serialization. The easiest way in an XMI
>>> serialization is just to add them as additional root elements of your
>>> resource. Unless you find some meaningful place in some resource to
>>> save the BagType instance, EMF will not be able to determine a URI for
>>> it to save a reference from your Variable instance.
>>>
>>
>> The solution adopted by QVT is that the type must be defined in some
>> transformation package and that A::Bag(Integer) is the same type as
>> B::Bag(Integer).
>>
>> Regards
>>
>> Ed Willink
>>
Previous Topic:beginner questions: what is best practice to implement EMF derived methods with OCL
Next Topic:Problem: Cannot find operation
Goto Forum:
  


Current Time: Tue Jul 01 02:55:24 EDT 2025

Powered by FUDForum. Page generated in 0.03831 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top