Welcome!

Open Source Cloud Authors: Liz McMillan, Pat Romanski, Yeshim Deniz, Elizabeth White, Zakia Bouachraoui

Related Topics: Open Source Cloud

Open Source Cloud: Article

Mixing Data & Data Structures in an Object Database

An introduction to the trie

When your next Java application calls for a database backend, before you reach for JDBC and a relational database, stop for a moment and consider another possibility: an object database.

As we hope to show in this article, an object database may not only simplify coding chores, but its capabilities may enable application solutions that you would otherwise not thought of.

Of course, the most apparent benefit you'll get from using an object database is the fact that you won't have to wrestle with two paradigms - object and relational - in a single application. The design of your application code and the design of your database will be object-oriented throughout.

However, the advantages you'll derive from an object database go beyond the simple fact that an object database is more easily incorporated into a project already written in an object- oriented language. One exceptional advantage of an object database is its ability to store structure as well as data. Put another way, its ability to preserve the structure that you've already built into your application. With a relational database, you have to tear down and reassemble that structure as you move data between the application and the database.

Typically, when one thinks of a database, one thinks of a repository of data. In a relational database, the information in the database is organized - more or less - along the lines of normalized data corralled into the proper tables. Data is arranged in "tuples," which tends to gather related information together. But any sort of higher-level data structures must be implemented in the SQL code (procedures) that access the data. Not so with an object database, which can mingle data with data structures in the same database. In fact, with the "right" object database engine, you can add new data structures to an existing database at will (or, rather, as the situation dictates).

We will illustrate what we mean using an example that combines two data structures. As our database engine, we will choose the open source object database db4o (available from www.db4objects.com).

Homemade Thesaurus
We will use as our illustration the data structures that one would employ to create something like ThinkMap's Visual Thesaurus (www.visualthesaurus.com). Visual Thesaurus is a clever visual interface that represents words as existing in a network of connected nodes. Each node is a word, and the connections represent relationships between synonyms.

Our intent here is not to create our own version of Visual Thesaurus, instead, we're going to imagine what sorts of data structures might exist "behind" the user interface of a Visual-Thesaurus-like application and consider how we might represent those structures. Finally, we want to illustrate how we could use an object database to store our imaginary thesaurus' data.

Let's design our data structures from the bottom up. So, on the ground floor, we'll need a structure for storing each word. This structure will need to take into account the fact that a given word often has multiple parts of speech. Furthermore, each part of speech will connect to a different network of synonyms. Consequently, we'll decompose this structure into two classes. First, a POSSynonyms class that will identify the part of speech and hold an array of references to the synonyms corresponding to that part of speech. The class looks like this:

public class POSSynonyms
{
      private int pos; // Part of speech
      private ThesaurusEntry[] synonyms; // Synonyms

      ... POSSynonyms methods ...
}

Obviously, this class depends on the ThesaurusEntry class, which is shown below:

public class ThesaurusEntry
{
      private string theWord:
      private POSSynonyms[] posSyns;

      ... ThesaurusEntry methods ...
}


More Stories By Rick Grehan

Rick Grehan is a QA engineer at Compuware's NuMega Labs, where he has worked on Java and .NET projects. He is also a contributing editor for InfoWorld Magazine. His articles have appeared in Embedded Systems Programming, EDN, The Microprocessor Report, BYTE, Computer Design, and other journals. He is also the coauthor of three books on computer programming.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
DXWorldEXPO | CloudEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publishing company that develops products to help senior professionals in the world's most ICT dependent organizations make risk-based infrastructure and capacity decisions.
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
Cloud-enabled transformation has evolved from cost saving measure to business innovation strategy -- one that combines the cloud with cognitive capabilities to drive market disruption. Learn how you can achieve the insight and agility you need to gain a competitive advantage. Industry-acclaimed CTO and cloud expert, Shankar Kalyana presents. Only the most exceptional IBMers are appointed with the rare distinction of IBM Fellow, the highest technical honor in the company. Shankar has also receive...
A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to great conferences, helping you discover new conferences and increase your return on investment.
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
DXWorldEXPO LLC announced today that ICOHOLDER named "Media Sponsor" of Miami Blockchain Event by FinTechEXPO. ICOHOLDER gives detailed information and help the community to invest in the trusty projects. Miami Blockchain Event by FinTechEXPO has opened its Call for Papers. The two-day event will present 20 top Blockchain experts. All speaking inquiries which covers the following information can be submitted by email to [email protected] Miami Blockchain Event by FinTechEXPOalso offers sp...