Re: [greenstone-devel] Hyperlink help

From Michael Dewsnip
DateWed, 10 Mar 2004 22:09:12 +1300
Subject Re: [greenstone-devel] Hyperlink help
In-Reply-To (BD87AC006CAA544EB288786AD8B45E4106668A-SVRMAIL-cityofhuntsville-com)
Dear Chris,

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"
"Coffee" 2 "Coffee"
"Matheson" 3 "Matheson"

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"
"CL3.2">Coffee" 2 "Coffee"
"CL3.3">Matheson" 3 "Matheson"

and then change the metadata values in your metadata.xml files to match:

<Metadata name="Title">Adams</Metadata>
<Metadata name="Surname" mode="accumulate">CL3.1">Adams</Metadata>
<Metadata name="Surname" mode="accumulate">CL3.2">Coffee</Metadata>
<Metadata name="Surname" mode="accumulate">CL3.3">Matheson</Metadata>

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>&nbsp;<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.0I'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:<Metadata name="Title">Adams</Metadata><Metadata name="Surname" mode="accumulate">Adams</Metadata>
<Metadata name="Surname" mode="accumulate">Maw</Metadata>
<Metadata name="Surname" mode="accumulate">Owen</Metadata>
<Metadata name="Surname" mode="accumulate">Coffee</Metadata><Metadata name="Surname" mode="accumulate">Matheson</Metadata>Looking at the Titles A-Z page you can see the different surnames listed under Surname:  See link for an example: question is can each surname (Adams, Maw, Owen, Coffee, Matheson) on the Titles A-Z page be made into a hyperlink pointing back to its relevant link on the Surnames page?  For example, I would like the abililty to click on the surname Owen from the Titles A-Z page it should take me here: you,  Chris VasquezNetwork AdministratorCity of Huntsville936-291-5429

_______________________________________________ greenstone-devel mailing list