Chapter 13. Searching XML with interMedia

In previous chapters, we’ve seen a variety of ways that XML datagrams can be broken up and stored relationally. Applications can then use XML for universal data exchange and SQL for sophisticated data management and speedy queries. However, not all XML documents are pure datagrams. When applied to pure documents and datagrams with embedded document fragments, the combined XML/SQL method stores at least some XML in its original form as marked-up text. In order to utilize stored marked-up text in a query, you’ll need interMedia’s Text component, which adds XML document search and full-text search capabilities to SQL.

Why Use interMedia?

To illustrate why interMedia is needed to fully leverage XML stored in Oracle, let’s work through an example, using the simple insurance claim document shown in Example 13.1.

Example 13-1. Insurance Claim Document #77804

<!-- claim77804.xml -->
<Claim>
  <Payment>1000</Payment>
  <DamageReport>
    The insured's <Vehicle Make="Volks">Beetle</Vehicle>
    broke through the guard rail and plummeted into a ravine.
    The cause was determined to be <Cause>faulty brakes</Cause>.
    Amazingly there were no casualties.
  </DamageReport>
</Claim>

This document can be broken up and stored in a table as follows:

CREATE TABLE claim (
  claimid  NUMBER PRIMARY KEY,
  payment  NUMBER,
  damagereport  CLOB
);

where the <DamageReport> fragment is stored in the damagereport column. Because it’s a CLOB (Character Large Object) datatype, the damagereport column ...

Get Building Oracle XML Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.