Storing documents and metadata (associated XML fragment)
Hello, I want to store some kind of library of arbitrary files (similar to the file library example in the distribution). Further, I'd like to store an associated XML fragment (metadata) with the document. This XML fragment should be accessible externally, via XML-RPC for example. What is the best way to store such things in Zope? Would I store Metadata in separate files along with the original files? Or should I extend the File with a string member to hold metadata (may be large, though)? Any other suggestions? Thanks in advance, Lars
On Tuesday 28 May 2002 05:15 am, Lars von Wedel wrote:
Hello,
I want to store some kind of library of arbitrary files (similar to the file library example in the distribution). Further, I'd like to store an associated XML fragment (metadata) with the document. This XML fragment should be accessible externally, via XML-RPC for example.
There are several ways to approach this problem. Let me start by stating that XML is a representation of data, and it might not be your best option to simply store XML in Zope. Unless you enjoy (or have tools that enjoy) editing the XML directly. If you do, then you might argue for it. For more control and flexibility I might suggest storing the metadata as properties of the object and creating a "view", using a page template or DTML method that generates the XML from the properties. Now the disadvantage to this is that the XML will essentially be read only. For read-write access to XML data in Zope I would suggest looking at ParsedXML.
What is the best way to store such things in Zope? Would I store Metadata in separate files along with the original files? Or should I extend the File with a string member to hold metadata (may be large, though)?
How large is large? The disadvantage of Zope properties is that they are loaded into memory whenever the object is. File data OTOH is not loaded until it is accessed and only in blocks. If you are talking about megabytes (or hundreds of kb) of XML attached to a single object, separate file objects would probably be a good idea. You could make the content object folderish so that it can contain several files, one for the content and one (or more) for the metadata. If you do have tons of XML to attach to a document, you'll also need to consider how you are going to work with it. Parsing such giants would be an expensive operation, so you would want to do it as seldom as possible. -Casey
Hi Casey,
For read-write access to XML data in Zope I would suggest looking at ParsedXML. I saw a message on the list saying it is not properly supported at the moment? However, I'll have a look at it.
If you are talking about megabytes (or hundreds of kb) of XML attached to a single object, separate file objects would probably be a good idea. You could make the content object folderish so that it can contain several files, one for the content and one (or more) for the metadata. Well, it will usually be a couple of pages . Hundreds of kb is probably a pessimistic maximum.
If you do have tons of XML to attach to a document, you'll also need to consider how you are going to work with it. Parsing such giants would be an expensive operation, so you would want to do it as seldom as possible. This XML will be transformed dynamically for presentation purposes. Further, other programs should be able to work with it, so they must be able to somehow access/download this XML.
I'll take a look at ParsedXML. But at the moment I favor your 'folderish object' idea as it seems to be easily extensible. It could be a simple product that knows how to render its contents etc. Thanks for your ideas, Lars
participants (2)
-
Casey Duncan -
Lars von Wedel