You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Ralph Spickermann <ra...@uni-rostock.de> on 2007/08/01 17:06:13 UTC
adapting Jackrabbit to an existing database?
Hi,
I am currently exploring if and how the JSR 170 and Jackrabbit could
work together with an existing database.
I have a DB2 database that stores collections of images along with
structured information about the images in object-relational tables.
For a simple example let's consider the following tables:
Table Collection (
id Integer,
name String)
Table Image (
id Integer,
parent Ref(Collection)
content Blob,
format String)
Table Region (
id Integer,
parent Ref(Image),
area Double,
averageColorR Integer,
averageColorG Integer,
averageColorB Integer)
The mapping to a JSR tree is not that difficult.
I have Collecions that contain Images that contain Regions, so I could
access the property averageColorR via a hierarchy like
/Collection1/Image1/Region1/averageColorR
In Jackrabbit for database persistence the tables Node, Props, Refs and
Binval are used, at least for DB2. In the table Node the NodeState is
serialized and stored together with the NodeId.
Now I am thinking about adapting the Jackrabbit functionality so that
my scheme is used for storage. For example, if I create an image, it
gets stored in the Image table together with the image properties.
How would I start doing that? Extending the SimpleDbPersistenceManager
for my needs? Is it even possible and how complex would it be?
Another question concerns user defined functions that are stored in the
database. Consider a function that computes the similarity between two
regions by comparing area and averageColor.
Is there a possibility to call that function in SQL or Xpath queries
from Jackrabbit? So when I have a certain region I could search for
similar regions.
I know there are some functions like jcr:contains or jcr:score, could I
implement other functions as well?
I am not very familiar with JSR/Jackrabbit, maybe you could help me out
a bit.
Best regards, Ralph
Re: adapting Jackrabbit to an existing database?
Posted by Stefan Guggisberg <st...@gmail.com>.
hi ralph
On 8/1/07, Ralph Spickermann <ra...@uni-rostock.de> wrote:
> Hi,
>
> I am currently exploring if and how the JSR 170 and Jackrabbit could
> work together with an existing database.
>
> I have a DB2 database that stores collections of images along with
> structured information about the images in object-relational tables.
> For a simple example let's consider the following tables:
>
> Table Collection (
> id Integer,
> name String)
>
> Table Image (
> id Integer,
> parent Ref(Collection)
> content Blob,
> format String)
>
> Table Region (
> id Integer,
> parent Ref(Image),
> area Double,
> averageColorR Integer,
> averageColorG Integer,
> averageColorB Integer)
>
> The mapping to a JSR tree is not that difficult.
> I have Collecions that contain Images that contain Regions, so I could
> access the property averageColorR via a hierarchy like
> /Collection1/Image1/Region1/averageColorR
>
> In Jackrabbit for database persistence the tables Node, Props, Refs and
> Binval are used, at least for DB2. In the table Node the NodeState is
> serialized and stored together with the NodeId.
>
> Now I am thinking about adapting the Jackrabbit functionality so that
> my scheme is used for storage. For example, if I create an image, it
> gets stored in the Image table together with the image properties.
> How would I start doing that? Extending the SimpleDbPersistenceManager
> for my needs? Is it even possible and how complex would it be?
supporting (i.e. 'jcr-enabling') legacy data systems has never been a
design goal of jackrabbit.
developing a custom persistence manager that supports your schema
might theoretically be possible, but it's a *lot* of work and i certainly
wouldn't recommend it.
why don't you just import your data into jackrabbit?
in case you absolutely need to keep and maintain the data in your
legacy system/schema i suggest you take a look at the SPI project
in contrib which should make it significantly easier to 'jcr-enable'
existing legacy data systems.
cheers
stefan
>
> Another question concerns user defined functions that are stored in the
> database. Consider a function that computes the similarity between two
> regions by comparing area and averageColor.
> Is there a possibility to call that function in SQL or Xpath queries
> from Jackrabbit? So when I have a certain region I could search for
> similar regions.
> I know there are some functions like jcr:contains or jcr:score, could I
> implement other functions as well?
>
> I am not very familiar with JSR/Jackrabbit, maybe you could help me out
> a bit.
>
> Best regards, Ralph
>
>
>
>
>