You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Pete Robbins <ro...@googlemail.com> on 2006/12/07 14:04:31 UTC

[C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

On 07/12/06, Caroline Maynard (JIRA) <tu...@ws.apache.org> wrote:
>
> DataObject assigned into open property goes missing
> ---------------------------------------------------
>
>                 Key: TUSCANY-980
>                 URL: http://issues.apache.org/jira/browse/TUSCANY-980
>             Project: Tuscany
>          Issue Type: Bug
>          Components: C++ SDO
>    Affects Versions: Cpp-current
>            Reporter: Caroline Maynard
>
>
> I have a schema like so:
> <schema
> xmlns="http://www.w3.org/2001/XMLSchema">
>
> <element name="jungle">
>    <complexType>
>      <sequence>
>        <any minOccurs="0" maxOccurs="unbounded"/>
>      </sequence>
>    </complexType>
> </element>
>
> <element name="mixedJungle">
>    <complexType mixed="true">
>      <sequence>
>        <any minOccurs="0" maxOccurs="unbounded"/>
>      </sequence>
>    </complexType>
> </element>
>
> </schema>
>
> and another one like so:
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema">
>
>   <complexType name="snakeType">
>     <sequence>
>       <element name= "name" type="string"/>
>       <element name= "length" type="positiveInteger" />
>     </sequence>
>   </complexType>
>
>   <complexType name="bearType">
>     <sequence>
>       <element name= "name" type="string"/>
>       <element name= "weight" type="positiveInteger" />
>     </sequence>
>   </complexType>
>
>   <complexType name="pantherType">
>     <sequence>
>       <element name= "name" type="string"/>
>       <element name= "colour" type="string" />
>     </sequence>
>   </complexType>
>
> </schema>
>
> Now suppose I load BOTH schemas into the same DataFactory, create a
> document with root type jungle, create some animal types and then assign
> them into the jungle. When I save the document, I see:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <bear xsi:type="bearType">
>    <name>Baloo</name>
>    <weight>700</weight>
> </bear>
> <panther xsi:type="pantherType">
>    <name>Bagheera</name>
>    <colour>inky black</colour>
> </panther>
> <snake xsi:type="snakeType">
>    <name>Kaa</name>
>    <length>25</length>
> </snake>
> </jungle>
>
> This is good.
>
> Now I change the example so that the two schemas are loaded into DIFFERENT
> Data Factories, and run the same test. The saved document is now:
> <?xml version="1.0" encoding="UTF-8"?>
> <jungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <bear xsi:type="bearType" name="Baloo" weight="700"/>
> <panther xsi:type="pantherType" name="Bagheera" colour="inky black"/>
> <snake xsi:type="snakeType" name="Kaa" length="25"/>
> </jungle>
>
> so the elements have turned into attributes.


I have checked in  a fix for this.


Finally, I change the test so that the document root is a mixedJungle
> instead of a jungle, that is, it is sequenced. No errors are reported, but
> my document comes out as:
> <?xml version="1.0" encoding="UTF-8"?>
> <mixedJungle xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
>
> Now the animals are completely missing. The outcome is the same regardless
> of whether I use one or two data factories, btw.


Do you use the Sequence API to add the animals in this case? I suspect not
and this highlights a problem in our implementation where, for a Sequenced
DataObject, setting of Properties using the DataObject::setXXX methods
should delegate to the Sequence API but do not, so they do not appear in the
sequence.

If we make the change to delegate the setting of the property so that any
setXXX on a sequenced SDO will appear in the sequence there is another
question: Should properties that are defined from an XML Schema as
"attributes" be included in the Sequence? I think the answer is NO as that
is what wouild be intended by the schema.

Cheers,


-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Simon Laws <si...@googlemail.com>.
On 12/7/06, Pete Robbins <ro...@googlemail.com> wrote:
>
> On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> >
> >
> >
> > On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> > >
> > > On 12/7/06, Caroline Maynard <caroline.maynard@gmail.com > wrote:
> > > >
> > > > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > > > >
> > > > >
> > > > > Do you use the Sequence API to add the animals in this case? I
> > > suspect
> > > > not
> > > > > and this highlights a problem in our implementation where, for a
> > > > Sequenced
> > > > > DataObject, setting of Properties using the DataObject::setXXX
> > > methods
> > > > > should delegate to the Sequence API but do not, so they do not
> > > appear in
> > > > > the
> > > > > sequence.
> > > >
> > > >
> > > > You're correct, I'm not using the Sequence APIs at all, the only
> > > > difference
> > > > is that in one case the DataObject is sequenced and in the other it
> is
> > >
> > > > not.
> > > >
> > > > If we make the change to delegate the setting of the property so
> that
> > > any
> > > > > setXXX on a sequenced SDO will appear in the sequence there is
> > > another
> > > > > question: Should properties that are defined from an XML Schema as
> > > > > "attributes" be included in the Sequence? I think the answer is NO
> > > as
> > > > that
> > > > > is what wouild be intended by the schema.
> > > >
> > > >
> > > > I agree.
> > > >
> > > > --
> > > > Caroline
> > > >
> > > > On the last point. It depends on what we think a sequence is...
> > >
> > > 1/ A sequence of all of the elements and text that appear inside of a
> > > particular element in an XML document (this excludes attributes as you
> > > suggest)
> > > 2/ Just the ordered collection of settings disregarding the fact that
> it
> > > will, at some point in the future, become and XML document
> > >
> > > If we want SDO to look and feel like an XML document then the answer
> is
> > > 1/.
> > > If we want SDO to be an abstract data interface then the answer is 2/.
> I
> > > think the SDO philosophy to date goes with 2/
> > >
> > > If we were to go with 1 we should raise it with the spec people and
> also
> > > have a convenient way of telling whether a property is an attribute so
> > > that
> > > alongside getting the sequence of properties (elements and text) from
> a
> > > data
> > > object we can go get all the attributes also.
> > >
> > > Simon
> > >
> > >
> > If the Type is defined via an XML Schema then we should do 1, and that
> is
> > what I am suggesting.
> > The spec does define methods to determine if Types were defined from XSD
> > and whether the Property is an element or attribute.
> >
> >
> >
>
> An alternative is to always delegate to the Sequence API for setXXX for
> ANY
> property on a sequenced DataObject. THis would mean that attributes would
> be
> returned via the sequence API. The serialization code would not write
> these
> as part of the sequence. This is probably better.
>
> --
> Pete
>
> +1 this is a better approach

Simon

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
>
>
>
> On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> >
> > On 12/7/06, Caroline Maynard <caroline.maynard@gmail.com > wrote:
> > >
> > > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > > >
> > > >
> > > > Do you use the Sequence API to add the animals in this case? I
> > suspect
> > > not
> > > > and this highlights a problem in our implementation where, for a
> > > Sequenced
> > > > DataObject, setting of Properties using the DataObject::setXXX
> > methods
> > > > should delegate to the Sequence API but do not, so they do not
> > appear in
> > > > the
> > > > sequence.
> > >
> > >
> > > You're correct, I'm not using the Sequence APIs at all, the only
> > > difference
> > > is that in one case the DataObject is sequenced and in the other it is
> >
> > > not.
> > >
> > > If we make the change to delegate the setting of the property so that
> > any
> > > > setXXX on a sequenced SDO will appear in the sequence there is
> > another
> > > > question: Should properties that are defined from an XML Schema as
> > > > "attributes" be included in the Sequence? I think the answer is NO
> > as
> > > that
> > > > is what wouild be intended by the schema.
> > >
> > >
> > > I agree.
> > >
> > > --
> > > Caroline
> > >
> > > On the last point. It depends on what we think a sequence is...
> >
> > 1/ A sequence of all of the elements and text that appear inside of a
> > particular element in an XML document (this excludes attributes as you
> > suggest)
> > 2/ Just the ordered collection of settings disregarding the fact that it
> > will, at some point in the future, become and XML document
> >
> > If we want SDO to look and feel like an XML document then the answer is
> > 1/.
> > If we want SDO to be an abstract data interface then the answer is 2/. I
> > think the SDO philosophy to date goes with 2/
> >
> > If we were to go with 1 we should raise it with the spec people and also
> > have a convenient way of telling whether a property is an attribute so
> > that
> > alongside getting the sequence of properties (elements and text) from a
> > data
> > object we can go get all the attributes also.
> >
> > Simon
> >
> >
> If the Type is defined via an XML Schema then we should do 1, and that is
> what I am suggesting.
> The spec does define methods to determine if Types were defined from XSD
> and whether the Property is an element or attribute.
>
>
>

An alternative is to always delegate to the Sequence API for setXXX for ANY
property on a sequenced DataObject. THis would mean that attributes would be
returned via the sequence API. The serialization code would not write these
as part of the sequence. This is probably better.

-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
>
> On 12/7/06, Caroline Maynard <ca...@gmail.com> wrote:
> >
> > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > >
> > >
> > > Do you use the Sequence API to add the animals in this case? I suspect
> > not
> > > and this highlights a problem in our implementation where, for a
> > Sequenced
> > > DataObject, setting of Properties using the DataObject::setXXX methods
> > > should delegate to the Sequence API but do not, so they do not appear
> in
> > > the
> > > sequence.
> >
> >
> > You're correct, I'm not using the Sequence APIs at all, the only
> > difference
> > is that in one case the DataObject is sequenced and in the other it is
> > not.
> >
> > If we make the change to delegate the setting of the property so that
> any
> > > setXXX on a sequenced SDO will appear in the sequence there is another
> > > question: Should properties that are defined from an XML Schema as
> > > "attributes" be included in the Sequence? I think the answer is NO as
> > that
> > > is what wouild be intended by the schema.
> >
> >
> > I agree.
> >
> > --
> > Caroline
> >
> > On the last point. It depends on what we think a sequence is...
>
> 1/ A sequence of all of the elements and text that appear inside of a
> particular element in an XML document (this excludes attributes as you
> suggest)
> 2/ Just the ordered collection of settings disregarding the fact that it
> will, at some point in the future, become and XML document
>
> If we want SDO to look and feel like an XML document then the answer is
> 1/.
> If we want SDO to be an abstract data interface then the answer is 2/. I
> think the SDO philosophy to date goes with 2/
>
> If we were to go with 1 we should raise it with the spec people and also
> have a convenient way of telling whether a property is an attribute so
> that
> alongside getting the sequence of properties (elements and text) from a
> data
> object we can go get all the attributes also.
>
> Simon
>
>
If the Type is defined via an XML Schema then we should do 1, and that is
what I am suggesting.
The spec does define methods to determine if Types were defined from XSD and
whether the Property is an element or attribute.

Cheers,

-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 08/12/06, Simon Laws <si...@googlemail.com> wrote:
>
> On 12/7/06, Pete Robbins <ro...@googlemail.com> wrote:
> >
> > On 07/12/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
> > >
> > > Pete is right about how it works and that it is kind of ugly. We have
> an
> > > internal way of doing it more easily, but the only way an SDO client
> can
> > > do it is the way Pete said. Maybe we need to open an SDO 3 spec issue
> > for
> > > adding a convenient way to access "non-sequenced" properties of a
> > > sequenced object (i.e., instanceProperties that are not also in the
> > > sequence).
> > >
> > > Frank.
> >
> >
> >
> > That's a good idea. getNonSequencedProperties() which would return the
> > same
> > list of properties as getInstanceProperties() if the SDO was not
> > sequenced.
> > We could add something like this as a Tuscany extra until it gets spec
> > approval.
> >
> > Actually maybe this would be a method on Sequence and would only return
> > the
> > list of non-sequenced Properties that had been set, similar to the way
> > Sequence only contains Properties that are set.
> >
> > Anyho... food for thought. Fixing C++ implementation will be a good
> first
> > step!
> >
> > Cheers,
> >
> > "Pete Robbins" <ro...@googlemail.com> wrote on 12/07/2006 11:56:12
> AM:
> > >
> > > > On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> > > > >
> > > > >
> > > > > >
> > > > > > Thanks for that Frank. When a data object has an XSD based type
> is
> > > there
> > > > > are way of getting all of it's properties which the XSD  says are
> > > > > attributes.
> > > > >
> > > > > This is where it gets a bit ugly. It's ok if you know what the
> > > attribute
> > > > names are as you can just do a getXXX("attribute_name") but if you
> are
> > > > dealing with an object whose type you do not know you would have to
> > > iterate
> > > > through the instance properties and do a getXXX for each one that
> > > > prop.isAttribute() is true.
> > > >
> > > > Easy... except we don't have that prop.isAttribute() method in C++.
> We
> > > have
> > > > an internal way of determining this but that is not currently
> exposed
> > in
> > > our
> > > > API. I really do not like these methods being on XSDHelper as they
> are
> > > in
> > > > Java. IMO it is simpler and more logical to have these as attributes
> > of
> > > the
> > > > Property.
> > > >
> > > > Cheers,
> > > >
> > > >
> > > > --
> > > > Pete
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> > >
> > >
> >
> >
> > --
> > Pete
> >
> > In a sequenced data object is it important that we identify some data as
> not sequenced? We are only having this conversation because we know that
> some data is going to be written out as an attribute. Are there other
> examples we can point to? Even in the XML case we are talking about about
> providing a convenient way of determining if a property is an attribute
> but
> does this mean it has to be accessed in a different way from the rest of
> the
> sequence. I do realize that from an XML point of view an attribute is not
> part of the sequence but from an SDO point of view do we care?
>
> If you're answer is that we are trying to provide a flexible model that
> allows part of the data object to be sequenced and part not then that is
> possibly OK. If the answer is that we are trying to separate elements from
> attributes then that strikes me as XML specific. The problem I have is if
> we
> code up the setXXX methods on a data object to add to the sequence
> automatically then the decision as to whether data gets added to the
> sequence or not will be hidden in the implementation and based on some
> magic
> flags. This may lead to future confusion.



It's not really magic flags though. You defined the property as an attribute
so you should know to access it with getXXX. It's no different than you
having to know to call getString or getDataObject depending on how the
property was defined in the schema.

If for a Sequenced DO all Property settings go into  the sequence then you
could iterate over the sequence to retrieve all properties that were set. It
makse the users code simpler but makes the serialization code harder (but
why do you care about that ;-) ) as it would have to iterate over all
Sequence entries twice, once to find any Property with "isAttribute" set and
again to get the XML sequenced data. This may be the best solution.


Cheers,

-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Simon Laws <si...@googlemail.com>.
On 12/7/06, Pete Robbins <ro...@googlemail.com> wrote:
>
> On 07/12/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
> >
> > Pete is right about how it works and that it is kind of ugly. We have an
> > internal way of doing it more easily, but the only way an SDO client can
> > do it is the way Pete said. Maybe we need to open an SDO 3 spec issue
> for
> > adding a convenient way to access "non-sequenced" properties of a
> > sequenced object (i.e., instanceProperties that are not also in the
> > sequence).
> >
> > Frank.
>
>
>
> That's a good idea. getNonSequencedProperties() which would return the
> same
> list of properties as getInstanceProperties() if the SDO was not
> sequenced.
> We could add something like this as a Tuscany extra until it gets spec
> approval.
>
> Actually maybe this would be a method on Sequence and would only return
> the
> list of non-sequenced Properties that had been set, similar to the way
> Sequence only contains Properties that are set.
>
> Anyho... food for thought. Fixing C++ implementation will be a good first
> step!
>
> Cheers,
>
> "Pete Robbins" <ro...@googlemail.com> wrote on 12/07/2006 11:56:12 AM:
> >
> > > On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> > > >
> > > >
> > > > >
> > > > > Thanks for that Frank. When a data object has an XSD based type is
> > there
> > > > are way of getting all of it's properties which the XSD  says are
> > > > attributes.
> > > >
> > > > This is where it gets a bit ugly. It's ok if you know what the
> > attribute
> > > names are as you can just do a getXXX("attribute_name") but if you are
> > > dealing with an object whose type you do not know you would have to
> > iterate
> > > through the instance properties and do a getXXX for each one that
> > > prop.isAttribute() is true.
> > >
> > > Easy... except we don't have that prop.isAttribute() method in C++. We
> > have
> > > an internal way of determining this but that is not currently exposed
> in
> > our
> > > API. I really do not like these methods being on XSDHelper as they are
> > in
> > > Java. IMO it is simpler and more logical to have these as attributes
> of
> > the
> > > Property.
> > >
> > > Cheers,
> > >
> > >
> > > --
> > > Pete
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: tuscany-dev-help@ws.apache.org
> >
> >
>
>
> --
> Pete
>
> In a sequenced data object is it important that we identify some data as
not sequenced? We are only having this conversation because we know that
some data is going to be written out as an attribute. Are there other
examples we can point to? Even in the XML case we are talking about about
providing a convenient way of determining if a property is an attribute but
does this mean it has to be accessed in a different way from the rest of the
sequence. I do realize that from an XML point of view an attribute is not
part of the sequence but from an SDO point of view do we care?

If you're answer is that we are trying to provide a flexible model that
allows part of the data object to be sequenced and part not then that is
possibly OK. If the answer is that we are trying to separate elements from
attributes then that strikes me as XML specific. The problem I have is if we
code up the setXXX methods on a data object to add to the sequence
automatically then the decision as to whether data gets added to the
sequence or not will be hidden in the implementation and based on some magic
flags. This may lead to future confusion.

Simon

Simon

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
>
> Pete is right about how it works and that it is kind of ugly. We have an
> internal way of doing it more easily, but the only way an SDO client can
> do it is the way Pete said. Maybe we need to open an SDO 3 spec issue for
> adding a convenient way to access "non-sequenced" properties of a
> sequenced object (i.e., instanceProperties that are not also in the
> sequence).
>
> Frank.



That's a good idea. getNonSequencedProperties() which would return the same
list of properties as getInstanceProperties() if the SDO was not sequenced.
We could add something like this as a Tuscany extra until it gets spec
approval.

Actually maybe this would be a method on Sequence and would only return the
list of non-sequenced Properties that had been set, similar to the way
Sequence only contains Properties that are set.

Anyho... food for thought. Fixing C++ implementation will be a good first
step!

Cheers,

"Pete Robbins" <ro...@googlemail.com> wrote on 12/07/2006 11:56:12 AM:
>
> > On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> > >
> > >
> > > >
> > > > Thanks for that Frank. When a data object has an XSD based type is
> there
> > > are way of getting all of it's properties which the XSD  says are
> > > attributes.
> > >
> > > This is where it gets a bit ugly. It's ok if you know what the
> attribute
> > names are as you can just do a getXXX("attribute_name") but if you are
> > dealing with an object whose type you do not know you would have to
> iterate
> > through the instance properties and do a getXXX for each one that
> > prop.isAttribute() is true.
> >
> > Easy... except we don't have that prop.isAttribute() method in C++. We
> have
> > an internal way of determining this but that is not currently exposed in
> our
> > API. I really do not like these methods being on XSDHelper as they are
> in
> > Java. IMO it is simpler and more logical to have these as attributes of
> the
> > Property.
> >
> > Cheers,
> >
> >
> > --
> > Pete
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>


-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Pete is right about how it works and that it is kind of ugly. We have an 
internal way of doing it more easily, but the only way an SDO client can 
do it is the way Pete said. Maybe we need to open an SDO 3 spec issue for 
adding a convenient way to access "non-sequenced" properties of a 
sequenced object (i.e., instanceProperties that are not also in the 
sequence).

Frank.

"Pete Robbins" <ro...@googlemail.com> wrote on 12/07/2006 11:56:12 AM:

> On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
> >
> >
> > >
> > > Thanks for that Frank. When a data object has an XSD based type is 
there
> > are way of getting all of it's properties which the XSD  says are
> > attributes.
> >
> > This is where it gets a bit ugly. It's ok if you know what the 
attribute
> names are as you can just do a getXXX("attribute_name") but if you are
> dealing with an object whose type you do not know you would have to 
iterate
> through the instance properties and do a getXXX for each one that
> prop.isAttribute() is true.
> 
> Easy... except we don't have that prop.isAttribute() method in C++. We 
have
> an internal way of determining this but that is not currently exposed in 
our
> API. I really do not like these methods being on XSDHelper as they are 
in
> Java. IMO it is simpler and more logical to have these as attributes of 
the
> Property.
> 
> Cheers,
> 
> 
> -- 
> Pete


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


Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Simon Laws <si...@googlemail.com> wrote:
>
>
> >
> > Thanks for that Frank. When a data object has an XSD based type is there
> are way of getting all of it's properties which the XSD  says are
> attributes.
>
> This is where it gets a bit ugly. It's ok if you know what the attribute
names are as you can just do a getXXX("attribute_name") but if you are
dealing with an object whose type you do not know you would have to iterate
through the instance properties and do a getXXX for each one that
prop.isAttribute() is true.

Easy... except we don't have that prop.isAttribute() method in C++. We have
an internal way of determining this but that is not currently exposed in our
API. I really do not like these methods being on XSDHelper as they are in
Java. IMO it is simpler and more logical to have these as attributes of the
Property.

Cheers,


-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Simon Laws <si...@googlemail.com>.
On 12/7/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
>
> In the Java implementation we do the following:
>
> 1. If a sequenced type is created programatically, we map all the
> properties to XML elements - so any property can be added to the sequence.
> 2. If a sequenced XSD-based type, then only properties that map to
> elements can be added to the sequence. Trying to add an attribute property
> will throw an exception. XSDHelper.isAttribute() is the way that the user
> can determine whether or not a property can be added to the sequence.
>
> Frank.
>
> "Simon Laws" <si...@googlemail.com> wrote on 12/07/2006 09:33:03 AM:
>
> > On 12/7/06, Caroline Maynard <ca...@gmail.com> wrote:
> > >
> > > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > > >
> > > >
> > > > Do you use the Sequence API to add the animals in this case? I
> suspect
> > > not
> > > > and this highlights a problem in our implementation where, for a
> > > Sequenced
> > > > DataObject, setting of Properties using the DataObject::setXXX
> methods
> > > > should delegate to the Sequence API but do not, so they do not
> appear in
> > > > the
> > > > sequence.
> > >
> > >
> > > You're correct, I'm not using the Sequence APIs at all, the only
> > > difference
> > > is that in one case the DataObject is sequenced and in the other it is
> > > not.
> > >
> > > If we make the change to delegate the setting of the property so that
> any
> > > > setXXX on a sequenced SDO will appear in the sequence there is
> another
> > > > question: Should properties that are defined from an XML Schema as
> > > > "attributes" be included in the Sequence? I think the answer is NO
> as
> > > that
> > > > is what wouild be intended by the schema.
> > >
> > >
> > > I agree.
> > >
> > > --
> > > Caroline
> > >
> > > On the last point. It depends on what we think a sequence is...
> >
> > 1/ A sequence of all of the elements and text that appear inside of a
> > particular element in an XML document (this excludes attributes as you
> > suggest)
> > 2/ Just the ordered collection of settings disregarding the fact that it
> > will, at some point in the future, become and XML document
> >
> > If we want SDO to look and feel like an XML document then the answer is
> 1/.
> > If we want SDO to be an abstract data interface then the answer is 2/. I
> > think the SDO philosophy to date goes with 2/
> >
> > If we were to go with 1 we should raise it with the spec people and also
> > have a convenient way of telling whether a property is an attribute so
> that
> > alongside getting the sequence of properties (elements and text) from a
> data
> > object we can go get all the attributes also.
> >
> > Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
> Thanks for that Frank. When a data object has an XSD based type is there
are way of getting all of it's properties which the XSD  says are
attributes.

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
>
> >
> > Can you confirm that for a sequenced DataObject if I set a property
> using
> > e.g. setString("prop", "text") then that setting will added to the
> sequence
> > as if  getSequence().add("prop", "text") was used?
> >
> Right (but only if the property maps to an XML element).


Ok that's what we need to change our C++ implementation to do. Should be fun
;-)
-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Frank Budinsky <fr...@ca.ibm.com>.
> 
> Can you confirm that for a sequenced DataObject if I set a property 
using
> e.g. setString("prop", "text") then that setting will added to the 
sequence
> as if  getSequence().add("prop", "text") was used?
> 
Right (but only if the property maps to an XML element).

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


Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Pete Robbins <ro...@googlemail.com>.
On 07/12/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
>
> In the Java implementation we do the following:
>
> 1. If a sequenced type is created programatically, we map all the
> properties to XML elements - so any property can be added to the sequence.


That sounds right.

2. If a sequenced XSD-based type, then only properties that map to
> elements can be added to the sequence. Trying to add an attribute property
> will throw an exception. XSDHelper.isAttribute() is the way that the user
> can determine whether or not a property can be added to the sequence.
>
> Frank.


OK.. that was my initial proposal.

Can you confirm that for a sequenced DataObject if I set a property using
e.g. setString("prop", "text") then that setting will added to the sequence
as if  getSequence().add("prop", "text") was used?

 Cheers,


"Simon Laws" <si...@googlemail.com> wrote on 12/07/2006 09:33:03 AM:
>
> > On 12/7/06, Caroline Maynard <ca...@gmail.com> wrote:
> > >
> > > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > > >
> > > >
> > > > Do you use the Sequence API to add the animals in this case? I
> suspect
> > > not
> > > > and this highlights a problem in our implementation where, for a
> > > Sequenced
> > > > DataObject, setting of Properties using the DataObject::setXXX
> methods
> > > > should delegate to the Sequence API but do not, so they do not
> appear in
> > > > the
> > > > sequence.
> > >
> > >
> > > You're correct, I'm not using the Sequence APIs at all, the only
> > > difference
> > > is that in one case the DataObject is sequenced and in the other it is
> > > not.
> > >
> > > If we make the change to delegate the setting of the property so that
> any
> > > > setXXX on a sequenced SDO will appear in the sequence there is
> another
> > > > question: Should properties that are defined from an XML Schema as
> > > > "attributes" be included in the Sequence? I think the answer is NO
> as
> > > that
> > > > is what wouild be intended by the schema.
> > >
> > >
> > > I agree.
> > >
> > > --
> > > Caroline
> > >
> > > On the last point. It depends on what we think a sequence is...
> >
> > 1/ A sequence of all of the elements and text that appear inside of a
> > particular element in an XML document (this excludes attributes as you
> > suggest)
> > 2/ Just the ordered collection of settings disregarding the fact that it
> > will, at some point in the future, become and XML document
> >
> > If we want SDO to look and feel like an XML document then the answer is
> 1/.
> > If we want SDO to be an abstract data interface then the answer is 2/. I
> > think the SDO philosophy to date goes with 2/
> >
> > If we were to go with 1 we should raise it with the spec people and also
> > have a convenient way of telling whether a property is an attribute so
> that
> > alongside getting the sequence of properties (elements and text) from a
> data
> > object we can go get all the attributes also.
> >
> > Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>


-- 
Pete

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Frank Budinsky <fr...@ca.ibm.com>.
In the Java implementation we do the following:

1. If a sequenced type is created programatically, we map all the 
properties to XML elements - so any property can be added to the sequence.
2. If a sequenced XSD-based type, then only properties that map to 
elements can be added to the sequence. Trying to add an attribute property 
will throw an exception. XSDHelper.isAttribute() is the way that the user 
can determine whether or not a property can be added to the sequence.

Frank.

"Simon Laws" <si...@googlemail.com> wrote on 12/07/2006 09:33:03 AM:

> On 12/7/06, Caroline Maynard <ca...@gmail.com> wrote:
> >
> > On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> > >
> > >
> > > Do you use the Sequence API to add the animals in this case? I 
suspect
> > not
> > > and this highlights a problem in our implementation where, for a
> > Sequenced
> > > DataObject, setting of Properties using the DataObject::setXXX 
methods
> > > should delegate to the Sequence API but do not, so they do not 
appear in
> > > the
> > > sequence.
> >
> >
> > You're correct, I'm not using the Sequence APIs at all, the only
> > difference
> > is that in one case the DataObject is sequenced and in the other it is
> > not.
> >
> > If we make the change to delegate the setting of the property so that 
any
> > > setXXX on a sequenced SDO will appear in the sequence there is 
another
> > > question: Should properties that are defined from an XML Schema as
> > > "attributes" be included in the Sequence? I think the answer is NO 
as
> > that
> > > is what wouild be intended by the schema.
> >
> >
> > I agree.
> >
> > --
> > Caroline
> >
> > On the last point. It depends on what we think a sequence is...
> 
> 1/ A sequence of all of the elements and text that appear inside of a
> particular element in an XML document (this excludes attributes as you
> suggest)
> 2/ Just the ordered collection of settings disregarding the fact that it
> will, at some point in the future, become and XML document
> 
> If we want SDO to look and feel like an XML document then the answer is 
1/.
> If we want SDO to be an abstract data interface then the answer is 2/. I
> think the SDO philosophy to date goes with 2/
> 
> If we were to go with 1 we should raise it with the spec people and also
> have a convenient way of telling whether a property is an attribute so 
that
> alongside getting the sequence of properties (elements and text) from a 
data
> object we can go get all the attributes also.
> 
> Simon


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


Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Simon Laws <si...@googlemail.com>.
On 12/7/06, Caroline Maynard <ca...@gmail.com> wrote:
>
> On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
> >
> >
> > Do you use the Sequence API to add the animals in this case? I suspect
> not
> > and this highlights a problem in our implementation where, for a
> Sequenced
> > DataObject, setting of Properties using the DataObject::setXXX methods
> > should delegate to the Sequence API but do not, so they do not appear in
> > the
> > sequence.
>
>
> You're correct, I'm not using the Sequence APIs at all, the only
> difference
> is that in one case the DataObject is sequenced and in the other it is
> not.
>
> If we make the change to delegate the setting of the property so that any
> > setXXX on a sequenced SDO will appear in the sequence there is another
> > question: Should properties that are defined from an XML Schema as
> > "attributes" be included in the Sequence? I think the answer is NO as
> that
> > is what wouild be intended by the schema.
>
>
> I agree.
>
> --
> Caroline
>
> On the last point. It depends on what we think a sequence is...

1/ A sequence of all of the elements and text that appear inside of a
particular element in an XML document (this excludes attributes as you
suggest)
2/ Just the ordered collection of settings disregarding the fact that it
will, at some point in the future, become and XML document

If we want SDO to look and feel like an XML document then the answer is 1/.
If we want SDO to be an abstract data interface then the answer is 2/. I
think the SDO philosophy to date goes with 2/

If we were to go with 1 we should raise it with the spec people and also
have a convenient way of telling whether a property is an attribute so that
alongside getting the sequence of properties (elements and text) from a data
object we can go get all the attributes also.

Simon

Re: [C++] SDO Sequence api (was [jira] Created: (TUSCANY-980) DataObject assigned into open property goes missing)

Posted by Caroline Maynard <ca...@gmail.com>.
On 07/12/06, Pete Robbins <ro...@googlemail.com> wrote:
>
>
> Do you use the Sequence API to add the animals in this case? I suspect not
> and this highlights a problem in our implementation where, for a Sequenced
> DataObject, setting of Properties using the DataObject::setXXX methods
> should delegate to the Sequence API but do not, so they do not appear in
> the
> sequence.


You're correct, I'm not using the Sequence APIs at all, the only difference
is that in one case the DataObject is sequenced and in the other it is not.

If we make the change to delegate the setting of the property so that any
> setXXX on a sequenced SDO will appear in the sequence there is another
> question: Should properties that are defined from an XML Schema as
> "attributes" be included in the Sequence? I think the answer is NO as that
> is what wouild be intended by the schema.


I agree.

-- 
Caroline