Loading ...
Sorry, an error occurred while loading the content.
 

Re: [xml-dbms] Filter concepts

Expand Messages
  • Ronald Bourret
    ... No. If you call DOMToDBMS or DBMSDelete directly, there are methods for specifying a single action. You can also construct an Actions object directly --
    Message 1 of 2 , Sep 29, 2005
      gv_web wrote:

      > 1. Is there a programmatic way to specify the actions when using the
      > Transfer API ? Instead of *.act files?

      No. If you call DOMToDBMS or DBMSDelete directly, there are methods for
      specifying a single action. You can also construct an Actions object
      directly -- .act documents are compiled into Actions objects -- but
      there seems little point in doing this.

      > 2. When i use the retrieveDocument() API specifying the "Select"
      > query, what is the use of the filter file?
      >
      > For example :
      >
      > select.put("Select", "select * from auction");
      > _transfer.retrieveDocument(parserProps, "auction.map", select,
      > "auction.ftr" , null, "auction_out.xml");
      >
      > where auction.ftr looks like :
      >
      > <?xml version='1.0' encoding="iso-8859-1"?>
      > <!DOCTYPE FilterSet SYSTEM
      > "file:///home/giriraj/xml/xml2db/test/filters.dtd" >
      > <FilterSet Version="2.0"
      > xmlns="http://www.xmlmiddleware.org/xmldbms/filters/v2">
      > <Filters>
      > <Filter>
      > <ResultSetInfo Table="AUCTION" />
      > </Filter>
      > </Filters>
      > </FilterSet>

      The filter document has two purposes:

      1) Associate a table name (used by the map file) with a result set. For
      more information and examples, see the section on filter documents in:

      http://www.rpbourret.com/xmldbms/faqs/resultset.htm

      2) Instruct XML-DBMS how to filter more deeply nested data that the map
      specifies should be retrieved. This is done with RelatedTableFilter
      elements. For example, suppose your map specifies how to construct a set
      of sales orders from the Orders and Items tables. By passing in a result
      set, you are specifying which top-level elements (sales orders) to
      construct. The RelatedTableFilter element can be used to specify which
      items to retrieve. For more information, see the description of
      RelatedTableFilter in filters.dtd and the ordersrs.ftr sample in the
      samples directory. If none of this makes sense, write back and I'll
      expand the FAQ.

      > 3. What is the use of the filter file and how can i use it for
      > parameterized values? (Instead of hard coding values)

      XML-DBMS essentially defines a query language with two parts. The map
      document defines the structure of the XML documents -- which tables map
      to which elements and which columns map to which elements / attributes.
      The filter document specifies which data to actually retrieve through
      what are essentially a series of WHERE clauses. (These are copied almost
      verbatim to the SELECT statements XML-DBMS constructs.)

      Filter documents can be parameterized through the use of named
      parameters. For details, see the description of the Where attribute in
      filters.dtd and the ordersparams.ftr sample. Again, write back if you
      have specific questions.

      -- Ron
    Your message has been successfully submitted and would be delivered to recipients shortly.