Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Query on multipackages metamodel
Query on multipackages metamodel [message #24074] Wed, 22 February 2006 10:40 Go to next message
No real name is currently offline No real nameFriend
Messages: 29
Registered: July 2009
Junior Member
Dear all,

i'm trying to use the OCL/QUERY plugins functionality in order to create
ocl query working on a metamodel defined with multiple packages, i.e

pkg 1
-- pkg 2
-- pkg 3
-- pkg4

but i haven't found a way to make things works when the ocl expression use
attributes (or features) of elements defined into different packages (i.e
starting from an object defined into pkg2 look for all the related object
defined into pkg4 using some attributes defined into pkg3...)

It seems to me that all provided example works on models defined with just
one package, whats the proper way to make the query works even in the
general case?

The same problem applys for the VALIDATION plugin too when it is time to
define which package an (ocl) constraint works on in the plugin.xml file...

Any help will be appreciated.
Best regards
Re: Query on multipackages metamodel [message #24294 is a reply to message #24074] Wed, 22 February 2006 13:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hello, sf76,

In the validation case, all that you should need to do is to specify each of
your EPackages in <package> elements in your <constraintProvider>
extension.

Regarding the OCL query, can you provide an example of how you are
formulating your query? You shouldn't (AFAIK) have any problems with
multiple packages. For example, if your packages look like

pkg1
Class1
ref1 : pkg2.Class2
ref2 : Class1
pkg2
Class2
x : EInt
pkg3
Class3 -> pkg1.Class1

Then an OCL query such as

new SELECT(
new FROM(resource.getContents()),
new WHERE(new OCLConstraintCondition(
"ref1.x > 0 and ref2.oclIsKindOf(pkg1::pkg2::pkg3::Class3)",
Pkg1Package.Literals.CLASS1)));

should work fine to select all Class1s related to a Class2 with positive x
and referencing a Class3.

HTH,

Christian


sf76 wrote:

> Dear all,
>
> i'm trying to use the OCL/QUERY plugins functionality in order to create
> ocl query working on a metamodel defined with multiple packages, i.e
>
> pkg 1
> -- pkg 2
> -- pkg 3
> -- pkg4
>
> but i haven't found a way to make things works when the ocl expression use
> attributes (or features) of elements defined into different packages (i.e
> starting from an object defined into pkg2 look for all the related object
> defined into pkg4 using some attributes defined into pkg3...)
>
> It seems to me that all provided example works on models defined with just
> one package, whats the proper way to make the query works even in the
> general case?
>
> The same problem applys for the VALIDATION plugin too when it is time to
> define which package an (ocl) constraint works on in the plugin.xml
> file...
>
> Any help will be appreciated.
> Best regards
Re: Query on multipackages metamodel [message #24991 is a reply to message #24294] Thu, 23 February 2006 13:09 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 29
Registered: July 2009
Junior Member
Dear Christian,

here are the result of my trial:

1. OCL plugin
Assume the MM is defined this way:
- pkg1 which contain the following two packages
-pkg2 which contain the real object and relationship
-pkg3 which just contain classes that extend the one of pkg2

I've got a gef editor that show instance of this emf MM and from another
plugin (at least for now) i would like to perfomr ocl query on the
selected object (which will be an instance of element defined into pkg3)

Pkg3ElementX context = (Pkg3ElementX) selectedObject;
//wanted is defined at pkg2 level and it is recognized well
//name is defined at pkg1 level and works ok too
String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(Pkg3ElementY))";

IOclHelper helper = HelperUtil.createOclHelper( new
EcoreEnvironmentFactory(
context.eResource().getResourceSet().getPackageRegistry()));
helper.setContext(context);
helper.evaluate(context, oclExpression);

Everything works if i use an element defined at pkg3 inside the
oclIsTypeOf expression above, but i'm not able to use element defined in
the other pkgs (i got an "Unrecognizable type" error).


2. QUERY plugin

SELECT s = new SELECT(
new FROM( complete ), //the list of obj contained into the resource
new WHERE(
new OclConstraintCondition(
"self.rel1->select( oclIsKindOf( pathToObjType )->size() > 0 ",
Pkg2.eINSTANCE.getContext()
)
}

where pathToObjType is composed this way:
- nsPrefixOfThePkg::ObjectClass and it is related to the pkg of the
context element.

This way (since context is of pkg2) i'm able to use object of pkg3 but not
the ones of the others (pkg1, pkg2). Other ways of specifying
pathToObjType gives me the "Unrecognizable type" error.



I think that this problems are in fact related and could have just a
common cause. Do you have any suggestion?

TIA
Re: Query on multipackages metamodel [message #25275 is a reply to message #24991] Thu, 23 February 2006 17:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Ssf76,

See responses in-line.

HTH,

Christian


sf76 wrote:

> Dear Christian,
>
> here are the result of my trial:
>
> 1. OCL plugin
> Assume the MM is defined this way:
> - pkg1 which contain the following two packages
> -pkg2 which contain the real object and relationship
> -pkg3 which just contain classes that extend the one of pkg2
>
> I've got a gef editor that show instance of this emf MM and from another
> plugin (at least for now) i would like to perfomr ocl query on the
> selected object (which will be an instance of element defined into pkg3)
>
> Pkg3ElementX context = (Pkg3ElementX) selectedObject;
> //wanted is defined at pkg2 level and it is recognized well
> //name is defined at pkg1 level and works ok too
> String ocl = "self.wanted->select( name='xxx' and
> oclIsTypeOf(Pkg3ElementY))";
>
> IOclHelper helper = HelperUtil.createOclHelper( new
> EcoreEnvironmentFactory(
> context.eResource().getResourceSet().getPackageRegistry()));
> helper.setContext(context);
> helper.evaluate(context, oclExpression);
>
> Everything works if i use an element defined at pkg3 inside the
> oclIsTypeOf expression above, but i'm not able to use element defined in
> the other pkgs (i got an "Unrecognizable type" error).

Are you using, for example,

String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(pkg1::pkg2::Pkg2ElementX))";

or even just

String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(pkg2::Pkg2ElementX))";

to qualify the name of the classifier that you are referencing?

Either of these should work. Note that qualified names in OCL are separated
by '::', not by '.'

The trick, here, is that the default context package for an expression whose
context classifier is Pkg3ElementY is pkg3. When the parser fails to find
the referenced name in the default context package, it will look in the
super-package and so on to the root package namespace until it finds the
name. This is why both 'pkg2::Pkg2ElementX' and 'pkg1::pkg2::Pkg2ElementX'
should work.

Do your packages have namespace prefixes of the following form?

pkg1
pkg2
pkg3

or of this form?

pkg1
pkg1.pkg2
pkg1.pkg2.pkg3

If the latter, then I suspect that something may be broken in our parser.

>
>
> 2. QUERY plugin
>
> SELECT s = new SELECT(
> new FROM( complete ), //the list of obj contained into the resource
> new WHERE(
> new OclConstraintCondition(
> "self.rel1->select( oclIsKindOf( pathToObjType )->size() > 0 ",
> Pkg2.eINSTANCE.getContext()
> )
> }
>
> where pathToObjType is composed this way:
> - nsPrefixOfThePkg::ObjectClass and it is related to the pkg of the
> context element.
>
> This way (since context is of pkg2) i'm able to use object of pkg3 but not
> the ones of the others (pkg1, pkg2). Other ways of specifying
> pathToObjType gives me the "Unrecognizable type" error.
>
>
>
> I think that this problems are in fact related and could have just a
> common cause. Do you have any suggestion?

Yes, this will be the identical problem (the environment works the same way
under the hood).

>
> TIA
Re: Query on multipackages metamodel [message #25521 is a reply to message #25275] Fri, 24 February 2006 14:33 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 29
Registered: July 2009
Junior Member
Dear Christian,

after some test i come out with the following "rules" in order to qualify
the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
using the ocl and query plugins:

- if the expr is of type pkg::Element then i could use either the name of
the pkg either its ns prefix and this way i could create query to
reference element present in any pkg of the model
- if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
package should be defined with the ns prefix and the other via their names


This is how my model (part of) looks like:
Name Ns Prefix
pkg1 --> a.b.c.pkg1
pkg2 --> a.b.c.pkg1.pkg2
pkg3 --> a.b.c.pkg1.pkg2.pkg3

and pkg1 containt pkg2 which contains pkg3

In the Rational Rose source file i've defined the ecore basePackage
property for the pkg1 to be a.b.c, could this be the source of problems?

Have i nice w-e
Best regards
Re: Query on multipackages metamodel [message #25560 is a reply to message #25521] Fri, 24 February 2006 14:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Yes, indeed, this looks like a problem.

I've always been a little disconcerted by the OCL parser's usage of nsPrefix
instead of names, and it seems some bad assumptions were made regarding the
structure of the nsPrefix generated by EMF.

I'll appreciate it if you can raise a bugzilla with details of your
scenario, so that we can reproduce and address this problem.

Thanks,

Christian

sf76 wrote:

> Dear Christian,
>
> after some test i come out with the following "rules" in order to qualify
> the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
> using the ocl and query plugins:
>
> - if the expr is of type pkg::Element then i could use either the name of
> the pkg either its ns prefix and this way i could create query to
> reference element present in any pkg of the model
> - if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
> package should be defined with the ns prefix and the other via their names
>
>
> This is how my model (part of) looks like:
> Name Ns Prefix
> pkg1 --> a.b.c.pkg1
> pkg2 --> a.b.c.pkg1.pkg2
> pkg3 --> a.b.c.pkg1.pkg2.pkg3
>
> and pkg1 containt pkg2 which contains pkg3
>
> In the Rational Rose source file i've defined the ecore basePackage
> property for the pkg1 to be a.b.c, could this be the source of problems?
>
> Have i nice w-e
> Best regards
Re: Query on multipackages metamodel [message #25600 is a reply to message #25560] Fri, 24 February 2006 15:19 Go to previous message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------040902000000080608010007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christian,

Yeah. The nsPrefix should really be used only as a hint for the
preferred xmlns prefix to be used in serialized instances. There are no
guarantees of uniqueness and any XML Schema NCName is permitted, whereas
the package name must be a valid Java identifier.


Christian W. Damus wrote:
> Yes, indeed, this looks like a problem.
>
> I've always been a little disconcerted by the OCL parser's usage of nsPrefix
> instead of names, and it seems some bad assumptions were made regarding the
> structure of the nsPrefix generated by EMF.
>
> I'll appreciate it if you can raise a bugzilla with details of your
> scenario, so that we can reproduce and address this problem.
>
> Thanks,
>
> Christian
>
> sf76 wrote:
>
>
>> Dear Christian,
>>
>> after some test i come out with the following "rules" in order to qualify
>> the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
>> using the ocl and query plugins:
>>
>> - if the expr is of type pkg::Element then i could use either the name of
>> the pkg either its ns prefix and this way i could create query to
>> reference element present in any pkg of the model
>> - if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
>> package should be defined with the ns prefix and the other via their names
>>
>>
>> This is how my model (part of) looks like:
>> Name Ns Prefix
>> pkg1 --> a.b.c.pkg1
>> pkg2 --> a.b.c.pkg1.pkg2
>> pkg3 --> a.b.c.pkg1.pkg2.pkg3
>>
>> and pkg1 containt pkg2 which contains pkg3
>>
>> In the Rational Rose source file i've defined the ecore basePackage
>> property for the pkg1 to be a.b.c, could this be the source of problems?
>>
>> Have i nice w-e
>> Best regards
>>
>
>


--------------040902000000080608010007
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christian,<br>
<br>
Yeah.&nbsp; The nsPrefix should really be used only as a hint for the
preferred xmlns prefix to be used in serialized instances.&nbsp; There are
no guarantees of uniqueness and any XML Schema NCName is permitted,
whereas the package name must be a valid Java identifier.<br>
<br>
<br>
Christian W. Damus wrote:
<blockquote cite="middtn6ba$mm6$1@utils.eclipse.org" type="cite">
<pre wrap="">Yes, indeed, this looks like a problem.

I've always been a little disconcerted by the OCL parser's usage of nsPrefix
instead of names, and it seems some bad assumptions were made regarding the
structure of the nsPrefix generated by EMF.

I'll appreciate it if you can raise a bugzilla with details of your
scenario, so that we can reproduce and address this problem.

Thanks,

Christian

sf76 wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Dear Christian,

after some test i come out with the following "rules" in order to qualify
the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
using the ocl and query plugins:

- if the expr is of type pkg::Element then i could use either the name of
the pkg either its ns prefix and this way i could create query to
reference element present in any pkg of the model
- if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
package should be defined with the ns prefix and the other via their names


This is how my model (part of) looks like:
Name Ns Prefix
pkg1 --&gt; a.b.c.pkg1
pkg2 --&gt; a.b.c.pkg1.pkg2
pkg3 --&gt; a.b.c.pkg1.pkg2.pkg3

and pkg1 containt pkg2 which contains pkg3

In the Rational Rose source file i've defined the ecore basePackage
property for the pkg1 to be a.b.c, could this be the source of problems?

Have i nice w-e
Best regards
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------040902000000080608010007--
Re: Query on multipackages metamodel [message #568446 is a reply to message #24074] Wed, 22 February 2006 13:41 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hello, sf76,

In the validation case, all that you should need to do is to specify each of
your EPackages in <package> elements in your <constraintProvider>
extension.

Regarding the OCL query, can you provide an example of how you are
formulating your query? You shouldn't (AFAIK) have any problems with
multiple packages. For example, if your packages look like

pkg1
Class1
ref1 : pkg2.Class2
ref2 : Class1
pkg2
Class2
x : EInt
pkg3
Class3 -> pkg1.Class1

Then an OCL query such as

new SELECT(
new FROM(resource.getContents()),
new WHERE(new OCLConstraintCondition(
"ref1.x > 0 and ref2.oclIsKindOf(pkg1::pkg2::pkg3::Class3)",
Pkg1Package.Literals.CLASS1)));

should work fine to select all Class1s related to a Class2 with positive x
and referencing a Class3.

HTH,

Christian


sf76 wrote:

> Dear all,
>
> i'm trying to use the OCL/QUERY plugins functionality in order to create
> ocl query working on a metamodel defined with multiple packages, i.e
>
> pkg 1
> -- pkg 2
> -- pkg 3
> -- pkg4
>
> but i haven't found a way to make things works when the ocl expression use
> attributes (or features) of elements defined into different packages (i.e
> starting from an object defined into pkg2 look for all the related object
> defined into pkg4 using some attributes defined into pkg3...)
>
> It seems to me that all provided example works on models defined with just
> one package, whats the proper way to make the query works even in the
> general case?
>
> The same problem applys for the VALIDATION plugin too when it is time to
> define which package an (ocl) constraint works on in the plugin.xml
> file...
>
> Any help will be appreciated.
> Best regards
Re: Query on multipackages metamodel [message #569225 is a reply to message #24294] Thu, 23 February 2006 13:09 Go to previous message
No real name is currently offline No real nameFriend
Messages: 29
Registered: July 2009
Junior Member
Dear Christian,

here are the result of my trial:

1. OCL plugin
Assume the MM is defined this way:
- pkg1 which contain the following two packages
-pkg2 which contain the real object and relationship
-pkg3 which just contain classes that extend the one of pkg2

I've got a gef editor that show instance of this emf MM and from another
plugin (at least for now) i would like to perfomr ocl query on the
selected object (which will be an instance of element defined into pkg3)

Pkg3ElementX context = (Pkg3ElementX) selectedObject;
//wanted is defined at pkg2 level and it is recognized well
//name is defined at pkg1 level and works ok too
String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(Pkg3ElementY))";

IOclHelper helper = HelperUtil.createOclHelper( new
EcoreEnvironmentFactory(
context.eResource().getResourceSet().getPackageRegistry()));
helper.setContext(context);
helper.evaluate(context, oclExpression);

Everything works if i use an element defined at pkg3 inside the
oclIsTypeOf expression above, but i'm not able to use element defined in
the other pkgs (i got an "Unrecognizable type" error).


2. QUERY plugin

SELECT s = new SELECT(
new FROM( complete ), //the list of obj contained into the resource
new WHERE(
new OclConstraintCondition(
"self.rel1->select( oclIsKindOf( pathToObjType )->size() > 0 ",
Pkg2.eINSTANCE.getContext()
)
}

where pathToObjType is composed this way:
- nsPrefixOfThePkg::ObjectClass and it is related to the pkg of the
context element.

This way (since context is of pkg2) i'm able to use object of pkg3 but not
the ones of the others (pkg1, pkg2). Other ways of specifying
pathToObjType gives me the "Unrecognizable type" error.



I think that this problems are in fact related and could have just a
common cause. Do you have any suggestion?

TIA
Re: Query on multipackages metamodel [message #569500 is a reply to message #24991] Thu, 23 February 2006 17:37 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Ssf76,

See responses in-line.

HTH,

Christian


sf76 wrote:

> Dear Christian,
>
> here are the result of my trial:
>
> 1. OCL plugin
> Assume the MM is defined this way:
> - pkg1 which contain the following two packages
> -pkg2 which contain the real object and relationship
> -pkg3 which just contain classes that extend the one of pkg2
>
> I've got a gef editor that show instance of this emf MM and from another
> plugin (at least for now) i would like to perfomr ocl query on the
> selected object (which will be an instance of element defined into pkg3)
>
> Pkg3ElementX context = (Pkg3ElementX) selectedObject;
> //wanted is defined at pkg2 level and it is recognized well
> //name is defined at pkg1 level and works ok too
> String ocl = "self.wanted->select( name='xxx' and
> oclIsTypeOf(Pkg3ElementY))";
>
> IOclHelper helper = HelperUtil.createOclHelper( new
> EcoreEnvironmentFactory(
> context.eResource().getResourceSet().getPackageRegistry()));
> helper.setContext(context);
> helper.evaluate(context, oclExpression);
>
> Everything works if i use an element defined at pkg3 inside the
> oclIsTypeOf expression above, but i'm not able to use element defined in
> the other pkgs (i got an "Unrecognizable type" error).

Are you using, for example,

String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(pkg1::pkg2::Pkg2ElementX))";

or even just

String ocl = "self.wanted->select( name='xxx' and
oclIsTypeOf(pkg2::Pkg2ElementX))";

to qualify the name of the classifier that you are referencing?

Either of these should work. Note that qualified names in OCL are separated
by '::', not by '.'

The trick, here, is that the default context package for an expression whose
context classifier is Pkg3ElementY is pkg3. When the parser fails to find
the referenced name in the default context package, it will look in the
super-package and so on to the root package namespace until it finds the
name. This is why both 'pkg2::Pkg2ElementX' and 'pkg1::pkg2::Pkg2ElementX'
should work.

Do your packages have namespace prefixes of the following form?

pkg1
pkg2
pkg3

or of this form?

pkg1
pkg1.pkg2
pkg1.pkg2.pkg3

If the latter, then I suspect that something may be broken in our parser.

>
>
> 2. QUERY plugin
>
> SELECT s = new SELECT(
> new FROM( complete ), //the list of obj contained into the resource
> new WHERE(
> new OclConstraintCondition(
> "self.rel1->select( oclIsKindOf( pathToObjType )->size() > 0 ",
> Pkg2.eINSTANCE.getContext()
> )
> }
>
> where pathToObjType is composed this way:
> - nsPrefixOfThePkg::ObjectClass and it is related to the pkg of the
> context element.
>
> This way (since context is of pkg2) i'm able to use object of pkg3 but not
> the ones of the others (pkg1, pkg2). Other ways of specifying
> pathToObjType gives me the "Unrecognizable type" error.
>
>
>
> I think that this problems are in fact related and could have just a
> common cause. Do you have any suggestion?

Yes, this will be the identical problem (the environment works the same way
under the hood).

>
> TIA
Re: Query on multipackages metamodel [message #569711 is a reply to message #25275] Fri, 24 February 2006 14:33 Go to previous message
No real name is currently offline No real nameFriend
Messages: 29
Registered: July 2009
Junior Member
Dear Christian,

after some test i come out with the following "rules" in order to qualify
the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
using the ocl and query plugins:

- if the expr is of type pkg::Element then i could use either the name of
the pkg either its ns prefix and this way i could create query to
reference element present in any pkg of the model
- if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
package should be defined with the ns prefix and the other via their names


This is how my model (part of) looks like:
Name Ns Prefix
pkg1 --> a.b.c.pkg1
pkg2 --> a.b.c.pkg1.pkg2
pkg3 --> a.b.c.pkg1.pkg2.pkg3

and pkg1 containt pkg2 which contains pkg3

In the Rational Rose source file i've defined the ecore basePackage
property for the pkg1 to be a.b.c, could this be the source of problems?

Have i nice w-e
Best regards
Re: Query on multipackages metamodel [message #569744 is a reply to message #25521] Fri, 24 February 2006 14:48 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Yes, indeed, this looks like a problem.

I've always been a little disconcerted by the OCL parser's usage of nsPrefix
instead of names, and it seems some bad assumptions were made regarding the
structure of the nsPrefix generated by EMF.

I'll appreciate it if you can raise a bugzilla with details of your
scenario, so that we can reproduce and address this problem.

Thanks,

Christian

sf76 wrote:

> Dear Christian,
>
> after some test i come out with the following "rules" in order to qualify
> the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
> using the ocl and query plugins:
>
> - if the expr is of type pkg::Element then i could use either the name of
> the pkg either its ns prefix and this way i could create query to
> reference element present in any pkg of the model
> - if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
> package should be defined with the ns prefix and the other via their names
>
>
> This is how my model (part of) looks like:
> Name Ns Prefix
> pkg1 --> a.b.c.pkg1
> pkg2 --> a.b.c.pkg1.pkg2
> pkg3 --> a.b.c.pkg1.pkg2.pkg3
>
> and pkg1 containt pkg2 which contains pkg3
>
> In the Rational Rose source file i've defined the ecore basePackage
> property for the pkg1 to be a.b.c, could this be the source of problems?
>
> Have i nice w-e
> Best regards
Re: Query on multipackages metamodel [message #569770 is a reply to message #25560] Fri, 24 February 2006 15:19 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040902000000080608010007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christian,

Yeah. The nsPrefix should really be used only as a hint for the
preferred xmlns prefix to be used in serialized instances. There are no
guarantees of uniqueness and any XML Schema NCName is permitted, whereas
the package name must be a valid Java identifier.


Christian W. Damus wrote:
> Yes, indeed, this looks like a problem.
>
> I've always been a little disconcerted by the OCL parser's usage of nsPrefix
> instead of names, and it seems some bad assumptions were made regarding the
> structure of the nsPrefix generated by EMF.
>
> I'll appreciate it if you can raise a bugzilla with details of your
> scenario, so that we can reproduce and address this problem.
>
> Thanks,
>
> Christian
>
> sf76 wrote:
>
>
>> Dear Christian,
>>
>> after some test i come out with the following "rules" in order to qualify
>> the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
>> using the ocl and query plugins:
>>
>> - if the expr is of type pkg::Element then i could use either the name of
>> the pkg either its ns prefix and this way i could create query to
>> reference element present in any pkg of the model
>> - if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
>> package should be defined with the ns prefix and the other via their names
>>
>>
>> This is how my model (part of) looks like:
>> Name Ns Prefix
>> pkg1 --> a.b.c.pkg1
>> pkg2 --> a.b.c.pkg1.pkg2
>> pkg3 --> a.b.c.pkg1.pkg2.pkg3
>>
>> and pkg1 containt pkg2 which contains pkg3
>>
>> In the Rational Rose source file i've defined the ecore basePackage
>> property for the pkg1 to be a.b.c, could this be the source of problems?
>>
>> Have i nice w-e
>> Best regards
>>
>
>


--------------040902000000080608010007
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christian,<br>
<br>
Yeah.&nbsp; The nsPrefix should really be used only as a hint for the
preferred xmlns prefix to be used in serialized instances.&nbsp; There are
no guarantees of uniqueness and any XML Schema NCName is permitted,
whereas the package name must be a valid Java identifier.<br>
<br>
<br>
Christian W. Damus wrote:
<blockquote cite="middtn6ba$mm6$1@utils.eclipse.org" type="cite">
<pre wrap="">Yes, indeed, this looks like a problem.

I've always been a little disconcerted by the OCL parser's usage of nsPrefix
instead of names, and it seems some bad assumptions were made regarding the
structure of the nsPrefix generated by EMF.

I'll appreciate it if you can raise a bugzilla with details of your
scenario, so that we can reproduce and address this problem.

Thanks,

Christian

sf76 wrote:

</pre>
<blockquote type="cite">
<pre wrap="">Dear Christian,

after some test i come out with the following "rules" in order to qualify
the name of the classifier in expression like oclIsTypeOf(p1::p2::Element)
using the ocl and query plugins:

- if the expr is of type pkg::Element then i could use either the name of
the pkg either its ns prefix and this way i could create query to
reference element present in any pkg of the model
- if the expr is of type pkg1::pkg2::...::pkgN::Element then the first
package should be defined with the ns prefix and the other via their names


This is how my model (part of) looks like:
Name Ns Prefix
pkg1 --&gt; a.b.c.pkg1
pkg2 --&gt; a.b.c.pkg1.pkg2
pkg3 --&gt; a.b.c.pkg1.pkg2.pkg3

and pkg1 containt pkg2 which contains pkg3

In the Rational Rose source file i've defined the ecore basePackage
property for the pkg1 to be a.b.c, could this be the source of problems?

Have i nice w-e
Best regards
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------040902000000080608010007--


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:47 failures in ocl.tests, is that the right number?
Next Topic:[Announce] EMFT OCL 1.0.0M5 is available
Goto Forum:
  


Current Time: Tue Apr 16 18:42:18 GMT 2024

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

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

Back to the top