Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XPAth Syntax - /@defines.1/@defines....
XPAth Syntax - /@defines.1/@defines.... [message #425608] Wed, 03 December 2008 12:20 Go to next message
Eclipse UserFriend
Originally posted by: Christian.Ries.immobilienscout24.de

Hi,

I got a metamodel with some interna references, but I don't understand quite
enough how this syntax works.

This is the XPath command: //@defines.1/@defines.0/@defines.0

Any ideas???

And for your intereset, this is a code part of the model:
<Metamodel:Webapplication xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:Metamodel="Metamodel" name="Blah">
<defines name="K_Glucky">
<defines name="EG Weltenreiter" type="EG" criticality="0"
testobject="true">
<defines name="R Hier" type="R"
refersTo="//@defines.1/@defines.0/@defines.0" testobject="false"/>
<defines name="R Steh" type="R"
refersTo="//@defines.2/@defines.0/@defines.0" testobject="false"/>
<defines name="R Ich" type="R"
refersTo="//@defines.3/@defines.0/@defines.0" testobject="false"/>
<defines name="R Am" type="R"
refersTo="//@defines.4/@defines.0/@defines.0" testobject="false"/>
<defines name="L See" type="L"
refersTo="//@defines.6/@defines.0/@defines.0" testobject="false"/>
</defines>
</defines>
</Metamodel:Webapplication>
Re: XPAth Syntax - /@defines.1/@defines.... [message #425611 is a reply to message #425608] Wed, 03 December 2008 12:40 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050007070206080802050108
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christian,

Comments below.

Christian Ries wrote:
> Hi,
>
> I got a metamodel with some interna references, but I don't understand quite
> enough how this syntax works.
>
> This is the XPath command: //@defines.1/@defines.0/@defines.0
>
It's not really xpath...


String
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82String >
org.eclipse.emf.ecore.InternalEObject
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct >.eURIFragmentSegment(EStructuralFeature
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82EStructuralFeature >
eFeature, EObject
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82EObject >
eObject)

Returns the fragment segment that, when passed to
|eObjectForURIFragmentSegment
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82%E2%98%82eObjectForURIFragmentSegment >|,
will resolve to the given object in this object's given feature.

The feature argument may be |null| in which case it will be
deduced, if possible. The default result will be of the form:

"@<feature-name>[.<index>]"


The index is used only for |many-valued
< eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82ETypedElement%E2%98%82isMany%E2%98%82 >|
features; it represents the position within the list.

Parameters:
*eFeature* the feature relating the given object to this object,
or |null|.
*eObject* the object to be identified.
Returns:
the fragment segment that resolves to the given object in this
object's given feature.

The first segment walks from the Resource.getContents() to a direct
child and /0 is reduced to just /; from there the above syntax is used
to walk down the tree.

Note that you might want to make the name feature of the "defines"
feature's type be a eKey with respect to the "defines" containment
reference such that you end up with segments like
@defines[name='K_Glucky']. Of course that assumes that the names within
any particular "defines" containment reference will be unique.
> Any ideas???
>
> And for your intereset, this is a code part of the model:
> <Metamodel:Webapplication xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:Metamodel="Metamodel" name="Blah">
> <defines name="K_Glucky">
> <defines name="EG Weltenreiter" type="EG" criticality="0"
> testobject="true">
> <defines name="R Hier" type="R"
> refersTo="//@defines.1/@defines.0/@defines.0" testobject="false"/>
> <defines name="R Steh" type="R"
> refersTo="//@defines.2/@defines.0/@defines.0" testobject="false"/>
> <defines name="R Ich" type="R"
> refersTo="//@defines.3/@defines.0/@defines.0" testobject="false"/>
> <defines name="R Am" type="R"
> refersTo="//@defines.4/@defines.0/@defines.0" testobject="false"/>
> <defines name="L See" type="L"
> refersTo="//@defines.6/@defines.0/@defines.0" testobject="false"/>
> </defines>
> </defines>
> </Metamodel:Webapplication>
>
>
>

--------------050007070206080802050108
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>
Comments below.<br>
<br>
Christian Ries wrote:
<blockquote cite="mid:gh5tj8$u44$1@build.eclipse.org" type="cite">
<pre wrap="">Hi,

I got a metamodel with some interna references, but I don't understand quite
enough how this syntax works.

This is the XPath command: //@defines.1/@defines.0/@defines.0
</pre>
</blockquote>
It's not really xpath...<br>
<blockquote>
<h5>
<div style="margin-top: 0px; margin-left: 22px;"><a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82String ">String</a>
org.eclipse.emf.ecore.<a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct ">InternalEObject</a>.eURIFragmentSegment(<a
class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82EStructuralFeature ">EStructuralFeature</a>
eFeature, <a class="header"
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82EObject ">EObject</a>
eObject)</div>
</h5>
</blockquote>
<blockquote>
<blockquote>
<p>Returns the fragment segment that, when passed to <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82%E2%98%82eObjectForURIFragmentSegment ">eObjectForURIFragmentSegment</a></code>,
will resolve to the given object in this object's given feature. </p>
<p>The feature argument may be <code>null</code> in which case it
will be deduced, if possible. The default result will be of the form: </p>
<pre> "@&lt;feature-name&gt;[.&lt;index&gt;]"
</pre>
The index is used only for <code><a
href=" eclipse-javadoc:%E2%98%82=org.eclipse.emf.ecore/src%3Corg.ec lipse.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObje ct%7EeURIFragmentSegment%7EQEStructuralFeature;%7EQEObject;% E2%98%82ETypedElement%E2%98%82isMany%E2%98%82 ">many-valued</a></code>
features; it represents the position within the list. </blockquote>
<dl>
<dt>Parameters:
</dt>
<dd><b>eFeature</b> the feature relating the given object to this
object, or <code>null</code>.
</dd>
<dd><b>eObject</b> the object to be identified.
</dd>
<dt>Returns:
</dt>
<dd>the fragment segment that resolves to the given object in this
object's given feature.</dd>
</dl>
</blockquote>
The first segment walks from the Resource.getContents() to a direct
child and /0 is reduced to just /; from there the above syntax is used
to walk down the tree.<br>
<br>
Note that you might want to make the name feature of the "defines"
feature's type be a eKey with respect to the "defines" containment
reference such that you end up with&nbsp; segments like
@defines[name='K_Glucky'].&nbsp; Of course that assumes that the names
within any particular "defines" containment reference will be unique.
<blockquote cite="mid:gh5tj8$u44$1@build.eclipse.org" type="cite">
<pre wrap="">
Any ideas???

And for your intereset, this is a code part of the model:
&lt;Metamodel:Webapplication xmlns:xmi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/XMI">"http://www.omg.org/XMI"</a>
xmlns:xsi=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/2001/XMLSchema-instance"</a>
xmlns:Metamodel="Metamodel" name="Blah"&gt;
&lt;defines name="K_Glucky"&gt;
&lt;defines name="EG Weltenreiter" type="EG" criticality="0"
testobject="true"&gt;
&lt;defines name="R Hier" type="R"
refersTo=<a class="moz-txt-link-rfc2396E" href="mailto://@defines.1/@defines.0/@defines.0">"//@defines.1/@defines.0/@defines.0"</a> testobject="false"/&gt;
&lt;defines name="R Steh" type="R"
refersTo=<a class="moz-txt-link-rfc2396E" href="mailto://@defines.2/@defines.0/@defines.0">"//@defines.2/@defines.0/@defines.0"</a> testobject="false"/&gt;
&lt;defines name="R Ich" type="R"
refersTo=<a class="moz-txt-link-rfc2396E" href="mailto://@defines.3/@defines.0/@defines.0">"//@defines.3/@defines.0/@defines.0"</a> testobject="false"/&gt;
&lt;defines name="R Am" type="R"
refersTo=<a class="moz-txt-link-rfc2396E" href="mailto://@defines.4/@defines.0/@defines.0">"//@defines.4/@defines.0/@defines.0"</a> testobject="false"/&gt;
&lt;defines name="L See" type="L"
refersTo=<a class="moz-txt-link-rfc2396E" href="mailto://@defines.6/@defines.0/@defines.0">"//@defines.6/@defines.0/@defines.0"</a> testobject="false"/&gt;
&lt;/defines&gt;
&lt;/defines&gt;
&lt;/Metamodel:Webapplication&gt;


</pre>
</blockquote>
</body>
</html>

--------------050007070206080802050108--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XPAth Syntax - /@defines.1/@defines.... [message #425614 is a reply to message #425611] Wed, 03 December 2008 12:52 Go to previous message
Eclipse UserFriend
Originally posted by: Christian.Ries.immobilienscout24.de

This is a multi-part message in MIME format.

------=_NextPart_000_0023_01C9554E.56EAAC80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Thx mate!!!

"Ed Merks" <Ed.Merks@gmail.com> schrieb im Newsbeitrag =
news:gh5uog$2bk$1@build.eclipse.org...
Christian,

Comments below.

Christian Ries wrote:=20
Hi,

I got a metamodel with some interna references, but I don't understand =
quite=20
enough how this syntax works.

This is the XPath command: //@defines.1/@defines.0/@defines.0
It's not really xpath...

String =
org.eclipse.emf.ecore.InternalEObject.eURIFragmentSegment(ES tructuralFeat=
ure eFeature, EObject eObject)
Returns the fragment segment that, when passed to =
eObjectForURIFragmentSegment, will resolve to the given object in this =
object's given feature.=20

The feature argument may be null in which case it will be deduced, =
if possible. The default result will be of the form:=20

"@<feature-name>[.<index>]"
The index is used only for many-valued features; it represents the =
position within the list.=20
Parameters:=20
eFeature the feature relating the given object to this object, or =
null.=20
eObject the object to be identified.=20
Returns:=20
the fragment segment that resolves to the given object in this =
object's given feature.=20
The first segment walks from the Resource.getContents() to a direct =
child and /0 is reduced to just /; from there the above syntax is used =
to walk down the tree.

Note that you might want to make the name feature of the "defines" =
feature's type be a eKey with respect to the "defines" containment =
reference such that you end up with segments like =
@defines[name=3D'K_Glucky']. Of course that assumes that the names =
within any particular "defines" containment reference will be unique.=20
Any ideas???

And for your intereset, this is a code part of the model:
<Metamodel:Webapplication xmlns:xmi=3D"http://www.omg.org/XMI"
xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"
xmlns:Metamodel=3D"Metamodel" name=3D"Blah">
<defines name=3D"K_Glucky">
<defines name=3D"EG Weltenreiter" type=3D"EG" criticality=3D"0"=20
testobject=3D"true">
<defines name=3D"R Hier" type=3D"R"=20
refersTo=3D"//@defines.1/@defines.0/@defines.0" testobject=3D"false"/>
<defines name=3D"R Steh" type=3D"R"=20
refersTo=3D"//@defines.2/@defines.0/@defines.0" testobject=3D"false"/>
<defines name=3D"R Ich" type=3D"R"=20
refersTo=3D"//@defines.3/@defines.0/@defines.0" testobject=3D"false"/>
<defines name=3D"R Am" type=3D"R"=20
refersTo=3D"//@defines.4/@defines.0/@defines.0" testobject=3D"false"/>
<defines name=3D"L See" type=3D"L"=20
refersTo=3D"//@defines.6/@defines.0/@defines.0" testobject=3D"false"/>
</defines>
</defines>
</Metamodel:Webapplication>=20



------=_NextPart_000_0023_01C9554E.56EAAC80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type =
content=3Dtext/html;charset=3DISO-8859-1>
<META content=3D"MSHTML 6.00.2900.5659" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY text=3D#000000 bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Thx mate!!!</FONT></DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" &lt;<A=20
href=3D"mailto:Ed.Merks@gmail.com">Ed.Merks@gmail.com</A>&gt; schrieb =
im=20
Newsbeitrag <A=20
=
href=3D"news:gh5uog$2bk$1@build.eclipse.org">news:gh5uog$2bk$1@build.ecli=
pse.org</A>...</DIV>Christian,<BR><BR>Comments=20
below.<BR><BR>Christian Ries wrote:=20
<BLOCKQUOTE cite=3Dmid:gh5tj8$u44$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Hi,

I got a metamodel with some interna references, but I don't understand =
quite=20
enough how this syntax works.

This is the XPath command: //@defines.1/@defines.0/@defines.0
</PRE></BLOCKQUOTE>It's not really xpath...<BR>
<BLOCKQUOTE>
<H5>
<DIV style=3D"MARGIN-TOP: 0px; MARGIN-LEFT: 22px"><A class=3Dheader=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject% 7EeURIFragmen=
tSegment%7EQEStructuralFeature;%7EQEObject;%E2%98%82String">String </A>=20
org.eclipse.emf.ecore.<A class=3Dheader=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject" >InternalEObj=
ect</A>.eURIFragmentSegment(<A=20
class=3Dheader=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject% 7EeURIFragmen=
tSegment%7EQEStructuralFeature;%7EQEObject;%E2%98%82EStructu ralFeature ">E=
StructuralFeature</A>=20
eFeature, <A class=3Dheader=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject% 7EeURIFragmen=
tSegment%7EQEStructuralFeature;%7EQEObject;%E2%98%82EObject" >EObject</A> =

eObject)</DIV></H5></BLOCKQUOTE>
<BLOCKQUOTE>
<BLOCKQUOTE>
<P>Returns the fragment segment that, when passed to <CODE><A=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject% 7EeURIFragmen=
tSegment%7EQEStructuralFeature;%7EQEObject;%E2%98%82%E2%98%8 2eObjectForUR=
IFragmentSegment">eObjectForURIFragmentSegment</A></CODE>,=20
will resolve to the given object in this object's given feature. =
</P>
<P>The feature argument may be <CODE>null</CODE> in which case it =
will be=20
deduced, if possible. The default result will be of the form: =
</P><PRE> "@&lt;feature-name&gt;[.&lt;index&gt;]"
</PRE>The index is used only for <CODE><A=20
=
href=3D" eclipse-javadoc:%E2%98%82=3Dorg.eclipse.emf.ecore/src%3Corg. eclip=
se.emf.ecore%7BInternalEObject.java%E2%98%83InternalEObject% 7EeURIFragmen=
tSegment%7EQEStructuralFeature;%7EQEObject;%E2%98%82ETypedEl ement%E2%98%8=
2isMany%E2%98%82">many-valued</A></CODE>=20
features; it represents the position within the list. =
</BLOCKQUOTE>
<DL>
<DT>Parameters:=20
<DD><B>eFeature</B> the feature relating the given object to this =
object,=20
or <CODE>null</CODE>.=20
<DD><B>eObject</B> the object to be identified.=20
<DT>Returns:=20
<DD>the fragment segment that resolves to the given object in this =

object's given feature. </DD></DL></BLOCKQUOTE>The first segment =
walks from=20
the Resource.getContents() to a direct child and /0 is reduced to just =
/; from=20
there the above syntax is used to walk down the tree.<BR><BR>Note that =
you=20
might want to make the name feature of the "defines" feature's type be =
a eKey=20
with respect to the "defines" containment reference such that you end =
up=20
with&nbsp; segments like @defines[name=3D'K_Glucky'].&nbsp; Of course =
that=20
assumes that the names within any particular "defines" containment =
reference=20
will be unique.=20
<BLOCKQUOTE cite=3Dmid:gh5tj8$u44$1@build.eclipse.org =
type=3D"cite"><PRE wrap=3D"">Any ideas???

And for your intereset, this is a code part of the model:
&lt;Metamodel:Webapplication xmlns:xmi=3D<A =
class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.omg.org/XMI">"http://www.omg.org/XMI"</A>
xmlns:xsi=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"http://www.w3.org/2001/XMLSchema-instance">"http://www.w3.org/200=
1/XMLSchema-instance"</A>
xmlns:Metamodel=3D"Metamodel" name=3D"Blah"&gt;
&lt;defines name=3D"K_Glucky"&gt;
&lt;defines name=3D"EG Weltenreiter" type=3D"EG" criticality=3D"0"=20
testobject=3D"true"&gt;
&lt;defines name=3D"R Hier" type=3D"R"=20
refersTo=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto://@defines.1/@defines.0/@defines.0">"//@defines.1/@defines=
..0/@defines.0"</A> testobject=3D"false"/&gt;
&lt;defines name=3D"R Steh" type=3D"R"=20
refersTo=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto://@defines.2/@defines.0/@defines.0">"//@defines.2/@defines=
..0/@defines.0"</A> testobject=3D"false"/&gt;
&lt;defines name=3D"R Ich" type=3D"R"=20
refersTo=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto://@defines.3/@defines.0/@defines.0">"//@defines.3/@defines=
..0/@defines.0"</A> testobject=3D"false"/&gt;
&lt;defines name=3D"R Am" type=3D"R"=20
refersTo=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto://@defines.4/@defines.0/@defines.0">"//@defines.4/@defines=
..0/@defines.0"</A> testobject=3D"false"/&gt;
&lt;defines name=3D"L See" type=3D"L"=20
refersTo=3D<A class=3Dmoz-txt-link-rfc2396E =
href=3D"mailto://@defines.6/@defines.0/@defines.0">"//@defines.6/@defines=
..0/@defines.0"</A> testobject=3D"false"/&gt;
&lt;/defines&gt;
&lt;/defines&gt;
&lt;/Metamodel:Webapplication&gt;=20


</PRE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0023_01C9554E.56EAAC80--
Previous Topic:Problem using SimpleAnyType
Next Topic:Problem: Pasting Non Containment References when withInverseElist is true.
Goto Forum:
  


Current Time: Fri Apr 19 03:28:14 GMT 2024

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

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

Back to the top