Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » OCL standard library
OCL standard library [message #63458] Tue, 28 October 2008 16:40 Go to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010406090106050308090808
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I'm trying to use OCL in a standalone way and since I've had the problem
I was wondering wether there is a way to register the standard library
without accessing discouraged classes. What I have donne for now :

resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
OCLStandardLibraryImpl.stdlibPackage);

This doesn't strike me as good programming : I couldn't access the
Standard library's NS URI + I couldn't access an instance of it. Did you
design any better way of doing this?

Laurent Goubet
Obeo

--------------010406090106050308090808
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

begin:vcard
fn:Laurent Goubet
n:Goubet;Laurent
org:<a href="http://www.obeo.fr/">Obeo</a>
email;internet:laurent.goubet@obeo.fr
url:http://www.obeo.fr
version:2.1
end:vcard


--------------010406090106050308090808--
Re: OCL standard library [message #63482 is a reply to message #63458] Tue, 28 October 2008 17:15 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Laurent,

I use URI mappings for this purpose. This is from the
orge.eclipse.ocl.standalone.tests.AllTests class, which I use for
running the OCL test suites in an Eclipse-free environment:

uriMap.put(
URI.createURI("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore"),
URI.createURI(PLATFORM_PLUGIN +
"org.eclipse.ocl.ecore/model/oclstdlib.ecore"));
uriMap.put(
URI.createURI("http://www.eclipse.org/ocl/1.1.0/oclstdlib.uml"),
URI.createURI(PLATFORM_PLUGIN +
"org.eclipse.ocl.uml/model/oclstdlib.uml"));


You may find other handy set-up tips in there, besides.

HTH,

Christian

laurent Goubet wrote:
> Hi,
>
> I'm trying to use OCL in a standalone way and since I've had the problem
> I was wondering wether there is a way to register the standard library
> without accessing discouraged classes. What I have donne for now :
>
> resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
> OCLStandardLibraryImpl.stdlibPackage);
>
> This doesn't strike me as good programming : I couldn't access the
> Standard library's NS URI + I couldn't access an instance of it. Did you
> design any better way of doing this?
>
> Laurent Goubet
> Obeo
Re: OCL standard library [message #63550 is a reply to message #63482] Wed, 29 October 2008 09:15 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070005050805040403010008
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Thanks Christian, I had forgotten these standalone tests :(.

Laurent Goubet
Obeo

Christian W. Damus a
Re: OCL standard library [message #63573 is a reply to message #63550] Wed, 29 October 2008 10:08 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060902090300070908030308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Christian,

using URIMaps as you hined towards did the trick, yet I'd still like to
be able to get both the standard library NsURI and the OCLEcore plugin
id without hard-coded Strings or discouraged accesses.

Something like this
resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore"),
URI.createURI(Platform.getBundle(OCLEcorePlugin.getPluginId( )).getEntry( "/model/oclstdlib.ecore").toString()));
presents both the need of no hard-coded String (the NsURI of the
standard library could evolve) and the discouraged access
(org.eclipse.ocl.ecore plugin ID cannot be accessed without it).

There may be things in OCLEcorePlugin that you don't want as API, but I
think providing access to these Strings would really be helpful (for
now, I'll stick with the discouraged access).

Laurent Goubet
Obeo

laurent Goubet a
Re: OCL standard library [message #63595 is a reply to message #63573] Wed, 29 October 2008 14:49 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.zeligsoft.com

Hi, Laurent,

You're quite right. These stdlib URIs should be available in the
EcoreEnvironment and UMLEnvironment classes.

Would you mind raising an enhancement request?

Thanks,

Christian

laurent Goubet wrote:
> Christian,
>
> using URIMaps as you hined towards did the trick, yet I'd still like to
> be able to get both the standard library NsURI and the OCLEcore plugin
> id without hard-coded Strings or discouraged accesses.
>
> Something like this
> resourceSet.getURIConverter().getURIMap().put(URI.createURI( "http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore"),
> URI.createURI(Platform.getBundle(OCLEcorePlugin.getPluginId( )).getEntry( "/model/oclstdlib.ecore").toString()));
>
> presents both the need of no hard-coded String (the NsURI of the
> standard library could evolve) and the discouraged access
> (org.eclipse.ocl.ecore plugin ID cannot be accessed without it).
>
> There may be things in OCLEcorePlugin that you don't want as API, but I
> think providing access to these Strings would really be helpful (for
> now, I'll stick with the discouraged access).
>
> Laurent Goubet
> Obeo
>
> laurent Goubet a écrit :
>> Thanks Christian, I had forgotten these standalone tests :(.
>>
>> Laurent Goubet
>> Obeo
>>
>> Christian W. Damus a écrit :
>>> Hi, Laurent,
>>>
>>> I use URI mappings for this purpose. This is from the
>>> orge.eclipse.ocl.standalone.tests.AllTests class, which I use for
>>> running the OCL test suites in an Eclipse-free environment:
>>>
>>> uriMap.put(
>>> URI.createURI("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore"),
>>> URI.createURI(PLATFORM_PLUGIN +
>>> "org.eclipse.ocl.ecore/model/oclstdlib.ecore"));
>>> uriMap.put(
>>> URI.createURI("http://www.eclipse.org/ocl/1.1.0/oclstdlib.uml"),
>>> URI.createURI(PLATFORM_PLUGIN +
>>> "org.eclipse.ocl.uml/model/oclstdlib.uml"));
>>>
>>>
>>> You may find other handy set-up tips in there, besides.
>>>
>>> HTH,
>>>
>>> Christian
>>>
>>> laurent Goubet wrote:
>>>> Hi,
>>>>
>>>> I'm trying to use OCL in a standalone way and since I've had the
>>>> problem I was wondering wether there is a way to register the
>>>> standard library without accessing discouraged classes. What I have
>>>> donne for now :
>>>>
>>>> resourceSet.getPackageRegistry().put("http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore",
>>>> OCLStandardLibraryImpl.stdlibPackage);
>>>>
>>>> This doesn't strike me as good programming : I couldn't access the
>>>> Standard library's NS URI + I couldn't access an instance of it. Did
>>>> you design any better way of doing this?
>>>>
>>>> Laurent Goubet
>>>> Obeo
>>
>
Re: OCL standard library [message #63618 is a reply to message #63595] Wed, 29 October 2008 15:08 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000306010409070405080909
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit

Done with bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252600 .
Thanks for your answers so far :).

Laurent Goubet
Obeo

Christian W. Damus a
Previous Topic:Validation menu option and OCL on UML
Next Topic:Importing Rose Model with OCL Constraints?
Goto Forum:
  


Current Time: Mon Oct 20 11:40:10 GMT 2014

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

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