You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Frank Budinsky <fr...@ca.ibm.com> on 2007/03/23 19:34:09 UTC

Re: XPath

What object is "root"? Is it a company instance? If so, this should work:

root.get("departments/employees");

If it's not, then maybe you need something like this:

root.get("company/departments/employees"); 

How did you load the instances?

Frank.


"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007 01:26:48 
PM:

> Are wildcards supported in the XPath implementation within Tuscany to
> group collections.  For instance in the company example in the spec I
> would like to get a list of all the employees in the company.
> 
> Tried the following in vain:
> 
> 
> 
> root.get("/*/employees")
> 
> root.get("//employees") 
> 
> root.get("/departments/employees") 
> 
> 
> 
> Thanks,
> 
> Murtaza.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


RE: XPath

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
Thanks.

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Friday, March 23, 2007 5:16 PM
To: tuscany-user@ws.apache.org
Subject: RE: XPath

Unfortunately that's not supported in SDO's subset of XPath - see
Section 
12 of the spec: 

http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?v
ersion=1

There is a proposal to support more (maybe all) of XPath in the next 
version of SDO.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
05:06:24 
PM:

> That works fine.  What I want is all the employees irrespective of the
> department grouped together in a single collection.
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Friday, March 23, 2007 5:01 PM
> To: tuscany-user@ws.apache.org
> Subject: RE: XPath
> 
> I see. Sorry, I didn't notice before, but you need an index on
> departments 
> like this:
> 
> root.get("departments[1]/employees");
> 
> or this:
> 
> root.get("departments[2]/employees");
> 
> Frank.
> 
> 
> 
> 
> "Murtaza Goga" <Mu...@trisyngroup.com> 
> 03/23/2007 04:28 PM
> Please respond to
> tuscany-user@ws.apache.org
> 
> 
> To
> <tu...@ws.apache.org>
> cc
> 
> Subject
> RE: XPath
> 
> 
> 
> 
> 
> 
> "root" is the company instance.  The first expression results in a
> ClassCastException and the second returns a null.
> 
> This is what my graph looks this:
> 
> <?xml version="1.0" encoding="ASCII"?>
> <sdo:datagraph xmlns:company="company.xsd" xmlns:sdo="commonj.sdo">
>   <company:CompanyType>
>     <departments location="Test Location - [0]">
>       <employees name="Test Name - [0][0]"/>
>     </departments>
>     <departments location="Test Location - [1]">
>       <employees name="Test Name - [1][0]"/>
>       <employees name="Test Name - [1][1]"/>
>     </departments>
>   </company:CompanyType>
> </sdo:datagraph>
> 
> created in my test case with SDOUtil.createDataGraph() and
> DataObject.createDataObject for the rest of the containment.
> 
>  -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Friday, March 23, 2007 2:34 PM
> To: tuscany-user@ws.apache.org
> Cc: tuscany-user@ws.apache.org
> Subject: Re: XPath
> 
> What object is "root"? Is it a company instance? If so, this should
> work:
> 
> root.get("departments/employees");
> 
> If it's not, then maybe you need something like this:
> 
> root.get("company/departments/employees"); 
> 
> How did you load the instances?
> 
> Frank.
> 
> 
> "Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
> 01:26:48 
> PM:
> 
> > Are wildcards supported in the XPath implementation within Tuscany
to
> > group collections.  For instance in the company example in the spec
I
> > would like to get a list of all the employees in the company.
> > 
> > Tried the following in vain:
> > 
> > 
> > 
> > root.get("/*/employees")
> > 
> > root.get("//employees") 
> > 
> > root.get("/departments/employees") 
> > 
> > 
> > 
> > Thanks,
> > 
> > Murtaza.
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


RE: XPath

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Unfortunately that's not supported in SDO's subset of XPath - see Section 
12 of the spec: 

http://osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf?version=1

There is a proposal to support more (maybe all) of XPath in the next 
version of SDO.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007 05:06:24 
PM:

> That works fine.  What I want is all the employees irrespective of the
> department grouped together in a single collection.
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Friday, March 23, 2007 5:01 PM
> To: tuscany-user@ws.apache.org
> Subject: RE: XPath
> 
> I see. Sorry, I didn't notice before, but you need an index on
> departments 
> like this:
> 
> root.get("departments[1]/employees");
> 
> or this:
> 
> root.get("departments[2]/employees");
> 
> Frank.
> 
> 
> 
> 
> "Murtaza Goga" <Mu...@trisyngroup.com> 
> 03/23/2007 04:28 PM
> Please respond to
> tuscany-user@ws.apache.org
> 
> 
> To
> <tu...@ws.apache.org>
> cc
> 
> Subject
> RE: XPath
> 
> 
> 
> 
> 
> 
> "root" is the company instance.  The first expression results in a
> ClassCastException and the second returns a null.
> 
> This is what my graph looks this:
> 
> <?xml version="1.0" encoding="ASCII"?>
> <sdo:datagraph xmlns:company="company.xsd" xmlns:sdo="commonj.sdo">
>   <company:CompanyType>
>     <departments location="Test Location - [0]">
>       <employees name="Test Name - [0][0]"/>
>     </departments>
>     <departments location="Test Location - [1]">
>       <employees name="Test Name - [1][0]"/>
>       <employees name="Test Name - [1][1]"/>
>     </departments>
>   </company:CompanyType>
> </sdo:datagraph>
> 
> created in my test case with SDOUtil.createDataGraph() and
> DataObject.createDataObject for the rest of the containment.
> 
>  -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Friday, March 23, 2007 2:34 PM
> To: tuscany-user@ws.apache.org
> Cc: tuscany-user@ws.apache.org
> Subject: Re: XPath
> 
> What object is "root"? Is it a company instance? If so, this should
> work:
> 
> root.get("departments/employees");
> 
> If it's not, then maybe you need something like this:
> 
> root.get("company/departments/employees"); 
> 
> How did you load the instances?
> 
> Frank.
> 
> 
> "Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
> 01:26:48 
> PM:
> 
> > Are wildcards supported in the XPath implementation within Tuscany to
> > group collections.  For instance in the company example in the spec I
> > would like to get a list of all the employees in the company.
> > 
> > Tried the following in vain:
> > 
> > 
> > 
> > root.get("/*/employees")
> > 
> > root.get("//employees") 
> > 
> > root.get("/departments/employees") 
> > 
> > 
> > 
> > Thanks,
> > 
> > Murtaza.
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


RE: XPath

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
That works fine.  What I want is all the employees irrespective of the
department grouped together in a single collection.

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Friday, March 23, 2007 5:01 PM
To: tuscany-user@ws.apache.org
Subject: RE: XPath

I see. Sorry, I didn't notice before, but you need an index on
departments 
like this:

root.get("departments[1]/employees");

or this:

root.get("departments[2]/employees");

Frank.




"Murtaza Goga" <Mu...@trisyngroup.com> 
03/23/2007 04:28 PM
Please respond to
tuscany-user@ws.apache.org


To
<tu...@ws.apache.org>
cc

Subject
RE: XPath






"root" is the company instance.  The first expression results in a
ClassCastException and the second returns a null.

This is what my graph looks this:

<?xml version="1.0" encoding="ASCII"?>
<sdo:datagraph xmlns:company="company.xsd" xmlns:sdo="commonj.sdo">
  <company:CompanyType>
    <departments location="Test Location - [0]">
      <employees name="Test Name - [0][0]"/>
    </departments>
    <departments location="Test Location - [1]">
      <employees name="Test Name - [1][0]"/>
      <employees name="Test Name - [1][1]"/>
    </departments>
  </company:CompanyType>
</sdo:datagraph>

created in my test case with SDOUtil.createDataGraph() and
DataObject.createDataObject for the rest of the containment.

 -----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Friday, March 23, 2007 2:34 PM
To: tuscany-user@ws.apache.org
Cc: tuscany-user@ws.apache.org
Subject: Re: XPath

What object is "root"? Is it a company instance? If so, this should
work:

root.get("departments/employees");

If it's not, then maybe you need something like this:

root.get("company/departments/employees"); 

How did you load the instances?

Frank.


"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
01:26:48 
PM:

> Are wildcards supported in the XPath implementation within Tuscany to
> group collections.  For instance in the company example in the spec I
> would like to get a list of all the employees in the company.
> 
> Tried the following in vain:
> 
> 
> 
> root.get("/*/employees")
> 
> root.get("//employees") 
> 
> root.get("/departments/employees") 
> 
> 
> 
> Thanks,
> 
> Murtaza.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


RE: XPath

Posted by Frank Budinsky <fr...@ca.ibm.com>.
I see. Sorry, I didn't notice before, but you need an index on departments 
like this:

root.get("departments[1]/employees");

or this:

root.get("departments[2]/employees");

Frank.




"Murtaza Goga" <Mu...@trisyngroup.com> 
03/23/2007 04:28 PM
Please respond to
tuscany-user@ws.apache.org


To
<tu...@ws.apache.org>
cc

Subject
RE: XPath






"root" is the company instance.  The first expression results in a
ClassCastException and the second returns a null.

This is what my graph looks this:

<?xml version="1.0" encoding="ASCII"?>
<sdo:datagraph xmlns:company="company.xsd" xmlns:sdo="commonj.sdo">
  <company:CompanyType>
    <departments location="Test Location - [0]">
      <employees name="Test Name - [0][0]"/>
    </departments>
    <departments location="Test Location - [1]">
      <employees name="Test Name - [1][0]"/>
      <employees name="Test Name - [1][1]"/>
    </departments>
  </company:CompanyType>
</sdo:datagraph>

created in my test case with SDOUtil.createDataGraph() and
DataObject.createDataObject for the rest of the containment.

 -----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Friday, March 23, 2007 2:34 PM
To: tuscany-user@ws.apache.org
Cc: tuscany-user@ws.apache.org
Subject: Re: XPath

What object is "root"? Is it a company instance? If so, this should
work:

root.get("departments/employees");

If it's not, then maybe you need something like this:

root.get("company/departments/employees"); 

How did you load the instances?

Frank.


"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
01:26:48 
PM:

> Are wildcards supported in the XPath implementation within Tuscany to
> group collections.  For instance in the company example in the spec I
> would like to get a list of all the employees in the company.
> 
> Tried the following in vain:
> 
> 
> 
> root.get("/*/employees")
> 
> root.get("//employees") 
> 
> root.get("/departments/employees") 
> 
> 
> 
> Thanks,
> 
> Murtaza.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


RE: XPath

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
"root" is the company instance.  The first expression results in a
ClassCastException and the second returns a null.

This is what my graph looks this:

<?xml version="1.0" encoding="ASCII"?>
<sdo:datagraph xmlns:company="company.xsd" xmlns:sdo="commonj.sdo">
  <company:CompanyType>
    <departments location="Test Location - [0]">
      <employees name="Test Name - [0][0]"/>
    </departments>
    <departments location="Test Location - [1]">
      <employees name="Test Name - [1][0]"/>
      <employees name="Test Name - [1][1]"/>
    </departments>
  </company:CompanyType>
</sdo:datagraph>

created in my test case with SDOUtil.createDataGraph() and
DataObject.createDataObject for the rest of the containment.

 -----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Friday, March 23, 2007 2:34 PM
To: tuscany-user@ws.apache.org
Cc: tuscany-user@ws.apache.org
Subject: Re: XPath

What object is "root"? Is it a company instance? If so, this should
work:

root.get("departments/employees");

If it's not, then maybe you need something like this:

root.get("company/departments/employees"); 

How did you load the instances?

Frank.


"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 03/23/2007
01:26:48 
PM:

> Are wildcards supported in the XPath implementation within Tuscany to
> group collections.  For instance in the company example in the spec I
> would like to get a list of all the employees in the company.
> 
> Tried the following in vain:
> 
> 
> 
> root.get("/*/employees")
> 
> root.get("//employees") 
> 
> root.get("/departments/employees") 
> 
> 
> 
> Thanks,
> 
> Murtaza.
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org