| By Kelvin Goodson, Geoffrey Winn | Article Rating: |
|
| February 26, 2007 04:15 PM EST | Reads: |
41,617 |
Containment
Something to note here is that we have
created a containment relationship between the person1 DataObject and
the referrals DataObject. SDO treats containment relationships in a
special way. In every data graph each data object apart from the root
has a link to exactly one parent data object that is its container. The
corresponding property from the parent to the child is marked as a
containment property. So the containment relationships form a strict
hierarchical structure whereby every data object in a graph is
reachable by traversing only the containment links. To enable SDO to
describe richer, more diverse graph structures, non-containment links
can also be included into the graph. These non-containment links permit
arbitrary references across the containment hierarchy.
SDO has behavior built in to preserve the containment hierarchy constraint; so, for example, if you assign a data object into a graph as the value of a containment property then any existing value at that location in the graph will be automatically displaced (the value of its parent property becomes null and the orphaned data object, along with any children it might have, becomes a separate data graph). In addition, if the data object that you're assigning to the graph is already contained in a data graph then it will be automatically removed from that containment association before being assigned to its new location.
Let's take a look at an example. Suppose that the institutions running the tests have learned from the mistakes of previous such projects in which patients already diagnosed with a condition have inadvertantly received letters intended for new referrals and this caused unnecessary distress. This was seen as sufficiently important for them to engineer their data models to ensure that referrals and patients were always disjoint sets. Listing 2 shows the XML schema used to model the test. It makes use of the schema shown earlier to model the people involved in the test.
This schema has a global element named "test," which is of type "Test," which contains three sets of people: referrals, patients, and relatives. We saw from the previous schema that a PersonSet contains a list of people so this arrangement of containment relationships ensures that if we assign a person who already exists in the set of referrals to be in the set of patients then by virtue of the preservation of containments constraint, that person is automatically removed from the referrals set by the SDO infrastructure. Let's see that in action.
DataObject test = DataFactory.INSTANCE.create("www.example.org/MedicalTest", "Test");
test.set("referrals", referrals);
At this point our entire test consists of a set of referrals with one member (we haven't yet initialized the set of patients or relatives so they take the default null value). Here's how it would serialize to XML.
<Test:test xmlns:Test="www.example.org/MedicalTest">
<referrals>
<person gender="male" id="1" name="Joe Johnson Snr">
<dob>1 January 1950</dob>
</person>
</referrals>
</Test:test>
Having visited the hospital, Joe Johnson Sr. is found to have symptoms indicating one of the conditions that the test is investigating, so he's added to the set of patients.
DataObject patients = test.createData-Object("patients");
patients.getList("person").add(person1);
As an aside, note how we created the patients DataObject in a more concise way this time. The "test" DataObject knows the type of its "patients" property and so we don't need to use DataFactory to look up the type and create an instance.
Having made this assignment of person1 to the set of patients, this is how the whole test serializes.
<Test:Test xmlns:Test="www.example.org/MedicalTest">
<referrals/>
<patients>
<person gender="male" id="1" name="Joe Johnson Snr."/>
</patients>
</Test:Test>
So as a result of this one assignment, the patient's set has one member and the referrals set has been reduced to zero.
In part two of this article, we'll examine more SDO features, including the use of open content, change summaries, and references between objects that express more than containment.
References
1 Williams, K., Daniel, B. "SOA Web Services - Data Access Service", Java Developer's Journal, August 2006, http://java.sys-con.com/read/260053.html
Published February 26, 2007 Reads 41,617
Copyright © 2007 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Kelvin Goodson
Kelvin Goodson is based at IBM Hursley in the UK as part of the Open Source SOA team. He is a committer to the Apache Tuscany incubator project, and works primarily on development of the Tuscany Java implementation of SDO. He gained a Ph.D. in image analysis and artificial intelligence in 1988, and has previously worked in the areas of medical imaging, weather forecasting and messaging middleware.
More Stories By Geoffrey Winn
Geoff Winn is based at IBM Hursley in the UK, as part of the Open Source SOA team. He is a member of the SDO specification group and currently works on development of the Apache Tuscany C++ implementation of SDO. He has degrees in Mathematics and Computation, and has previously worked in the areas messaging and brokering middleware.
- The Top 150 Players in Cloud Computing
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- Industry Experts Discuss the State of Cloud Computing
- Cloud Expo New York Call for Papers Deadline December 15
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- US Federal Government is Major Cloud Computing Innovator
- Google Wave
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- 4th International Cloud Expo: Photo Album
- The Top 150 Players in Cloud Computing
- SYS-CON.TV: Cloud Computing Expo Power Panel
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- Industry Experts Discuss the State of Cloud Computing
- SOA World Power Panel on SYS-CON.TV
- CIA was Headed to an Enterprise Cloud All Along: Jill Tummler Singer
- 1st Annual Government IT Conference & Expo: Themes & Topics
- Cloud Expo New York Call for Papers Deadline December 15
- Stock in Focus: Dragon Capital
- The i-Technology Right Stuff
- Who Are The All-Time Heroes of i-Technology?
- Get the Message
- Where Are RIA Technologies Headed in 2008?
- i-Technology Viewpoint: Is Web 2.0 the Global SOA?
- i-Technology Viewpoint: Thinking Outside the VC Box
- ESB Myth Busters: 10 Enterprise Service Bus Myths Debunked
- i-Technology Viewpoint: When to Leave Your First IT Job
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- Five Reasons Why Web 2.0 Matters
- SYS-CON.TV's "SOA Web Services" and "Enterprise Open Source" Programs To Air in December
- SOA World Conference & Expo SYS-CON.TV Power Panel Live From Times Square









There are a variety of applications that supp...























