Bug 245136 - BIDI3.4:HCG_DTP is not capable of working with Bidi data in different Bidi layouts
Summary: BIDI3.4:HCG_DTP is not capable of working with Bidi data in different Bidi la...
Status: NEW
Alias: None
Product: Data Tools
Classification: Tools
Component: DataTools (show other bugs)
Version: Ganymede   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: future   Edit
Assignee: Brian Fitzpatrick CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 298392
Blocks:
  Show dependency tree
 
Reported: 2008-08-25 11:31 EDT by Tomer Mahlin CLA
Modified: 2010-06-02 04:41 EDT (History)
6 users (show)

See Also:


Attachments
Support for Bidi transformation in other Eclipse based products (74.19 KB, image/jpeg)
2008-08-25 11:36 EDT, Tomer Mahlin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tomer Mahlin CLA 2008-08-25 11:31:11 EDT
Background
===========

"... Bidirectional text can be stored in several formats (a.k.a. "layouts"), depending on the platform and the intended use. When Bidi data is available but not in the appropriate layout, it is possible to convert it to the required layout by performing a "Bidi transformation".  

Bidi text can be stored in a variety of layouts characterized by a combination of 5 attributes:
  * ordering scheme
  * base direction
  * symmetric swapping
  * text shaping (for Arabic)
  * numeric shaping (for Arabic)

Historically, data stored on mainframes (zSeries and iSeries) was in "visual" layout, i.e. according to a visual ordering scheme, ready for presentation on "dumb" devices like terminals or printers. With the advent of processing power closer to end users, as is the case for workstations and personal computers, it became common to store data in a newer "logical" layout ..." - Matitiahu Allouche, Bidi Architect

"... Currently, data in visual layout are still preponderant on zSeries and iSeries, while in Windows systems most data are created and processed in logical layout. Systems running Unix or its variants can handle data in either logical or visual layout, probably with some more affinity for the logical layout.
Java GUI components expect Bidi textual data to be in logical layout ..." - Matitiahu Allouche, Bidi Architect

The essence of the problem
===========================

"...What happens if some data need processing via Java / Eclipse GUI, but are currently accessible in a visual layout? They must be converted to a logical layout ..." - Matitiahu Allouche, Bidi Architect. If this transformation is not performed the data will be corrupted. This is exactly what happens in DTP.

What does Bidi transformation do ?
==================================

"... In general, the operation which converts a piece of Bidi text from a source layout to a target layout is called a "Bidi transformation".  This can include going from a logical layout to a visual layout, or going the opposite way. The transformation may even leave the ordering scheme unchanged, but alter some or all of the other Bidi attributes ..." - Matitiahu Allouche, Bidi Architect.
 Bidi transformation of text from one Bidi layout (aka format) to another results in changes of directionality (relative position of characters or segments of text) and possibly in changes in shaping. Bidi transformation is applicable not only to BiDi or mixed scripts but to exclusively Latin ones as well. When transforming text from Logical left-to-right to Visual right-to-left Latin text is mirrored. For example: "hello world" in Logical left-to-right becomes "dlrow olleh" in Visual right-to-left.


Problems with current level of support for Bidi transformation in DTP
=====================================================================

Currently there are two major problems with support for Bidi transformation in DTP:

1. DTP does not have any built-in support for Bidi transformation. Instead
it relies mainly on the Bidi support in JDBC driver. Please notice, that only minor fraction all available JDBC drivers has support for Bidi transformation 
(and even in those it is very limited). Unfortunately DTP is not capable of leveraging even this limited support for Bidi transformation which exist in some of JDBC drivers. This is mainly due to the fact, that DTP is not aware of level of support for Bidi transformation on JDBC level and thus it fails to correctly leverage this support.

2. Even those JDBC drivers which provide support for Bidi transformation (i.e. AS400JDBCDriver as part of JTOpen - the open source version of IBM Toolbox for Java available from http://jt400.sourceforge.net/) have only very limited version of this support. Consequently, since DTP relies on JDBC driver with respect to support for Bidi transformation, it does not provide flexible enough support for Bidi transformation.


What other products do ?
========================

 In order to clarify that DTP is not expected to set any precedent I would like to give an illustrative example of a product using JDBC layer for support for connectivity and data exchange with RDBMS systems. This product does not rely on support for Bidi transformation in JDBC driver (due to the fact that in many cases JDBC drivers don't have such support or have only very limited one). Instead it provides this support on the product level. For example during configuration of JDBC driver end user can provide additional parameters specifying Bidi layout properties of RDBMS data. When a connection to RDBMS is established those properties are used by this product to correctly transform Bidi data from one Bidi layout to another. For illustration please see attached snapshot (How other products providing similar functionality address support for Bidi transformation). 

Was Bidi transformation itself already implemented ?
====================================================

 Performing Bidi transformation "... is not trivial.  It entails reversing parts of the text, but not all of it.  It entails replacing some occurrences of symmetric symbols by their symmetric match. For Arabic, it also entails choosing the proper shape for each letter and the proper digits for each number. Fortunately, software tools already exist to accomplish such conversions ..." - Matitiahu Allouche, Bidi Architect.
  "...Software tools which perform Bidi transformations are called "Bidi engines".  Several such Bidi engines are available to Eclipse developers.  They all accomplish more or less the same tasks, the differences are mostly in the APIs.  However, there is some variance in the options offered by each engine. The main Bidi engines are:
   * the Bidi support in ICU4J
   * the Bidi engine in IBM's JDK
   * the Bidi class in Sun's JDK
..." - Matitiahu Allouche, Bidi Architect.

What is missing in DTP ?
========================

 DTP is expected not to rely on the support for Bidi transformation in JDBC drivers (mainly due to the fact that in overwhelming majority of cases JDBC drivers don't have such support or have only very limited one). Instead it is expected to provide built-in support. 
 However, DTP does not need to implement Bidi transformation itself (since it can leverage implementations available from ICU4J/JDK). What it needs to do is comprised of following major tasks:

1. Provide configuration option to the end user in order to define Bidi layout information associated with data. For example, Bidi layout associated with connection, database, meta data (such as table name, column name etc.) and content data (actual data stored in the database).

2. Extend appropriate model to store this configuration data.

3. During data exchange with RDBMS use this configuration data and provide Bidi transformation of data from one Bidi layout to another. During data exchange with RDBMS system DTP can leverage any one of existing tools (ICU4J, JDK) to perform actual Bidi transformation of data.
Comment 1 Tomer Mahlin CLA 2008-08-25 11:36:16 EDT
Created attachment 110806 [details]
Support for Bidi transformation in other Eclipse based products

 The attached snapshot illustrates how another Eclipse based product providing a similar functionality (connectivity to RDBMS, data exchange with RDBMS) addresses support for Bidi transformation.
Comment 2 Brian Fitzpatrick CLA 2008-08-25 12:54:49 EDT
We will definitely look into this for Galileo. This support would address bug 130529, bug 130532, and bug 132670 as well.
Comment 3 Brian Fitzpatrick CLA 2009-01-22 13:55:34 EST
Tomer, unfortunately I doubt this is going to be handled in Galilieo due to a lack of resources. 
Comment 4 Brian Fitzpatrick CLA 2009-03-09 15:28:24 EDT
setting to future
Comment 5 Adir Pekarevich CLA 2009-09-15 09:37:17 EDT
(In reply to comment #2)
> We will definitely look into this for Galileo. This support would address bug
> 130529, bug 130532, and bug 132670 as well.

Defects referred above will be resolved by TextProcessor, while solution suggested by Tomer is based on bidi data normalization (i.e. transformation of bidi data/metadata stored in DB to canonical logical left-to-right bidi format)
So, it seems that there is no relation between all these defects to this one, unless you keep in you mind how to connect these two things.
Comment 6 Brian Fitzpatrick CLA 2009-09-15 09:52:00 EDT
(In reply to comment #5)
> (In reply to comment #2)
> > We will definitely look into this for Galileo. This support would address bug
> > 130529, bug 130532, and bug 132670 as well.
> 
> Defects referred above will be resolved by TextProcessor, while solution
> suggested by Tomer is based on bidi data normalization (i.e. transformation of
> bidi data/metadata stored in DB to canonical logical left-to-right bidi format)
> So, it seems that there is no relation between all these defects to this one,
> unless you keep in you mind how to connect these two things.

Adir, we would definitely like to have help in this area. Any patches, suggested fixes, and so on would be greatly appreciated. We've been fighting in this area of BiDi for years now and so far haven't really solved the problem.
Comment 7 Adir Pekarevich CLA 2010-05-10 09:26:11 EDT
In def 273722  we provided some initial code for work with visual bidirectional data used on mainframes, particularly BidiLayout widget that allows to manipulate Bidi text the same way as on mainframe. It is based on StyledText functionality.
BidiLayoutCellEditor is build over BidiLayout in the same way TextCellEditor is
build over Text.
Comment 8 Ira Fishbein CLA 2010-06-02 04:38:57 EDT
I've provided updated patch files and design doc for Bidi support in DTP in  bug 273722.
It will be nice if someone will look at it.
Ira