| 1 |
<HTML> |
| 2 |
|
| 3 |
<HEAD> |
| 4 |
<TITLE>A Guide To Using URLs in ACEDB</TITLE> |
| 5 |
|
| 6 |
<LINK rel=stylesheet type="text/css" |
| 7 |
href="./wdoc.css" |
| 8 |
title="Style sheet for wdoc developer documents"> |
| 9 |
|
| 10 |
</HEAD> |
| 11 |
|
| 12 |
|
| 13 |
<BODY> |
| 14 |
|
| 15 |
|
| 16 |
<BLOCKQUOTE> |
| 17 |
<DIV ALIGN=CENTER> |
| 18 |
<IMG SRC="acedb-logo.gif" ALT="[ACEDB DOCUMENTATION]" align=middle> |
| 19 |
<H3> |
| 20 |
ACEDB Version 4_8 |
| 21 |
</H3> |
| 22 |
</DIV> |
| 23 |
|
| 24 |
|
| 25 |
<DIV ALIGN=CENTER> |
| 26 |
|
| 27 |
<H1 align=center> |
| 28 |
A Guide To Using URLs in ACEDB |
| 29 |
</H1> |
| 30 |
|
| 31 |
<ADDRESS>Originally written by<BR> |
| 32 |
Richard Durbin <[email protected]>, July 2000</ADDRESS> |
| 33 |
|
| 34 |
</DIV> |
| 35 |
|
| 36 |
<H2>Richard Durbins description of the current system</H2> |
| 37 |
|
| 38 |
<pre>There is in fact a standard acedb way to put URLs into acedb, which I |
| 39 |
guess Arnthor has found since he says it works for him. This is not a |
| 40 |
specific class, but rather a display type. It's behaviour is |
| 41 |
potentially quite complex, though it is easy to do the standard simple |
| 42 |
things. |
| 43 |
|
| 44 |
I think it is worth describing the full behaviour because it might be |
| 45 |
good to reimplement it in AceBrowser for consistency. The original code |
| 46 |
is in doWWWDisplay() in display.c. |
| 47 |
|
| 48 |
1) If the object contains the tag "Url" then use the following text as |
| 49 |
the URL (that's the easy case!). |
| 50 |
|
| 51 |
Else if the object contains the tag "Web_location" followed by <key> |
| 52 |
then we expect that the object corresponding to <key> contains template |
| 53 |
information that will tell you how to construct the URL from the |
| 54 |
original object. The principle is that first you find some base text, |
| 55 |
then apply some rewriting rules. This allows many objects to share one |
| 56 |
URL construction template. |
| 57 |
|
| 58 |
First to get the base text: |
| 59 |
|
| 60 |
2) If the tag "Reference_tag" occurs in the template followed by some |
| 61 |
text, then assume that text is a tag name, and look for the base text |
| 62 |
to follow this tag in the original object. There is some code that |
| 63 |
allows this to be done in a class-specific way, so that e.g. |
| 64 |
|
| 65 |
Reference_tag Foo Sequence |
| 66 |
Bar Clone |
| 67 |
|
| 68 |
would use the Foo tag when this template is applied to Sequence |
| 69 |
objects and the Bar tag when applied to Clones. The default if just |
| 70 |
|
| 71 |
Reference_tag Foo |
| 72 |
|
| 73 |
is to look following Foo in the original object independent of class. |
| 74 |
|
| 75 |
3) If (2) gave nothing, and the tag "Use_name" is found in the template, |
| 76 |
then use the name of the original object. This too can be class |
| 77 |
qualified, so that |
| 78 |
|
| 79 |
Use_name Locus |
| 80 |
Allele |
| 81 |
|
| 82 |
would mean that this template only uses gets the base text from the |
| 83 |
name for the Locus and Allele classes. Again, the default if the tag |
| 84 |
"Use_name" is not followed by anything is to use the name for the |
| 85 |
base text whatever is being displayed. |
| 86 |
|
| 87 |
|
| 88 |
4) Next protect unclean URL characters. |
| 89 |
|
| 90 |
5) Next if the tag "Rewrite" exists in the template, then apply the |
| 91 |
first of the rewrite rules that matches and display. Else just |
| 92 |
display the base text. Rewrite rules are given via |
| 93 |
|
| 94 |
Rewrite <new prefix> <new suffix> [<old prefix> [<old suffix>]] |
| 95 |
|
| 96 |
if an old prefix and/or suffix is given, then it is required to match |
| 97 |
to that for the rule to apply. If there is a match, then these are |
| 98 |
deleted. Following which, the new prefix and suffix are pre- and |
| 99 |
post-pended. |
| 100 |
|
| 101 |
Example: |
| 102 |
|
| 103 |
Protein SP:P15501 |
| 104 |
Web_location Expasy |
| 105 |
|
| 106 |
URL_template Expasy |
| 107 |
Use_name |
| 108 |
Rewrite http://www.expasy.ch/cgi-bin/niceprot.pl? "" SP: |
| 109 |
|
| 110 |
would, if Protein SP:P15501 were displayed with display method WWW, |
| 111 |
generate the URL "http://www.expasy.ch/cgi-bin/niceprot.pl?P15501" |
| 112 |
|
| 113 |
Note that you would think that the absolute default behaviour if neither |
| 114 |
Url nor Web_location is given in the original object would be to use the |
| 115 |
name of the object as the URL. That doesn't seem to be the case. |
| 116 |
Shouldn't it be, Simon? |
| 117 |
|
| 118 |
Richard |
| 119 |
|
| 120 |
</pre> |
| 121 |
|
| 122 |
|
| 123 |
<H2>Lincoln Steins comments</H2> |
| 124 |
|
| 125 |
<pre>Richard, |
| 126 |
|
| 127 |
Thanks for the information. This sounds a bit hairy, but I |
| 128 |
think I can code it. It's a little more difficult to assign |
| 129 |
special behaviors to tags (and combinations) of tags, than to |
| 130 |
specific classes, and I'm going to have to do a bit of client |
| 131 |
side caching of the templates in order to avoid a double-trip |
| 132 |
to the server for each URL displayed. |
| 133 |
|
| 134 |
Any reason you didn't do it like this? |
| 135 |
|
| 136 |
Url ?Url_template text |
| 137 |
|
| 138 |
where text is the variant part of the Url? Then the rewrite |
| 139 |
rule could just contain a placeholder for the substitution, |
| 140 |
such as http://foo.bar/cgi-bin?lookup=%1 |
| 141 |
|
| 142 |
I notice that the C elegans models.wrm has two URL things: |
| 143 |
|
| 144 |
?Url Url UNIQUE Text // Simple, text of URL |
| 145 |
Template UNIQUE ?Url // use this object as a generic template |
| 146 |
Reference_tag UNIQUE Text // look for this tag in the reffing object for url |
| 147 |
Remove_prefix UNIQUE Text // prefix to remove to make url |
| 148 |
Remove_postfix UNIQUE Text // postfix to remove to make url |
| 149 |
Prepend UNIQUE Text // then add this to the beginning |
| 150 |
Append UNIQUE Text // then add this to the end |
| 151 |
Web_location UNIQUE ?WWW_server |
| 152 |
|
| 153 |
?WWW_server Url UNIQUE Text // Simple, text of URL |
| 154 |
Use_name Text // (optional) Classname |
| 155 |
Rewrite Text UNIQUE Text Text UNIQUE Text |
| 156 |
Reference_tag UNIQUE Text // look for this tag in the reffing object for |
| 157 |
url |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
While RiceGenes (and many of the other agro databases) do something else: |
| 162 |
|
| 163 |
?Database Name Text // Full name |
| 164 |
Contents ?Text // Description of material included |
| 165 |
WWW Arg1_URL_prefix UNIQUE Text |
| 166 |
Arg1_URL_suffix UNIQUE Text |
| 167 |
Arg2_URL_prefix UNIQUE Text |
| 168 |
Arg2_URL_suffix UNIQUE Text |
| 169 |
|
| 170 |
I guess this has been through a number of iterations. Should I contact |
| 171 |
Sam Cartinhour, Dave Matthews and the UK Cropnet folk and poll them on |
| 172 |
whether they are dependent on any particular version of the URL model? |
| 173 |
|
| 174 |
Lincoln |
| 175 |
</pre> |
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
<HR> |
| 181 |
<H3 ALIGN="CENTER">ACEDB Version 4_8</H3> |
| 182 |
|
| 183 |
<HR> |
| 184 |
<ADDRESS><a href="mailto:[email protected]">Ed Griffiths <[email protected]></a></ADDRESS> |
| 185 |
<!-- hhmts start --> |
| 186 |
Last modified: Tue Feb 6 13:21:44 GMT 2001 |
| 187 |
<!-- hhmts end --> |
| 188 |
|
| 189 |
</BLOCKQUOTE> |
| 190 |
</BODY> |
| 191 |
</HTML> |