Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » JET 1.0.0: incomplete xpath expressions?
JET 1.0.0: incomplete xpath expressions? [message #34483] Fri, 19 May 2006 16:10 Go to next message
yannick chong is currently offline yannick chongFriend
Messages: 19
Registered: July 2009
Junior Member
Hi,

I tried to use JET to parse, and generate files from a uml model, but I
encountered several problems:

1) JET can't recognize namespaces (or I don't know how to)
2) Xpath axes (ex: child::mytag) or some xpath syntax (ex: root//mytag)
are not supported.

Could someone tell me how I could do those please?
Re: JET 1.0.0: incomplete xpath expressions? [message #34655 is a reply to message #34483] Tue, 23 May 2006 13:54 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Yannick:

I have successfully extracted information from a UML model (created with UML
2.0.0RC4). But you probably require more information than is currently in
the documentation.

JET has implemented a nearly complete subset of the XPath 1.0 specification.
The interesting thing about the JET implementation is that it is not limited
to just XML documents. There are interfaces that allow adapting XPath
expressions to any data model that has a spanning subtree.

Things that are missing from the JET implementation are:
* full namespace support
* the implementation of one XPath function: id()
* the implementation of some of the XPath axes

See details below:

1) namespace recognition is not complete - there is no way to map a prefix
in an XPath expression to an namespace URI. Alternatives:
* Use the local-name() XPath function to test only the local name - this
will essentially ignore the namespace.
Example: foo/*[local-name() = 'bar']
* Use the name() XPath function to test against the QNames - this
requires you to know the prefix in the document you are using.
Example: foo/*[name() = 'prfx:bar']

Namespace support will not be completed for 1.0. But, I don't think you
need it to parse a UML document. See below.

2) Only the following XPath axis are implemented: child, parent, self and
attribute (and their abbreviations). If other axes are important (I noticed
you used //, which is equivalent using the descendent-or-self axis), please
submit a bugzilla:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=JET&rep_platform=PC&op_sy s=Windows%20XP&priority=P3&bug_severity=normal&b ug_status=NEW&assigned_to=pelder%40ca.ibm.com&qa_con tact=&cc=&bug_file_loc=http%3A%2F%2F&short_desc= &comment=&commentprivacy=0&keywords=&depends on=&blocked=&maketemplate=Remember%20values%20as%20b ookmarkable%20template&form_name=enter_bug

(sorry for the long URL, but it fills in most of the required fields for
you).

3) The JET XPath engine adapts to any EMF-based model (including UML2), as
follows:

* '/' refers to the document root (which, if you are familiar with the
EMF API's, is the EMF Resource)
* There is a special child of the document root implemented named
'contents' (which mirrors Resource.getContents()).
* If you have an XPath expression matching a subclass of EObject, then:
EReference features correspond to XPath child elements
EAttribute features correspond to XPath attribute

Example: If you have a typical UML model with a root object of type
Model, here are a number of XPath expressions you can use:

/contents - matches the root Model element
/contents/@name - returns the name of the Model element
/contents/nestedPackage - returns the packages contained
directly by the model

As a bonus, and because the UML meta-model in particular is so large and
most people don't know the feature names used for navigating the model, the
XPath engine will also recognize an eClass name when searching an element
axis. The best way to understand this is some more examples:

/Model - matches an EObject of type Model contained directly
by the root Resource
/Model/Package matches all EObjects of type Package contained
by the root Model object.


Paul Elder
JET2 Lead

"Yannick" <yannick@anyware-tech.com> wrote in message
news:e4kqls$5p4$1@utils.eclipse.org...
> Hi,
>
> I tried to use JET to parse, and generate files from a uml model, but I
> encountered several problems:
>
> 1) JET can't recognize namespaces (or I don't know how to)
> 2) Xpath axes (ex: child::mytag) or some xpath syntax (ex: root//mytag)
> are not supported.
>
> Could someone tell me how I could do those please?
Re: JET 1.0.0: incomplete xpath expressions? [message #35326 is a reply to message #34655] Fri, 26 May 2006 08:15 Go to previous messageGo to next message
yannick chong is currently offline yannick chongFriend
Messages: 19
Registered: July 2009
Junior Member
Thanks a lot for your reply, Paul.

I'll take my time to fully understand all you wrote. (It would also be
nice if your explanations could be in the documentation ;) )

Paul Elder a écrit :
> Yannick:
>
> I have successfully extracted information from a UML model (created with UML
> 2.0.0RC4). But you probably require more information than is currently in
> the documentation.
>
> JET has implemented a nearly complete subset of the XPath 1.0 specification.
> The interesting thing about the JET implementation is that it is not limited
> to just XML documents. There are interfaces that allow adapting XPath
> expressions to any data model that has a spanning subtree.
>
> Things that are missing from the JET implementation are:
> * full namespace support
> * the implementation of one XPath function: id()
> * the implementation of some of the XPath axes
>
> See details below:
>
> 1) namespace recognition is not complete - there is no way to map a prefix
> in an XPath expression to an namespace URI. Alternatives:
> * Use the local-name() XPath function to test only the local name - this
> will essentially ignore the namespace.
> Example: foo/*[local-name() = 'bar']
> * Use the name() XPath function to test against the QNames - this
> requires you to know the prefix in the document you are using.
> Example: foo/*[name() = 'prfx:bar']
>
> Namespace support will not be completed for 1.0. But, I don't think you
> need it to parse a UML document. See below.
>
> 2) Only the following XPath axis are implemented: child, parent, self and
> attribute (and their abbreviations). If other axes are important (I noticed
> you used //, which is equivalent using the descendent-or-self axis), please
> submit a bugzilla:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=JET&rep_platform=PC&op_sy s=Windows%20XP&priority=P3&bug_severity=normal&b ug_status=NEW&assigned_to=pelder%40ca.ibm.com&qa_con tact=&cc=&bug_file_loc=http%3A%2F%2F&short_desc= &comment=&commentprivacy=0&keywords=&depends on=&blocked=&maketemplate=Remember%20values%20as%20b ookmarkable%20template&form_name=enter_bug
>
> (sorry for the long URL, but it fills in most of the required fields for
> you).
>
> 3) The JET XPath engine adapts to any EMF-based model (including UML2), as
> follows:
>
> * '/' refers to the document root (which, if you are familiar with the
> EMF API's, is the EMF Resource)
> * There is a special child of the document root implemented named
> 'contents' (which mirrors Resource.getContents()).
> * If you have an XPath expression matching a subclass of EObject, then:
> EReference features correspond to XPath child elements
> EAttribute features correspond to XPath attribute
>
> Example: If you have a typical UML model with a root object of type
> Model, here are a number of XPath expressions you can use:
>
> /contents - matches the root Model element
> /contents/@name - returns the name of the Model element
> /contents/nestedPackage - returns the packages contained
> directly by the model
>
> As a bonus, and because the UML meta-model in particular is so large and
> most people don't know the feature names used for navigating the model, the
> XPath engine will also recognize an eClass name when searching an element
> axis. The best way to understand this is some more examples:
>
> /Model - matches an EObject of type Model contained directly
> by the root Resource
> /Model/Package matches all EObjects of type Package contained
> by the root Model object.
>
>
> Paul Elder
> JET2 Lead
Re: JET 1.0.0: incomplete xpath expressions? [message #35427 is a reply to message #35326] Fri, 26 May 2006 12:29 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Yannick:

I'm working (slowly) on the documentation. This week's integration build
includes some getting started material. Next week, there should be more
reference material, too.

Also, this week's integration build includes an implementation of the
'descendent-or-self' axis.

Paul
"Yannick" <yannick@anyware-tech.com> wrote in message
news:e56dfq$cr3$1@utils.eclipse.org...
> Thanks a lot for your reply, Paul.
>
> I'll take my time to fully understand all you wrote. (It would also be
> nice if your explanations could be in the documentation ;) )
>
> Paul Elder a
Re: JET 1.0.0: incomplete xpath expressions? [message #578329 is a reply to message #34483] Tue, 23 May 2006 13:54 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Yannick:

I have successfully extracted information from a UML model (created with UML
2.0.0RC4). But you probably require more information than is currently in
the documentation.

JET has implemented a nearly complete subset of the XPath 1.0 specification.
The interesting thing about the JET implementation is that it is not limited
to just XML documents. There are interfaces that allow adapting XPath
expressions to any data model that has a spanning subtree.

Things that are missing from the JET implementation are:
* full namespace support
* the implementation of one XPath function: id()
* the implementation of some of the XPath axes

See details below:

1) namespace recognition is not complete - there is no way to map a prefix
in an XPath expression to an namespace URI. Alternatives:
* Use the local-name() XPath function to test only the local name - this
will essentially ignore the namespace.
Example: foo/*[local-name() = 'bar']
* Use the name() XPath function to test against the QNames - this
requires you to know the prefix in the document you are using.
Example: foo/*[name() = 'prfx:bar']

Namespace support will not be completed for 1.0. But, I don't think you
need it to parse a UML document. See below.

2) Only the following XPath axis are implemented: child, parent, self and
attribute (and their abbreviations). If other axes are important (I noticed
you used //, which is equivalent using the descendent-or-self axis), please
submit a bugzilla:
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=JET&rep_platform=PC&op_sy s=Windows%20XP&priority=P3&bug_severity=normal&b ug_status=NEW&assigned_to=pelder%40ca.ibm.com&qa_con tact=&cc=&bug_file_loc=http%3A%2F%2F&short_desc= &comment=&commentprivacy=0&keywords=&depends on=&blocked=&maketemplate=Remember%20values%20as%20b ookmarkable%20template&form_name=enter_bug

(sorry for the long URL, but it fills in most of the required fields for
you).

3) The JET XPath engine adapts to any EMF-based model (including UML2), as
follows:

* '/' refers to the document root (which, if you are familiar with the
EMF API's, is the EMF Resource)
* There is a special child of the document root implemented named
'contents' (which mirrors Resource.getContents()).
* If you have an XPath expression matching a subclass of EObject, then:
EReference features correspond to XPath child elements
EAttribute features correspond to XPath attribute

Example: If you have a typical UML model with a root object of type
Model, here are a number of XPath expressions you can use:

/contents - matches the root Model element
/contents/@name - returns the name of the Model element
/contents/nestedPackage - returns the packages contained
directly by the model

As a bonus, and because the UML meta-model in particular is so large and
most people don't know the feature names used for navigating the model, the
XPath engine will also recognize an eClass name when searching an element
axis. The best way to understand this is some more examples:

/Model - matches an EObject of type Model contained directly
by the root Resource
/Model/Package matches all EObjects of type Package contained
by the root Model object.


Paul Elder
JET2 Lead

"Yannick" <yannick@anyware-tech.com> wrote in message
news:e4kqls$5p4$1@utils.eclipse.org...
> Hi,
>
> I tried to use JET to parse, and generate files from a uml model, but I
> encountered several problems:
>
> 1) JET can't recognize namespaces (or I don't know how to)
> 2) Xpath axes (ex: child::mytag) or some xpath syntax (ex: root//mytag)
> are not supported.
>
> Could someone tell me how I could do those please?
Re: JET 1.0.0: incomplete xpath expressions? [message #578993 is a reply to message #34655] Fri, 26 May 2006 08:15 Go to previous message
yannick chong is currently offline yannick chongFriend
Messages: 19
Registered: July 2009
Junior Member
Thanks a lot for your reply, Paul.

I'll take my time to fully understand all you wrote. (It would also be
nice if your explanations could be in the documentation ;) )

Paul Elder a écrit :
> Yannick:
>
> I have successfully extracted information from a UML model (created with UML
> 2.0.0RC4). But you probably require more information than is currently in
> the documentation.
>
> JET has implemented a nearly complete subset of the XPath 1.0 specification.
> The interesting thing about the JET implementation is that it is not limited
> to just XML documents. There are interfaces that allow adapting XPath
> expressions to any data model that has a spanning subtree.
>
> Things that are missing from the JET implementation are:
> * full namespace support
> * the implementation of one XPath function: id()
> * the implementation of some of the XPath axes
>
> See details below:
>
> 1) namespace recognition is not complete - there is no way to map a prefix
> in an XPath expression to an namespace URI. Alternatives:
> * Use the local-name() XPath function to test only the local name - this
> will essentially ignore the namespace.
> Example: foo/*[local-name() = 'bar']
> * Use the name() XPath function to test against the QNames - this
> requires you to know the prefix in the document you are using.
> Example: foo/*[name() = 'prfx:bar']
>
> Namespace support will not be completed for 1.0. But, I don't think you
> need it to parse a UML document. See below.
>
> 2) Only the following XPath axis are implemented: child, parent, self and
> attribute (and their abbreviations). If other axes are important (I noticed
> you used //, which is equivalent using the descendent-or-self axis), please
> submit a bugzilla:
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EMFT& ;version=1.0&component=JET&rep_platform=PC&op_sy s=Windows%20XP&priority=P3&bug_severity=normal&b ug_status=NEW&assigned_to=pelder%40ca.ibm.com&qa_con tact=&cc=&bug_file_loc=http%3A%2F%2F&short_desc= &comment=&commentprivacy=0&keywords=&depends on=&blocked=&maketemplate=Remember%20values%20as%20b ookmarkable%20template&form_name=enter_bug
>
> (sorry for the long URL, but it fills in most of the required fields for
> you).
>
> 3) The JET XPath engine adapts to any EMF-based model (including UML2), as
> follows:
>
> * '/' refers to the document root (which, if you are familiar with the
> EMF API's, is the EMF Resource)
> * There is a special child of the document root implemented named
> 'contents' (which mirrors Resource.getContents()).
> * If you have an XPath expression matching a subclass of EObject, then:
> EReference features correspond to XPath child elements
> EAttribute features correspond to XPath attribute
>
> Example: If you have a typical UML model with a root object of type
> Model, here are a number of XPath expressions you can use:
>
> /contents - matches the root Model element
> /contents/@name - returns the name of the Model element
> /contents/nestedPackage - returns the packages contained
> directly by the model
>
> As a bonus, and because the UML meta-model in particular is so large and
> most people don't know the feature names used for navigating the model, the
> XPath engine will also recognize an eClass name when searching an element
> axis. The best way to understand this is some more examples:
>
> /Model - matches an EObject of type Model contained directly
> by the root Resource
> /Model/Package matches all EObjects of type Package contained
> by the root Model object.
>
>
> Paul Elder
> JET2 Lead
Re: JET 1.0.0: incomplete xpath expressions? [message #579068 is a reply to message #35326] Fri, 26 May 2006 12:29 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Yannick:

I'm working (slowly) on the documentation. This week's integration build
includes some getting started material. Next week, there should be more
reference material, too.

Also, this week's integration build includes an implementation of the
'descendent-or-self' axis.

Paul
"Yannick" <yannick@anyware-tech.com> wrote in message
news:e56dfq$cr3$1@utils.eclipse.org...
> Thanks a lot for your reply, Paul.
>
> I'll take my time to fully understand all you wrote. (It would also be
> nice if your explanations could be in the documentation ;) )
>
> Paul Elder a
Previous Topic:[Announce] EMFT JETEDITOR 1.0.0 I200605251611 is available
Next Topic:support for map types in uml2 or emf
Goto Forum:
  


Current Time: Sat Jul 27 05:30:31 GMT 2024

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

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

Back to the top