Project

General

Profile

1 7876 aaronmk
<html>
2
	<head>
3 7881 aaronmk
		<title>VegPath</title>
4 7876 aaronmk
		<link rel="stylesheet" type="text/css" href="main.css" />
5
		<style type="text/css">
6
h1 {color: green;}
7
		</style>
8
		<script type="text/javascript" src="util.js"></script>
9
	</head>
10
	<body>
11 7880 aaronmk
		<h1>VegPath&nbsp;&nbsp; <small>human-readable URLs for vegetation resources</small></h1>
12 7882 aaronmk
		<div>Supported URL patterns:&nbsp;&nbsp; <small><i>(elements can be left out successively from the end of the URL)</i></small></div>
13 7876 aaronmk
		<blockquote>
14
			<script type="text/javascript">
15
//// add and list URLs
16
17
// config
18 7879 aaronmk
var alias = 'j.mp/vegpath'
19 7876 aaronmk
20
function by_prefix(url, main_url)
21
{
22
	if (!main_url) main_url = url
23
	return function(path) { return path ? url+path : main_url }
24
}
25
26
var h_level = 4
27
var path = parse_mixed_path(rm_prefix('#', document.location.hash))
28
var ref = path.head.toLowerCase()
29
30
function add_ref(name, suffix, url_func)
31
{
32
	if (typeof url_func === 'string') url_func = by_prefix(url_func)
33
34
	document.write('<h'+h_level+'><code>'+alias+'#<big><a href="http://'+alias
35
		+'#'+name+'">'+name+'</a></big><i>'+suffix+'</i></code></h'+h_level+'>')
36
	if (ref === name.toLowerCase())
37
	{
38
		document.write('<h4 class="progress">Loading '+name+'...</h4>')
39
		document.location = strip_url(url_func(path.tail))
40
	}
41
}
42
43
function fragment_override(url, fragment/*=path.head*/)
44
{
45
	return function(path)
46
	{
47
		if (is_undef(fragment))
48
		{
49
			path = parse_dot_path(path)
50
			fragment = path.head
51
			path = path.tail
52
		}
53
		if (path) url += '?'+path
54
		return url+'#'+fragment
55
	}
56
}
57
58
function phpPgAdmin(url)
59
{
60
	return function(path)
61
	{
62
		path = parse_dot_path(path)
63
		if (path.head)
64
		{
65
			url += '&table='+path.head
66
			if (path.tail) url += '&column='+path.tail+'&subject=column'
67
			else url += '&subject=table'
68
		}
69
		else url += '&subject=schema'
70
		return url
71
	}
72
}
73
74 7885 aaronmk
function phpMyAdmin(url)
75
{
76
	return function(path)
77
	{
78
		path = parse_dot_path(path)
79
		if (path.head)
80
		{
81
			url += '&table='+path.head
82
			if (path.tail) url += '&column='+path.tail+'&subject=column'
83
			else url += '&subject=table'
84
		}
85
		else url += '&subject=schema'
86
		return url
87
	}
88
}
89
90 7876 aaronmk
function VegBank(url)
91
{
92
	return function(path)
93
	{
94
		path = parse_dot_path(path)
95
		if (path.head) url += '/vegbank/views/dba_tabledescription_detail.jsp?view=detail&entity=dba_tabledescription&where=where_tablename&wparam='+path.head+'#'+path.tail
96
		else url += '/get/index/dba_tabledescription'
97
		return url
98
	}
99
}
100
101
document.write('<h2>Terms</h2>')
102
{
103
	document.write('<blockquote>')
104
	document.write('<h3>Exchange schemas</h3>')
105
	{
106
		document.write('<blockquote>')
107
		add_ref('VegCore', '.table.column', 'https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore#')
108
		add_ref('DwC', '.term', 'http://rs.tdwg.org/dwc/terms/#')
109
		{
110
			document.write('<blockquote>'); h_level++
111
			add_ref('DwC-history', '.term', 'http://rs.tdwg.org/dwc/terms/history/#')
112
			document.write('</blockquote>'); h_level--
113
		}
114
		add_ref('TCS', '/XPath', 'http://www.tdwg.org/standards/117/download/#/v101.xsd#')
115
		add_ref('VegX', '/XPath', 'http://wiki.tdwg.org/twiki/pub/Vegetation/WebHome/VegX_Schema_1.5.3_proposed.zip#/veg.xsd#')
116
		document.write('</blockquote>')
117
	}
118
	document.write('<h3>Aggregators</h3>')
119
	{
120
		document.write('<blockquote>')
121
		add_ref('VegBank', '.table.column', VegBank('http://vegbank.org'))
122
		add_ref('SALVIAS', '.table.column', 'http://salvias.net/Documents/salvias_data_dictionary.html#')
123
		add_ref('BIEN2', '.table.column', phpPgAdmin('http://vegbiendev.nceas.ucsb.edu/phppgadmin/redirect.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=public'))
124
		add_ref('VegBIEN', '.table.column', phpPgAdmin('http://vegbiendev.nceas.ucsb.edu/phppgadmin/redirect.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=public'))
125
		document.write('</blockquote>')
126
	}
127
	document.write('<h3>Primary databases</h3>')
128
	{
129
		document.write('<blockquote>')
130
		add_ref('TNRS', '.term', fragment_override('http://tnrs.iplantcollaborative.org/instructions.html', 'download_results'))
131
		document.write('</blockquote>')
132
	}
133
	document.write('</blockquote>')
134
}
135
document.write('<h2>Data</h2>')
136
{
137
	document.write('<blockquote>')
138 7884 aaronmk
	add_ref('IH', '.herbarium_code', by_prefix('http://sweetgum.nybg.org/ih/herbarium_list.php?QueryName=DetailedQuery&Restriction=NamPartyType+%3D+%27IH+Herbarium%27&col_NamOrganisationAcronym=',
139 7876 aaronmk
			'http://sweetgum.nybg.org/ih/'))
140
	document.write('</blockquote>')
141
}
142
			</script>
143
		</blockquote>
144
	</body>
145
</html>