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

Re: [xml-dbms] Re: XML-DBMS and Castor?

Expand Messages
  • Ronald Bourret
    Charlie -- The basic correspondence is this: Castor XML-DBMS ... class ClassMap map-to Table, ClassMap/ElementType, ClassMap/ToClassTable
    Message 1 of 9 , Aug 13, 2003
    • 0 Attachment
      Charlie --

      The basic correspondence is this:

      Castor XML-DBMS
      ------ --------
      class ClassMap
      map-to Table, ClassMap/ElementType, ClassMap/ToClassTable
      field PropertyMap, RelatedClass, InlineMap
      sql Column, ToColumn
      bind-xml ElementType, Attribute, PCDATA

      A Castor map does not separately declare the database structure like an
      XML-DBMS map does with Table and Column elements. Therefore, you will
      have to build these elements in addition to things like ClassMap and
      PropertyMap. Other details below.

      Notes:

      1) I've written the details in terms of the XML-DBMS mapping language,
      not the map objects. In fact, MapFactory_Castor should generate map
      objects. The correspondence between the XML-DBMS mapping language and
      map objects is close to one-to-one, but not exactly one-to-one. If you
      have questions, check the JavaDocs, the DTDs, and the code in
      MapCompiler, or just ask me.

      2) If you use database names as XML names and vice versa, use the
      maps.factories.DBNameChecker and maps.factories.XMLNameChecker classes
      to check that the names are valid and not currently being used. See
      MapFactory_DTD and MapFactory_Database (respectively) for examples of
      these classes being used.

      The Castor mapping language docs are on two pages on the Web:

      http://www.castor.org/xml-mapping.html
      http://www.castor.org/jdo-mapping.html

      A good example of a Castor mapping can be found at:


      http://project.exolab.org/cgi-bin/viewcvs.cgi/castor/src/examples/jdo/mapping.xml?rev=1.1.1.1&cvsroot=castor&content-type=text/vnd.viewcvs-markup

      This should get you started :)

      -- Ron

      ******************************************
      Castor element type: class

      Description: Maps to ClassMap.

      Attributes:
      name: see map-to and bind-xml element types
      extends: not supported
      depends: not supported
      auto-complete: not supported
      identity: not supported?
      access: not supported
      key-generator: 1) HIGH-LOW value maps to the HighLow key generator.
      2) SEQUENCE and IDENTITY values map to the Database
      keyword of PrimaryKey@KeyGenerator
      3) MAX and UUID values not supported
      in PrimaryKey element type in some cases (database,
      generated key)

      Child elements:
      description: not supported
      cache-type: not supported
      map-to: see below
      field: see below

      ******************************************
      Element type: map-to

      Provides element type and table names. Does not directly map to
      anything. Note that the Castor documentation states that, "The <map-to>
      element is only used for the root Java object." Based on the example
      noted above, this does not appear to be true.

      Attributes:
      table: 1) Create a Table element with a Name attribute with this
      value.
      2) Add a ToClassTable child to the ClassMap.
      3) Check Castor docs to see if the table name needs to be
      parsed. That is, if it can contain catalog and schema
      names.
      4) If this is missing, there are two choices. (a) Throw an
      exception. (b) Generate a Table element anyway, using the
      element type name.
      xml: Name attribute of ClassMap element type. If this is missing,
      use the name attribute of the class element.
      ns-uri, ns-prefix: Namespace element. One problem here is that
      Castor can reuse prefixes, while XML-DBMS cannot.
      ldap-dn: Not supported.
      ldap-oc: Not supported.

      ******************************************
      Element type: field

      The field element type is equivalent to the PropertyMap, RelatedClass,
      and InlineMap element types. Which element type it maps to depends on
      the type attribute of the field element.

      Attributes:
      name: See bind-xml element type
      type: 1) If the type is another class (e.g. Item or Person), then map
      the field element to a RelatedClass element.
      2) If the type is a pre-defined Java type (e.g. String or int),
      then map the field element to a PropertyMap or InlineMap
      element.
      required: For properties, whether the column is nullable.
      transient: not supported
      direct: not supported
      collection: For properties, if this attribute is present, map the
      property to a property table.
      get-method: not supported
      set-method: not supported
      create-method: not supported

      *****************************************
      Element type: bind-xml

      The bind-xml element supplies information for various XML-DBMS elements
      -- usually names.

      Attributes:
      name: Name of the element type or attribute. This is used in
      RelatedClass, InlineMap, Attribute, and ElementType elements.
      If this is missing, then use the name attribute from the field
      element. Note that Castor's mapping language is written so
      that the same class element can appear in different parents
      with different names. XML-DBMS supports this through the
      UseClassMap element in a RelatedClass element. You will need
      to check for this condition.
      auto-naming: not supported
      type: See sql element type
      location: If this is present, generate an InlineMap element for each
      element in the location path. These are nested. For
      example, the location path abc/def generates an InlineMap
      for the abc element type that contains an InlineMap for the
      def element type. Note that multiple fields might share the
      same partial or complete element path, so you'll need to
      check if they already exist. The PropertyMap or
      RelatedClass is placed inside the innermost InlineMap.
      reference: Not supported. (This would map to ID/IDREF stuff.)
      matches: not supported
      node: Determines whether to generate an ElementType, Attribute, or
      PCDATA element. These correspond to the element, attribute, and
      text values of the node attribute.
      transient: not supported.

      *********************************************
      Element type: sql

      This provides column names and key information.

      Attributes:
      name: 1) Create a column with this name.
      2) Add a ToColumn element to the PropertyMap.
      3) If this is missing, use the name attribute of the field
      element.
      type: The column's data type. If this is missing, use the type
      attribute of the field element. If that is missing, use the
      type attribute of the bind-xml element.
      many-key: Used to construct foreign keys.
      many-table: not supported
      read-only: not supported
      dirty: not supported

      cafulnecky wrote:
      > Ron,
      >
      > I would be interested in tackling this one if you can give me a few
      > pointers.
      >
      > -- Charlie
    • cafulnecky
      ... Thanks Ron! If I have further questions I will add them to the thread. Again, thanks for the assist. Charlie
      Message 2 of 9 , Aug 15, 2003
      • 0 Attachment
        --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
        wrote:
        > Charlie --
        >
        > The basic correspondence is this:

        Thanks Ron! If I have further questions I will add them to the
        thread. Again, thanks for the assist.

        Charlie
      • deepak_ksr_it
        ... hai friend i am new in this titled project i want some information
        Message 3 of 9 , Aug 15, 2003
        • 0 Attachment
          --- In xml-dbms@yahoogroups.com, "cafulnecky" <cafulnecky@y...> wrote:
          > --- In xml-dbms@yahoogroups.com, Ronald Bourret <rpbourret@r...>
          > wrote:
          > > Charlie --
          > >
          > > The basic correspondence is this:
          >
          > Thanks Ron! If I have further questions I will add them to the
          > thread. Again, thanks for the assist.
          >
          > Charlie
          hai friend
          i am new in this titled project
          i want some information
        • Ronald Bourret
          ... See: http://www.rpbourret.com/xmldbms/index.htm http://www.rpbourret.com/xmldbms/readme.htm -- Ron
          Message 4 of 9 , Aug 15, 2003
          • 0 Attachment
            deepak_ksr_it wrote:
            > hai friend
            > i am new in this titled project
            > i want some information

            See:

            http://www.rpbourret.com/xmldbms/index.htm
            http://www.rpbourret.com/xmldbms/readme.htm

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