11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

492 CHAPTER <strong>11</strong> ■ APPLICATION DEVELOPMENTXMLIndex Path SubsettingA great benefit of XMLIndex is that you do not have to know XPath expressions. By default,XMLIndex indexes all XPath locations of the XML data. Just like any other index, the smallerindex size will yield the faster retrieval of data. With XPath expressions, you can narrow yoursearch criteria and, in effect, reduce the data of the XMLIndex index. This ultimately will leadto highly tuned XML applications by limiting the nodes of the XML document to be indexed.The XMLIndex XPath subsetting is achieved in two possible methods:• Exclusion• InclusionExclusion implies that you want to exclude fragments from the complete XPath expression.On the flip side, inclusion implies that you want to start from an empty set and add paths as yougo. XML subsetting can be accomplished by including the PATHS option to the CREATE INDEX orALTER INDEX command.Let’s review how this great feature works. First, let’s create a new XMLIndex with certainnodes included:SQL> create index edba_po_idx on edba_po(object_value) indextype is xdb.xmlindex2 parameters ('paths3 (include4 (5 /PurchaseOrder/LineItems//*6 /PurchaseOrder/Reference7 /PurchaseOrder/Actions8 )9 )'10* )SQL> /Index created.In this particular example, the elements for LineItems, Reference, and Actions are included inthe initial index build process. The LineItems elements and their descendants are included inthis index. Let’s assume that a new requirement came about to include the Requestor elementsto the index. To add the Requested nodes, you can use the INCLUDE ADD parameters:SQL> alter index edba_po_idx rebuild2 parameters ('paths (include add (/PurchaseOrder/Requestor3* ))')SQL> /Index altered.If for some reason you need to add all the possible paths, you can use the ALL parameter.You can issue the options INCLUDE ADD (ALL) or EXCLUDE REMOVE (ALL). Both of these haveequivalent results. Even though you can include all paths, you cannot exclude all paths.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!