You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Santhosh Adiga <kb...@gmail.com> on 2008/06/16 11:11:30 UTC

Serializing non-containment reference

Hi,

  I am trying to serialize and deserialize a SDO containing a
non-containment reference. Here is the xsd corresponding to the SDO.

<xsd:import namespace="commonj.sdo/xml"
        schemaLocation="sdoXML.xsd">
    </xsd:import>
    <xsd:complexType mixed="true" name="InvolvedPartyImpl">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="involvedPartySurrogate"
                type="domain:SurrogateDomain" />
            <xsd:element minOccurs="0" name="organizationOrPerson"
                type="domain:OrganizationOrPersonDomain" />
            <xsd:element minOccurs="0" name="paymentPlan"
                type="bons0:PaymentPlan" maxOccurs="1">
            </xsd:element>
            <xsd:element minOccurs="0" name="financialTransactions"
                type="bons0:FinancialTransactions">
            </xsd:element>
            <xsd:element minOccurs="0" name="refInvolvedParty"
                type="bons0:InvolvedPartyImpl" maxOccurs="1">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="PaymentPlan">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="PaymentPlanName"
                type="xsd:string">
            </xsd:element>
            <xsd:element minOccurs="0" name="PaymentPlanID"
                type="xsd:int">
            </xsd:element>
            <xsd:element minOccurs="0" name="refInvolvedParty"
                type="xsd:anyURI" sdoXML:propertyType="InvolvedPartyImpl">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="FinancialTransaction">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="financialTransaction"
                type="xsd:double">
            </xsd:element>
            <xsd:element minOccurs="0" name="financialTransactionID"
                type="xsd:long">
            </xsd:element>
            <xsd:element minOccurs="0" name="refInvolvedParty"
                type="xsd:anyURI" sdoXML:propertyType="InvolvedPartyImpl"
                maxOccurs="1">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="FinancialTransactions">
        <xsd:sequence>
            <xsd:element minOccurs="0" name="financialTransaction"
                type="bons0:FinancialTransaction" maxOccurs="unbounded">
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>





As you can see the payment plan contains a reference to an involved party.
When the referenced involved party is present in the same data graph
as the payment plan, here is the serialized xml i am getting.

<?xml version="1.0" encoding="UTF-8"?>
<p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.abc.com/edm/entities">
    <financialTransactions>
        <financialTransaction>
            <financialTransactionID>13</financialTransactionID>
        </financialTransaction>
        <financialTransaction>
            <financialTransactionID>12</financialTransactionID>
        </financialTransaction>
    </financialTransactions>
    <involvedPartySurrogate>23</involvedPartySurrogate>
    <paymentPlan>
        <PaymentPlanID>12</PaymentPlanID>
        *<refInvolvedParty>
            BusinessObject: InvolvedPartyImpl@70ee70ee
            (:mixed=[entities:involvedPartySurrogate=24],
            involvedPartySurrogate=24)
        </refInvolvedParty>*
    </paymentPlan>
    <refInvolvedParty>
        <involvedPartySurrogate>24</involvedPartySurrogate>
    </refInvolvedParty>
</p:InvolvedPartyImpl>


And I am having problems deserializing the reference involved party
obtained.
Could you let me know if there is any special trick to be applied while
serializing or deserializing a
non-containment reference and is it specific to any implementation?


Thanks
Santhosh

RE: Serializing non-containment reference

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
I think this is a bug related to serialization of static objects.  I did
not generate static code on the bank.xsd and ran the same testcase in
dynamic mode, I was able to get the objects without the proxies.  

Dynamic:
<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID">
      <Address>
        <Street>Some Street</Street>
        <City>Some City</City>
      </Address>
    </Branch>
    <Customer ID="theCustomerID">
      <HomeBranch>theBranchID</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>

Static:
<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID">
      <Address>
        <Street>Some Street</Street>
        <City>Some City</City>
      </Address>
    </Branch>
    <Customer ID="theCustomerID">
      <HomeBranch>#//@eRootObject/@Branch.0</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>


I had the static code consume the XML generated from the dynamic, it
still gave me a proxy, so it is a bi-directional issue.

Let me know your thoughts,
Thanks,
Murtaza.

-----Original Message-----
From: Murtaza Goga [mailto:Murtaza.Goga@trisyngroup.com] 
Sent: Thursday, June 19, 2008 11:09 AM
To: user@tuscany.apache.org
Subject: RE: Serializing non-containment reference

Thanks for the response Frank.  I did try serializing it as a datagraph
with the root as the bank object, same results - the loaded datagraph
had the proxies.

<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID"/>
    <Customer ID="theCustomerID">
      <HomeBranch>#//@eRootObject/@Branch.0</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>
This is from generated code with the bank.xsd in Tuscany.

We have been using this non containment strategy on some of our types
since the M2 release (Nov 2006).  Not sure how to resolve this with the
current release.

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Thursday, June 19, 2008 10:24 AM
To: user@tuscany.apache.org
Subject: RE: Serializing non-containment reference

SDO requires cross references to be "intenal" to the datagraph - that
is, 
they need to point to objects that are also reachable from containment 
references in the closed datagraph starting from the root of the 
serialization. EMF, which underlies the Tuscany SDO implementation also 
supports cross file references, so my guess is that the proxy is showing

up, but (really broken) in SDO, since you didn't serialize the datagraph

from the root.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 06/19/2008
07:43:46 
AM:

> Frank,
> On a parallel question, how do the non-containment references resolve
> after the object is de-serialized from such a graph?
> 
> I have something like this:
> <bank:bank xmlns:bank="http://www.example.com/bank">
>   <Branch ID="theBranchID"/>
>   <Customer ID="theCustomerID">
>     <HomeBranch>#//@bank/@Branch.0</HomeBranch>
>   </Customer>
> </bank:bank>
> 
> The 'HomeBranch' property on the 'Customer' ends up as a proxy after
the
> object is de-serialized?
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Monday, June 16, 2008 9:51 AM
> To: tuscany-user@ws.apache.org
> Subject: Re: Serializing non-containment reference
> 
> Hi Santhosh,
> 
> My guess is your schema definition has errors.
> 
> You should have something like this on the <schema> element:
> 
> xmlns:tns="... your models targetNamespace..."
> xmlns:sdoXML="commonj.sdo/xml"
> 
> and then the the cross reference declared like this:
> 
> sdoXML:propertyType="tns:InvolvedPartyImpl"
> 
> Also, I don't believe you need this import:
> 
>  <xsd:import namespace="commonj.sdo/xml"
>       schemaLocation="sdoXML.xsd">
>  </xsd:import>
> 
> since the annotation namespaces are automatically available.
> 
> Frank.
> 
> "Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:
> 
> > Hi,
> > 
> >   I am trying to serialize and deserialize a SDO containing a
> > non-containment reference. Here is the xsd corresponding to the SDO.
> > 
> > <xsd:import namespace="commonj.sdo/xml"
> >         schemaLocation="sdoXML.xsd">
> >     </xsd:import>
> >     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="involvedPartySurrogate"
> >                 type="domain:SurrogateDomain" />
> >             <xsd:element minOccurs="0" name="organizationOrPerson"
> >                 type="domain:OrganizationOrPersonDomain" />
> >             <xsd:element minOccurs="0" name="paymentPlan"
> >                 type="bons0:PaymentPlan" maxOccurs="1">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactions"
> >                 type="bons0:FinancialTransactions">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="PaymentPlan">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="PaymentPlanName"
> >                 type="xsd:string">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="PaymentPlanID"
> >                 type="xsd:int">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransaction">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="xsd:double">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactionID"
> >                 type="xsd:long">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl"
> >                 maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransactions">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="bons0:FinancialTransaction"
> maxOccurs="unbounded">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> > 
> > 
> > 
> > 
> > 
> > As you can see the payment plan contains a reference to an involved 
> party.
> > When the referenced involved party is present in the same data graph
> > as the payment plan, here is the serialized xml i am getting.
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xmlns:p="http://www.abc.com/edm/entities">
> >     <financialTransactions>
> >         <financialTransaction>
> >             <financialTransactionID>13</financialTransactionID>
> >         </financialTransaction>
> >         <financialTransaction>
> >             <financialTransactionID>12</financialTransactionID>
> >         </financialTransaction>
> >     </financialTransactions>
> >     <involvedPartySurrogate>23</involvedPartySurrogate>
> >     <paymentPlan>
> >         <PaymentPlanID>12</PaymentPlanID>
> >         *<refInvolvedParty>
> >             BusinessObject: InvolvedPartyImpl@70ee70ee
> >             (:mixed=[entities:involvedPartySurrogate=24],
> >             involvedPartySurrogate=24)
> >         </refInvolvedParty>*
> >     </paymentPlan>
> >     <refInvolvedParty>
> >         <involvedPartySurrogate>24</involvedPartySurrogate>
> >     </refInvolvedParty>
> > </p:InvolvedPartyImpl>
> > 
> > 
> > And I am having problems deserializing the reference involved party
> > obtained.
> > Could you let me know if there is any special trick to be applied
> while
> > serializing or deserializing a
> > non-containment reference and is it specific to any implementation?
> > 
> > 
> > Thanks
> > Santhosh
> 


RE: Serializing non-containment reference

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
I think this is a bug related to serialization of static objects.  I did
not generate static code on the bank.xsd and ran the same testcase in
dynamic mode, I was able to get the objects without the proxies.  

Dynamic:
<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID">
      <Address>
        <Street>Some Street</Street>
        <City>Some City</City>
      </Address>
    </Branch>
    <Customer ID="theCustomerID">
      <HomeBranch>theBranchID</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>

Static:
<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID">
      <Address>
        <Street>Some Street</Street>
        <City>Some City</City>
      </Address>
    </Branch>
    <Customer ID="theCustomerID">
      <HomeBranch>#//@eRootObject/@Branch.0</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>


I had the static code consume the XML generated from the dynamic, it
still gave me a proxy, so it is a bi-directional issue.

Let me know your thoughts,
Thanks,
Murtaza.

-----Original Message-----
From: Murtaza Goga [mailto:Murtaza.Goga@trisyngroup.com] 
Sent: Thursday, June 19, 2008 11:09 AM
To: user@tuscany.apache.org
Subject: RE: Serializing non-containment reference

Thanks for the response Frank.  I did try serializing it as a datagraph
with the root as the bank object, same results - the loaded datagraph
had the proxies.

<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID"/>
    <Customer ID="theCustomerID">
      <HomeBranch>#//@eRootObject/@Branch.0</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>
This is from generated code with the bank.xsd in Tuscany.

We have been using this non containment strategy on some of our types
since the M2 release (Nov 2006).  Not sure how to resolve this with the
current release.

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Thursday, June 19, 2008 10:24 AM
To: user@tuscany.apache.org
Subject: RE: Serializing non-containment reference

SDO requires cross references to be "intenal" to the datagraph - that
is, 
they need to point to objects that are also reachable from containment 
references in the closed datagraph starting from the root of the 
serialization. EMF, which underlies the Tuscany SDO implementation also 
supports cross file references, so my guess is that the proxy is showing

up, but (really broken) in SDO, since you didn't serialize the datagraph

from the root.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 06/19/2008
07:43:46 
AM:

> Frank,
> On a parallel question, how do the non-containment references resolve
> after the object is de-serialized from such a graph?
> 
> I have something like this:
> <bank:bank xmlns:bank="http://www.example.com/bank">
>   <Branch ID="theBranchID"/>
>   <Customer ID="theCustomerID">
>     <HomeBranch>#//@bank/@Branch.0</HomeBranch>
>   </Customer>
> </bank:bank>
> 
> The 'HomeBranch' property on the 'Customer' ends up as a proxy after
the
> object is de-serialized?
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Monday, June 16, 2008 9:51 AM
> To: tuscany-user@ws.apache.org
> Subject: Re: Serializing non-containment reference
> 
> Hi Santhosh,
> 
> My guess is your schema definition has errors.
> 
> You should have something like this on the <schema> element:
> 
> xmlns:tns="... your models targetNamespace..."
> xmlns:sdoXML="commonj.sdo/xml"
> 
> and then the the cross reference declared like this:
> 
> sdoXML:propertyType="tns:InvolvedPartyImpl"
> 
> Also, I don't believe you need this import:
> 
>  <xsd:import namespace="commonj.sdo/xml"
>       schemaLocation="sdoXML.xsd">
>  </xsd:import>
> 
> since the annotation namespaces are automatically available.
> 
> Frank.
> 
> "Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:
> 
> > Hi,
> > 
> >   I am trying to serialize and deserialize a SDO containing a
> > non-containment reference. Here is the xsd corresponding to the SDO.
> > 
> > <xsd:import namespace="commonj.sdo/xml"
> >         schemaLocation="sdoXML.xsd">
> >     </xsd:import>
> >     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="involvedPartySurrogate"
> >                 type="domain:SurrogateDomain" />
> >             <xsd:element minOccurs="0" name="organizationOrPerson"
> >                 type="domain:OrganizationOrPersonDomain" />
> >             <xsd:element minOccurs="0" name="paymentPlan"
> >                 type="bons0:PaymentPlan" maxOccurs="1">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactions"
> >                 type="bons0:FinancialTransactions">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="PaymentPlan">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="PaymentPlanName"
> >                 type="xsd:string">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="PaymentPlanID"
> >                 type="xsd:int">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransaction">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="xsd:double">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactionID"
> >                 type="xsd:long">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl"
> >                 maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransactions">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="bons0:FinancialTransaction"
> maxOccurs="unbounded">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> > 
> > 
> > 
> > 
> > 
> > As you can see the payment plan contains a reference to an involved 
> party.
> > When the referenced involved party is present in the same data graph
> > as the payment plan, here is the serialized xml i am getting.
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xmlns:p="http://www.abc.com/edm/entities">
> >     <financialTransactions>
> >         <financialTransaction>
> >             <financialTransactionID>13</financialTransactionID>
> >         </financialTransaction>
> >         <financialTransaction>
> >             <financialTransactionID>12</financialTransactionID>
> >         </financialTransaction>
> >     </financialTransactions>
> >     <involvedPartySurrogate>23</involvedPartySurrogate>
> >     <paymentPlan>
> >         <PaymentPlanID>12</PaymentPlanID>
> >         *<refInvolvedParty>
> >             BusinessObject: InvolvedPartyImpl@70ee70ee
> >             (:mixed=[entities:involvedPartySurrogate=24],
> >             involvedPartySurrogate=24)
> >         </refInvolvedParty>*
> >     </paymentPlan>
> >     <refInvolvedParty>
> >         <involvedPartySurrogate>24</involvedPartySurrogate>
> >     </refInvolvedParty>
> > </p:InvolvedPartyImpl>
> > 
> > 
> > And I am having problems deserializing the reference involved party
> > obtained.
> > Could you let me know if there is any special trick to be applied
> while
> > serializing or deserializing a
> > non-containment reference and is it specific to any implementation?
> > 
> > 
> > Thanks
> > Santhosh
> 


RE: Serializing non-containment reference

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
Thanks for the response Frank.  I did try serializing it as a datagraph
with the root as the bank object, same results - the loaded datagraph
had the proxies.

<sdo:datagraph xmlns:bank="http://www.example.com/bank"
xmlns:sdo="commonj.sdo">
  <bank:bankType>
    <Branch ID="theBranchID"/>
    <Customer ID="theCustomerID">
      <HomeBranch>#//@eRootObject/@Branch.0</HomeBranch>
    </Customer>
  </bank:bankType>
</sdo:datagraph>
This is from generated code with the bank.xsd in Tuscany.

We have been using this non containment strategy on some of our types
since the M2 release (Nov 2006).  Not sure how to resolve this with the
current release.

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Thursday, June 19, 2008 10:24 AM
To: user@tuscany.apache.org
Subject: RE: Serializing non-containment reference

SDO requires cross references to be "intenal" to the datagraph - that
is, 
they need to point to objects that are also reachable from containment 
references in the closed datagraph starting from the root of the 
serialization. EMF, which underlies the Tuscany SDO implementation also 
supports cross file references, so my guess is that the proxy is showing

up, but (really broken) in SDO, since you didn't serialize the datagraph

from the root.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 06/19/2008
07:43:46 
AM:

> Frank,
> On a parallel question, how do the non-containment references resolve
> after the object is de-serialized from such a graph?
> 
> I have something like this:
> <bank:bank xmlns:bank="http://www.example.com/bank">
>   <Branch ID="theBranchID"/>
>   <Customer ID="theCustomerID">
>     <HomeBranch>#//@bank/@Branch.0</HomeBranch>
>   </Customer>
> </bank:bank>
> 
> The 'HomeBranch' property on the 'Customer' ends up as a proxy after
the
> object is de-serialized?
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Monday, June 16, 2008 9:51 AM
> To: tuscany-user@ws.apache.org
> Subject: Re: Serializing non-containment reference
> 
> Hi Santhosh,
> 
> My guess is your schema definition has errors.
> 
> You should have something like this on the <schema> element:
> 
> xmlns:tns="... your models targetNamespace..."
> xmlns:sdoXML="commonj.sdo/xml"
> 
> and then the the cross reference declared like this:
> 
> sdoXML:propertyType="tns:InvolvedPartyImpl"
> 
> Also, I don't believe you need this import:
> 
>  <xsd:import namespace="commonj.sdo/xml"
>       schemaLocation="sdoXML.xsd">
>  </xsd:import>
> 
> since the annotation namespaces are automatically available.
> 
> Frank.
> 
> "Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:
> 
> > Hi,
> > 
> >   I am trying to serialize and deserialize a SDO containing a
> > non-containment reference. Here is the xsd corresponding to the SDO.
> > 
> > <xsd:import namespace="commonj.sdo/xml"
> >         schemaLocation="sdoXML.xsd">
> >     </xsd:import>
> >     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="involvedPartySurrogate"
> >                 type="domain:SurrogateDomain" />
> >             <xsd:element minOccurs="0" name="organizationOrPerson"
> >                 type="domain:OrganizationOrPersonDomain" />
> >             <xsd:element minOccurs="0" name="paymentPlan"
> >                 type="bons0:PaymentPlan" maxOccurs="1">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactions"
> >                 type="bons0:FinancialTransactions">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="PaymentPlan">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="PaymentPlanName"
> >                 type="xsd:string">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="PaymentPlanID"
> >                 type="xsd:int">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransaction">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="xsd:double">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactionID"
> >                 type="xsd:long">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl"
> >                 maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransactions">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="bons0:FinancialTransaction"
> maxOccurs="unbounded">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> > 
> > 
> > 
> > 
> > 
> > As you can see the payment plan contains a reference to an involved 
> party.
> > When the referenced involved party is present in the same data graph
> > as the payment plan, here is the serialized xml i am getting.
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xmlns:p="http://www.abc.com/edm/entities">
> >     <financialTransactions>
> >         <financialTransaction>
> >             <financialTransactionID>13</financialTransactionID>
> >         </financialTransaction>
> >         <financialTransaction>
> >             <financialTransactionID>12</financialTransactionID>
> >         </financialTransaction>
> >     </financialTransactions>
> >     <involvedPartySurrogate>23</involvedPartySurrogate>
> >     <paymentPlan>
> >         <PaymentPlanID>12</PaymentPlanID>
> >         *<refInvolvedParty>
> >             BusinessObject: InvolvedPartyImpl@70ee70ee
> >             (:mixed=[entities:involvedPartySurrogate=24],
> >             involvedPartySurrogate=24)
> >         </refInvolvedParty>*
> >     </paymentPlan>
> >     <refInvolvedParty>
> >         <involvedPartySurrogate>24</involvedPartySurrogate>
> >     </refInvolvedParty>
> > </p:InvolvedPartyImpl>
> > 
> > 
> > And I am having problems deserializing the reference involved party
> > obtained.
> > Could you let me know if there is any special trick to be applied
> while
> > serializing or deserializing a
> > non-containment reference and is it specific to any implementation?
> > 
> > 
> > Thanks
> > Santhosh
> 


RE: Serializing non-containment reference

Posted by Frank Budinsky <fr...@ca.ibm.com>.
SDO requires cross references to be "intenal" to the datagraph - that is, 
they need to point to objects that are also reachable from containment 
references in the closed datagraph starting from the root of the 
serialization. EMF, which underlies the Tuscany SDO implementation also 
supports cross file references, so my guess is that the proxy is showing 
up, but (really broken) in SDO, since you didn't serialize the datagraph 
from the root.

Frank.

"Murtaza Goga" <Mu...@trisyngroup.com> wrote on 06/19/2008 07:43:46 
AM:

> Frank,
> On a parallel question, how do the non-containment references resolve
> after the object is de-serialized from such a graph?
> 
> I have something like this:
> <bank:bank xmlns:bank="http://www.example.com/bank">
>   <Branch ID="theBranchID"/>
>   <Customer ID="theCustomerID">
>     <HomeBranch>#//@bank/@Branch.0</HomeBranch>
>   </Customer>
> </bank:bank>
> 
> The 'HomeBranch' property on the 'Customer' ends up as a proxy after the
> object is de-serialized?
> 
> -----Original Message-----
> From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
> Sent: Monday, June 16, 2008 9:51 AM
> To: tuscany-user@ws.apache.org
> Subject: Re: Serializing non-containment reference
> 
> Hi Santhosh,
> 
> My guess is your schema definition has errors.
> 
> You should have something like this on the <schema> element:
> 
> xmlns:tns="... your models targetNamespace..."
> xmlns:sdoXML="commonj.sdo/xml"
> 
> and then the the cross reference declared like this:
> 
> sdoXML:propertyType="tns:InvolvedPartyImpl"
> 
> Also, I don't believe you need this import:
> 
>  <xsd:import namespace="commonj.sdo/xml"
>       schemaLocation="sdoXML.xsd">
>  </xsd:import>
> 
> since the annotation namespaces are automatically available.
> 
> Frank.
> 
> "Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:
> 
> > Hi,
> > 
> >   I am trying to serialize and deserialize a SDO containing a
> > non-containment reference. Here is the xsd corresponding to the SDO.
> > 
> > <xsd:import namespace="commonj.sdo/xml"
> >         schemaLocation="sdoXML.xsd">
> >     </xsd:import>
> >     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="involvedPartySurrogate"
> >                 type="domain:SurrogateDomain" />
> >             <xsd:element minOccurs="0" name="organizationOrPerson"
> >                 type="domain:OrganizationOrPersonDomain" />
> >             <xsd:element minOccurs="0" name="paymentPlan"
> >                 type="bons0:PaymentPlan" maxOccurs="1">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactions"
> >                 type="bons0:FinancialTransactions">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="PaymentPlan">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="PaymentPlanName"
> >                 type="xsd:string">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="PaymentPlanID"
> >                 type="xsd:int">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransaction">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="xsd:double">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="financialTransactionID"
> >                 type="xsd:long">
> >             </xsd:element>
> >             <xsd:element minOccurs="0" name="refInvolvedParty"
> >                 type="xsd:anyURI" 
> sdoXML:propertyType="InvolvedPartyImpl"
> >                 maxOccurs="1">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> >     <xsd:complexType name="FinancialTransactions">
> >         <xsd:sequence>
> >             <xsd:element minOccurs="0" name="financialTransaction"
> >                 type="bons0:FinancialTransaction"
> maxOccurs="unbounded">
> >             </xsd:element>
> >         </xsd:sequence>
> >     </xsd:complexType>
> > 
> > 
> > 
> > 
> > 
> > As you can see the payment plan contains a reference to an involved 
> party.
> > When the referenced involved party is present in the same data graph
> > as the payment plan, here is the serialized xml i am getting.
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xmlns:p="http://www.abc.com/edm/entities">
> >     <financialTransactions>
> >         <financialTransaction>
> >             <financialTransactionID>13</financialTransactionID>
> >         </financialTransaction>
> >         <financialTransaction>
> >             <financialTransactionID>12</financialTransactionID>
> >         </financialTransaction>
> >     </financialTransactions>
> >     <involvedPartySurrogate>23</involvedPartySurrogate>
> >     <paymentPlan>
> >         <PaymentPlanID>12</PaymentPlanID>
> >         *<refInvolvedParty>
> >             BusinessObject: InvolvedPartyImpl@70ee70ee
> >             (:mixed=[entities:involvedPartySurrogate=24],
> >             involvedPartySurrogate=24)
> >         </refInvolvedParty>*
> >     </paymentPlan>
> >     <refInvolvedParty>
> >         <involvedPartySurrogate>24</involvedPartySurrogate>
> >     </refInvolvedParty>
> > </p:InvolvedPartyImpl>
> > 
> > 
> > And I am having problems deserializing the reference involved party
> > obtained.
> > Could you let me know if there is any special trick to be applied
> while
> > serializing or deserializing a
> > non-containment reference and is it specific to any implementation?
> > 
> > 
> > Thanks
> > Santhosh
> 


RE: Serializing non-containment reference

Posted by Murtaza Goga <Mu...@trisyngroup.com>.
Frank,
On a parallel question, how do the non-containment references resolve
after the object is de-serialized from such a graph?

I have something like this:
<bank:bank xmlns:bank="http://www.example.com/bank">
  <Branch ID="theBranchID"/>
  <Customer ID="theCustomerID">
    <HomeBranch>#//@bank/@Branch.0</HomeBranch>
  </Customer>
</bank:bank>

The 'HomeBranch' property on the 'Customer' ends up as a proxy after the
object is de-serialized?

-----Original Message-----
From: Frank Budinsky [mailto:frankb@ca.ibm.com] 
Sent: Monday, June 16, 2008 9:51 AM
To: tuscany-user@ws.apache.org
Subject: Re: Serializing non-containment reference

Hi Santhosh,

My guess is your schema definition has errors.

You should have something like this on the <schema> element:

xmlns:tns="... your models targetNamespace..."
xmlns:sdoXML="commonj.sdo/xml"

and then the the cross reference declared like this:

sdoXML:propertyType="tns:InvolvedPartyImpl"

Also, I don't believe you need this import:

 <xsd:import namespace="commonj.sdo/xml"
      schemaLocation="sdoXML.xsd">
 </xsd:import>

since the annotation namespaces are automatically available.

Frank.

"Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:

> Hi,
> 
>   I am trying to serialize and deserialize a SDO containing a
> non-containment reference. Here is the xsd corresponding to the SDO.
> 
> <xsd:import namespace="commonj.sdo/xml"
>         schemaLocation="sdoXML.xsd">
>     </xsd:import>
>     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="involvedPartySurrogate"
>                 type="domain:SurrogateDomain" />
>             <xsd:element minOccurs="0" name="organizationOrPerson"
>                 type="domain:OrganizationOrPersonDomain" />
>             <xsd:element minOccurs="0" name="paymentPlan"
>                 type="bons0:PaymentPlan" maxOccurs="1">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="financialTransactions"
>                 type="bons0:FinancialTransactions">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="PaymentPlan">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="PaymentPlanName"
>                 type="xsd:string">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="PaymentPlanID"
>                 type="xsd:int">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="xsd:anyURI" 
sdoXML:propertyType="InvolvedPartyImpl">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="FinancialTransaction">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="financialTransaction"
>                 type="xsd:double">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="financialTransactionID"
>                 type="xsd:long">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="xsd:anyURI" 
sdoXML:propertyType="InvolvedPartyImpl"
>                 maxOccurs="1">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="FinancialTransactions">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="financialTransaction"
>                 type="bons0:FinancialTransaction"
maxOccurs="unbounded">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
> 
> 
> 
> 
> 
> As you can see the payment plan contains a reference to an involved 
party.
> When the referenced involved party is present in the same data graph
> as the payment plan, here is the serialized xml i am getting.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:p="http://www.abc.com/edm/entities">
>     <financialTransactions>
>         <financialTransaction>
>             <financialTransactionID>13</financialTransactionID>
>         </financialTransaction>
>         <financialTransaction>
>             <financialTransactionID>12</financialTransactionID>
>         </financialTransaction>
>     </financialTransactions>
>     <involvedPartySurrogate>23</involvedPartySurrogate>
>     <paymentPlan>
>         <PaymentPlanID>12</PaymentPlanID>
>         *<refInvolvedParty>
>             BusinessObject: InvolvedPartyImpl@70ee70ee
>             (:mixed=[entities:involvedPartySurrogate=24],
>             involvedPartySurrogate=24)
>         </refInvolvedParty>*
>     </paymentPlan>
>     <refInvolvedParty>
>         <involvedPartySurrogate>24</involvedPartySurrogate>
>     </refInvolvedParty>
> </p:InvolvedPartyImpl>
> 
> 
> And I am having problems deserializing the reference involved party
> obtained.
> Could you let me know if there is any special trick to be applied
while
> serializing or deserializing a
> non-containment reference and is it specific to any implementation?
> 
> 
> Thanks
> Santhosh


Re: Serializing non-containment reference

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Santhosh,

My guess is your schema definition has errors.

You should have something like this on the <schema> element:

xmlns:tns="... your models targetNamespace..."
xmlns:sdoXML="commonj.sdo/xml"

and then the the cross reference declared like this:

sdoXML:propertyType="tns:InvolvedPartyImpl"

Also, I don't believe you need this import:

 <xsd:import namespace="commonj.sdo/xml"
      schemaLocation="sdoXML.xsd">
 </xsd:import>

since the annotation namespaces are automatically available.

Frank.

"Santhosh Adiga" <kb...@gmail.com> wrote on 06/16/2008 05:11:30 AM:

> Hi,
> 
>   I am trying to serialize and deserialize a SDO containing a
> non-containment reference. Here is the xsd corresponding to the SDO.
> 
> <xsd:import namespace="commonj.sdo/xml"
>         schemaLocation="sdoXML.xsd">
>     </xsd:import>
>     <xsd:complexType mixed="true" name="InvolvedPartyImpl">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="involvedPartySurrogate"
>                 type="domain:SurrogateDomain" />
>             <xsd:element minOccurs="0" name="organizationOrPerson"
>                 type="domain:OrganizationOrPersonDomain" />
>             <xsd:element minOccurs="0" name="paymentPlan"
>                 type="bons0:PaymentPlan" maxOccurs="1">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="financialTransactions"
>                 type="bons0:FinancialTransactions">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="bons0:InvolvedPartyImpl" maxOccurs="1">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="PaymentPlan">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="PaymentPlanName"
>                 type="xsd:string">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="PaymentPlanID"
>                 type="xsd:int">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="xsd:anyURI" 
sdoXML:propertyType="InvolvedPartyImpl">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="FinancialTransaction">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="financialTransaction"
>                 type="xsd:double">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="financialTransactionID"
>                 type="xsd:long">
>             </xsd:element>
>             <xsd:element minOccurs="0" name="refInvolvedParty"
>                 type="xsd:anyURI" 
sdoXML:propertyType="InvolvedPartyImpl"
>                 maxOccurs="1">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="FinancialTransactions">
>         <xsd:sequence>
>             <xsd:element minOccurs="0" name="financialTransaction"
>                 type="bons0:FinancialTransaction" maxOccurs="unbounded">
>             </xsd:element>
>         </xsd:sequence>
>     </xsd:complexType>
> 
> 
> 
> 
> 
> As you can see the payment plan contains a reference to an involved 
party.
> When the referenced involved party is present in the same data graph
> as the payment plan, here is the serialized xml i am getting.
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <p:InvolvedPartyImpl xsi:type="p:InvolvedPartyImpl"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xmlns:p="http://www.abc.com/edm/entities">
>     <financialTransactions>
>         <financialTransaction>
>             <financialTransactionID>13</financialTransactionID>
>         </financialTransaction>
>         <financialTransaction>
>             <financialTransactionID>12</financialTransactionID>
>         </financialTransaction>
>     </financialTransactions>
>     <involvedPartySurrogate>23</involvedPartySurrogate>
>     <paymentPlan>
>         <PaymentPlanID>12</PaymentPlanID>
>         *<refInvolvedParty>
>             BusinessObject: InvolvedPartyImpl@70ee70ee
>             (:mixed=[entities:involvedPartySurrogate=24],
>             involvedPartySurrogate=24)
>         </refInvolvedParty>*
>     </paymentPlan>
>     <refInvolvedParty>
>         <involvedPartySurrogate>24</involvedPartySurrogate>
>     </refInvolvedParty>
> </p:InvolvedPartyImpl>
> 
> 
> And I am having problems deserializing the reference involved party
> obtained.
> Could you let me know if there is any special trick to be applied while
> serializing or deserializing a
> non-containment reference and is it specific to any implementation?
> 
> 
> Thanks
> Santhosh