|Date||Wed, 10 Mar 2004 22:09:12 +1300|
|Subject||Re: [greenstone-devel] Hyperlink help|
My question to you is: how badly do you want this?
When we received your question on the support form (which we were going to reply to, BTW) we discussed it for a while and couldn't really come up with anything "nice" -- or, to be honest, anything that didn't involve adding a lot of very specific code.
The problem, as you know, is that there is no way (in general) to map from a piece of metadata to its position in a classification hierarchy. This could be thought of as a disadvantage of Greenstone, but in fact adding this information would likely be a nightmare -- and it is very rarely needed (although yours is a valid case, I agree).
After thinking about this some more tonight I realised that in fact there is one case where you can map from a piece of metadata to its position in a classification hierarchy -- when you are using the Hierarchy classifier (good choice!). But, to get the effect you're after you have to make a sacrifice: you have to hard-wire both the position and the name into the first part of each hfile line. Usually, the position (2nd part) is independent from the key (1st part), and this means if you want to insert new items into the classification hierarchy you just have to modify the hfile. With what I suggest below, you would need to modify the hfile, and all your metadata.xml files. If you want to do this on a big collection or one that is continually growing, forget about this solution.
OK, lets say your hfile for Surname looks like:
"Adams" 1 "Adams"
and your Surname classifier is the second classifier -- which means your classification values look like CL3.1, CL3.2, CL3.3 etc.
First, change the hfile to (you need the backslashes to escape the quote mark and right angle bracket):
"CL3.1">Adams" 1 "Adams"
and then change the metadata values in your metadata.xml files to match:
Lastly, you need to change your format statements to add the rest of the link to the classification node in.
For one surname:
Surname: <a href="/gsdlmod?a=d&c=gsarch&cl=[Surname]</a>
And for multiple surnames (it looks totally messed up but it all makes sense in the end...):
Surnames: <a href="/gsdlmod?a=d&c=gsarch&cl=[sibling(All'</a> <a href="/gsdlmod?a=d&c=gsarch&cl='):Surname]
And that's it! Quite possibly the most disgusting hack I've ever done... it makes the hfiles ugly, the metadata.xml files ugly, and the format statements supremely ugly -- but it works, and you don't have to touch any code.
I expect some of the other Greenstone developers will take offense at this suggestion and come up with something much nicer -- and I hope they do. But until then, it might be worth considering, and it is kind of neat in its own twisted way!!
All the best,
Chris Vasquez wrote:
I am currently using Greenstone version 2.41 on Red Hat Linux with Apache 2.0. I've built a collection that uses a Surname.txt file using the hierarchy classifier. In the metadata.xml file I've used the accumulate command as shown below to list the photo entitled Adams under 5 different surname links (Adams, Maw, Owen, Coffee, Matheson) on the Surnames page. See link for an example: http://www.walkercountytreasures.com/cgi-bin/library?e=d-000-00---0bible--00-0-0-0prompt-10---4----dtp--0-1l--1-en-50---20-about-1--00031-001-1-0utfZz-8-00&a=d&cl=CL2.1.pr<Metadata name="Title">Adams</Metadata><Metadata name="Surname" mode="accumulate">Adams</Metadata>