User Customisable Schema and Oracle Abstract Data Types

User Customisable Schema and Oracle Abstract Data Types

Post by Rob Godfr » Thu, 07 Feb 2002 22:02:18



Hi

I've searched the internet for info relating to my problem (see below)
but so far haven't come up with much. The product I'm developing is a
document management solution, and I need to provide user customisable
document metadata fields. Users should be able to define both the
datatype and label for each metadata field.

My initial solution revolved around 2 tables Property and Attribute
where Property stored the label and datatype details and Attribute
stored the actual values. Note the Attribute table would have several
columns eg. String_Val (VARCHAR2()) , Number_Val (NUMBER), Date_Val
(DATE) etc. to store any datatype.

My problems stem from the searchable nature of a document archive,
such that you can search in any of the metadata fields and importantly
across multiple metadata fields. To do this I would need to flatten
the attribute table since attributes are stored in different rows.
This however proves to be too expensive to do either through multiple
joins, or through group bys and decode.

My next potential solution was to do away with the Attribute table and
flatten it onto the Document table. This meant having columns of the
form STRING_VAL1, STRING_VAL2 ..., etc. This means searching becomes
straightforward, but does limit the flexibility of having unlimited
columns of any datatype that the initial solution had. I could foresee
issues where not enough fields were supplied initially which would
required schema changes etc. not a problem in itself but would take
time and potentially have further impacts.

Next I was looking through the Oracle documentation library and came
across Abstract Data Types which I haven't used before but got me
thinking that I could create an attribute type ( "ATTRIBUTE_TY" )
which behaved like the attribute table (ie. had a string column,
numeric column, date column etc) and then instead of STRING_VAL1,
STRING_VAL2 etc on the document table I could define columns as VAL1
ATTRIBUTE_TY, VAL2 ATTRIBUTE_TY etc. The attributes could then be
referenced as Document.Val1.String_Val. I think this seems a bit more
elegant, however I wanted to get opinions regarded the use of types
eg. performance implications, extensiblity etc. As I said earlier I
haven't used types before and would appreciate any comments regarding
them and any other possible solutions that might be out there.

Cheers

Rob

 
 
 

User Customisable Schema and Oracle Abstract Data Types

Post by damorga » Fri, 08 Feb 2002 03:03:14


There are a number of solutions to this. All of them bad if you care about
performance and scalability as users are not capable of making good
decisions about such matters.

One is to NOT let them create fields but rather to give the impression of
letting them create fields. For example:

Create a table that contains primary key fields that will link a specific
record back to another table and record. Then provide a field that is
VARCHAR2(4000), a field that is NUMBER(38), a field that is FLOAT(126),
and a field that is DATE datatype. Plus another field that contains the
simulated column name. Now you can write code using NDS (native dynamic
SQL) that will go out to this one table and grab information related to
other records and display it or report on it.

Not elegant ... but normalized.

Daniel Morgan


> Hi

> I've searched the internet for info relating to my problem (see below)
> but so far haven't come up with much. The product I'm developing is a
> document management solution, and I need to provide user customisable
> document metadata fields. Users should be able to define both the
> datatype and label for each metadata field.

> My initial solution revolved around 2 tables Property and Attribute
> where Property stored the label and datatype details and Attribute
> stored the actual values. Note the Attribute table would have several
> columns eg. String_Val (VARCHAR2()) , Number_Val (NUMBER), Date_Val
> (DATE) etc. to store any datatype.

> My problems stem from the searchable nature of a document archive,
> such that you can search in any of the metadata fields and importantly
> across multiple metadata fields. To do this I would need to flatten
> the attribute table since attributes are stored in different rows.
> This however proves to be too expensive to do either through multiple
> joins, or through group bys and decode.

> My next potential solution was to do away with the Attribute table and
> flatten it onto the Document table. This meant having columns of the
> form STRING_VAL1, STRING_VAL2 ..., etc. This means searching becomes
> straightforward, but does limit the flexibility of having unlimited
> columns of any datatype that the initial solution had. I could foresee
> issues where not enough fields were supplied initially which would
> required schema changes etc. not a problem in itself but would take
> time and potentially have further impacts.

> Next I was looking through the Oracle documentation library and came
> across Abstract Data Types which I haven't used before but got me
> thinking that I could create an attribute type ( "ATTRIBUTE_TY" )
> which behaved like the attribute table (ie. had a string column,
> numeric column, date column etc) and then instead of STRING_VAL1,
> STRING_VAL2 etc on the document table I could define columns as VAL1
> ATTRIBUTE_TY, VAL2 ATTRIBUTE_TY etc. The attributes could then be
> referenced as Document.Val1.String_Val. I think this seems a bit more
> elegant, however I wanted to get opinions regarded the use of types
> eg. performance implications, extensiblity etc. As I said earlier I
> haven't used types before and would appreciate any comments regarding
> them and any other possible solutions that might be out there.

> Cheers

> Rob


 
 
 

User Customisable Schema and Oracle Abstract Data Types

Post by Paul Brewe » Fri, 08 Feb 2002 07:24:15


Heading towards 5th Normal Form eh?
Elegant, but will it perform in the real world?
Good luck... I suspect you may have to compromise..:-(

Paul


Quote:> Hi

> I've searched the internet for info relating to my problem (see below)
> but so far haven't come up with much. The product I'm developing is a
> document management solution, and I need to provide user customisable
> document metadata fields. Users should be able to define both the
> datatype and label for each metadata field.

> My initial solution revolved around 2 tables Property and Attribute

<snip>
 
 
 

1. Abstract Data Parameter Type?

Greetings,
I have created abstract data provider class (DataAccessor) which get
implemented by .net data provider-specific concrete classes (a SQL provider
class, a OLE DB class, etc).  This helps keep the user ignorant from how db
access gets implemented.  The user has access to these static concrete
classes through a class factory component called Data Manager. So for
example the user would call:

'This returns a reference to concrete class which factory resolves from the
connectionString
 Dim objDBAccess As DataAccessor =
DataManager.GetDBAccessor(connectionString)

My questions is how to best handle parameter manipulation.  I want to enable
the sending of parameters and parameter arrays through Execute methods, but
how to do that if they don't know what provider they are using (don't want
them to send SQLParameter or OLEDBParameter).  Currently the only
implementation I could think of was to added static Set and Gets.  This is
not very robust, however, and does not enable the passing of parameters in
Execute calls.

For example, I want them to be able to:

'where arrSomeArrayofParams is an array of IDataParam-compliant types
objDBAccess.ExecuteNonQuery(CommandType.StoredProcedure,
"getProductDetails", arrSomeArrayofParams)

They currently can only set param one at time, then execute:

ParameterType.dmPtInt, 1)
objDBAccess.ExecuteNonQuery(Nothing, CommandType.StoredProcedure,
"getProductDetails", Nothing)

Any help appreciated!
Thanks in advance
Dave

2. What products include WBTRCALL.DLL?

3. How to retrive abstract data type using jdbc with oracle8.04

4. Oh VFP Gods, do I have a combo box bug in 3.0?==================

5. How to retrive abstract data type via jdbc?

6. Views With ADP

7. SQL Loader and Abstract Data Types and Nested Tables

8. jdbc-odbc problem with Java execute Command

9. abstract data types

10. Abstract Data Types

11. abstract data types/objects

12. Problem with Abstract Data Type

13. Simple persistent object storage: seeking advice on storing user defined, runtime defined abstract datatypes into Oracle