# XML Storage?

**URL:** <https://www.ruby-forum.com/t/xml-storage/87884>\
**Category:** Rails\
**Created:** [March 27, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/xml-storage/87884 "2006-03-27T20:15:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2006, 8:15pm UTC](https://www.ruby-forum.com/t/xml-storage/87884/1 "2006-03-27T20:15:07Z")

</div>

Hey Folks,

```
    Now that all the fun and games of learning Rails has almost sunk

```

in it’s time to build something useful. I am tasked with building a  
system to control and search our large (and I mean large 1.5 million +  
and  
growing) photograph collection. I have been building databases for  
years  
and after thinking about the situation we decided that trying to store  
the  
information about individual photos in a relational system is  
masochistic  
to say the least (the number of one-to-many as well as many-many  
relations  
would make it a real headache to manage). XML to the rescue. We could  
really simplify things by creating an XML record for each photo (we will  
be using modified Dublin Core [www.dublincore.org](http://www.dublincore.org) for fields and  
descriptions). We have tried and failed to get a relational system to  
work well - too many “what if’s” and exceptions to the rules to deal  
with  
using a relation system.

Since this is the Rails mailing list you can assume that I would like to  
do this using Rails. However, searching high a low I cannot find a  
starting point for a storage and retrieval method using Rails and XML  
data. Searching this list I see that the eXist project has been  
mentioned  
and I think this is the way to go (soon MySQL will have the ability to  
store and query XML - but it’s not there yet). Since Ruby and Rails is  
fairly new to me any pointers about conversing with eXist or any other  
XML  
storage solution (XML-RPC? REST? never used these so go easy) would be  
greatly appreciated, also any tips or pointers about building the XML  
would also be helpful. Builder seems to be best and easiest method -  
but  
how to get it from builder to the database - aye there’s the rub.

Once this is all figured out it could become a very powerful method for  
storing and retrieving data - one XPath or XQuery and all is yours. No  
more fiddling with relations and so on - just where to start.

Thanks for any help or pointers… Cheers.

P.S. I have, for development purposes, thought about building the XML  
and  
storing it in a MySQL field (the whole record is an XML document) - I am  
not worried about the searching at the moment (but I could build queries  
to violently rip out what I needed using regex - slow but it would  
work).  
But how would I build the XML from a form and slap the whole thing into  
MySQL - sorry different issue than above, but again any help for this  
(hopefully) temporary solution would again be greatly appreciate.

Andrew Macdonald  
New Media Officer / Agent des nouveaux mÃ©dias  
Canada Aviation Museum / MusÃ©e de l’aviation du Canada  
Phone / TÃ©lÃ©phone : (613) 998-5689  
Fax / TÃ©lÃ©copie : (613) 990-3655  
Website: www.aviation.technomuses.ca  
Email: removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2006, 8:51pm UTC](https://www.ruby-forum.com/t/xml-storage/87884/2 "2006-03-27T20:51:26Z")

</div>

> and after thinking about the situation we decided that trying to store  
> the  
> information about individual photos in a relational system is  
> masochistic  
> to say the least (the number of one-to-many as well as many-many  
> relations  
> would make it a real headache to manage). XML to the rescue. We could  
> really simplify things by creating an XML record for each photo (we will  
> be using modified Dublin Core [www.dublincore.org](http://www.dublincore.org) for fields and  
> descriptions). We have tried and failed to get a relational system to  
> work well - too many “what if’s” and exceptions to the rules to deal  
> with  
> using a relation system.

Not really related to your original question - but you might consider  
using RDF to describe your metadata [which can leveage DC]:

“Describing and retrieving photos using RDF and HTTP”  
[http://www.w3.org/TR/photo-rdf/#the-dublin](http://www.w3.org/TR/photo-rdf/#the-dublin)

RDF can be describe in XML btw [there’s also another format called N3]

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2006, 10:26pm UTC](https://www.ruby-forum.com/t/xml-storage/87884/3 "2006-03-27T22:26:41Z")

</div>

> Not really related to your original question - but you might consider  
> using RDF to describe your metadata [which can leveage DC]:
> 
> “Describing and retrieving photos using RDF and HTTP”  
> [Describing and retrieving photos using RDF and HTTP](http://www.w3.org/TR/photo-rdf/#the-dublin)
> 
> RDF can be describe in XML btw [there’s also another format called N3]

Thanks, how the data is stored is still being determined (Is the type of  
Aircraft a subject? or do we make a separate field for that?). We are  
looking at RDF, EAD, even MARC for some data. The nice thing about XML  
(and its flavors) is that we can create crosswalks to move the data from  
one format to the other. Once we have a storage solution and a method  
to query and pull the data out - we can create filters (crosswalks) that  
will give you whatever you want. Put Z39.50 into the mix and you have  
so many posiblities to export and share the data…

Now just to get it all working… 🙂

Andrew Macdonald
