Revision 2891
Added by harris almost 19 years ago
lib/lsid_conf/eml-2.0.0.xslt | ||
---|---|---|
1 |
<?xml version="1.0" encoding='iso-8859-1' ?> |
|
2 |
<xsl:stylesheet xmlns:xalan="http://xml.apache.org/xalan" |
|
3 |
xmlns:java="http://xml.apache.org/xalan/java" |
|
4 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
5 |
version='1.0' |
|
6 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
7 |
xmlns="urn:lsid:@METADATA_LABELS@:predicates:" |
|
8 |
xmlns:pred="urn:lsid:i3c.org:predicates:" |
|
9 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
10 |
xmlns:eml="eml://ecoinformatics.org/eml-2.0.1" |
|
11 |
exclude-result-prefixes="java seek"> |
|
12 |
|
|
13 |
<xsl:template match="/eml:eml"> |
|
14 |
|
|
15 |
<xsl:variable name="metacatServer">@METACAT_SERVER@</xsl:variable> |
|
16 |
<rdf:RDF> |
|
17 |
<xsl:apply-templates select="dataset" /> |
|
18 |
|
|
19 |
<rdf:Description> |
|
20 |
<xsl:attribute name="rdf:about"> |
|
21 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
22 |
</xsl:attribute> |
|
23 |
<xsl:element name="dc:format"> |
|
24 |
<xsl:attribute name="rdf:resource"> |
|
25 |
<xsl:text>urn:lsid:i3c.org:formats:text</xsl:text> |
|
26 |
</xsl:attribute> |
|
27 |
</xsl:element> |
|
28 |
</rdf:Description> |
|
29 |
|
|
30 |
<rdf:Description> |
|
31 |
<xsl:attribute name="rdf:about"> |
|
32 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
33 |
</xsl:attribute> |
|
34 |
<xsl:element name="pred:storedas"> |
|
35 |
<xsl:attribute name="rdf:resource"> |
|
36 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
37 |
</xsl:attribute> |
|
38 |
</xsl:element> |
|
39 |
</rdf:Description> |
|
40 |
|
|
41 |
<rdf:Description> |
|
42 |
<xsl:attribute name="rdf:about"> |
|
43 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
44 |
</xsl:attribute> |
|
45 |
<xsl:element name="rdf:type"> |
|
46 |
<xsl:attribute name="rdf:resource"> |
|
47 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
48 |
</xsl:attribute> |
|
49 |
</xsl:element> |
|
50 |
</rdf:Description> |
|
51 |
|
|
52 |
<rdf:Description> |
|
53 |
<xsl:attribute name="rdf:about"> |
|
54 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
55 |
</xsl:attribute> |
|
56 |
<pred:htmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
57 |
<xsl:text><a href="</xsl:text> |
|
58 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
59 |
<xsl:text>"></xsl:text> |
|
60 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
61 |
<xsl:text></a></xsl:text> |
|
62 |
|
|
63 |
</pred:htmlVersion> |
|
64 |
|
|
65 |
</rdf:Description> |
|
66 |
|
|
67 |
<rdf:Description> |
|
68 |
<xsl:attribute name="rdf:about"> |
|
69 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
70 |
</xsl:attribute> |
|
71 |
<pred:xmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
72 |
<xsl:text><a href="</xsl:text> |
|
73 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
74 |
<xsl:text>"></xsl:text> |
|
75 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
76 |
<xsl:text></a></xsl:text> |
|
77 |
</pred:xmlVersion> |
|
78 |
|
|
79 |
</rdf:Description> |
|
80 |
<rdf:Description> |
|
81 |
<xsl:attribute name="rdf:about"> |
|
82 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
83 |
</xsl:attribute> |
|
84 |
<xsl:element name="rdf:type"> |
|
85 |
<xsl:attribute name="rdf:resource"> |
|
86 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
87 |
</xsl:attribute> |
|
88 |
</xsl:element> |
|
89 |
</rdf:Description> |
|
90 |
|
|
91 |
</rdf:RDF> |
|
92 |
</xsl:template> |
|
93 |
|
|
94 |
<xsl:template match="dataset"> |
|
95 |
<rdf:Description> |
|
96 |
<xsl:attribute name="rdf:about"> |
|
97 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
98 |
</xsl:attribute> |
|
99 |
<pred:title xmlns:pred="http://purl.org/dc/elements/1.1/"> |
|
100 |
<xsl:value-of select="title" /> |
|
101 |
</pred:title> |
|
102 |
</rdf:Description> |
|
103 |
|
|
104 |
<rdf:Description> |
|
105 |
<xsl:attribute name="rdf:about"> |
|
106 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
107 |
</xsl:attribute> |
|
108 |
<pred:creator xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
109 |
<xsl:value-of select="creator" /> |
|
110 |
</pred:creator> |
|
111 |
</rdf:Description> |
|
112 |
|
|
113 |
<rdf:Description> |
|
114 |
<xsl:attribute name="rdf:about"> |
|
115 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
116 |
</xsl:attribute> |
|
117 |
<pred:contact xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
118 |
<xsl:value-of select="contact" /> |
|
119 |
</pred:contact> |
|
120 |
</rdf:Description> |
|
121 |
|
|
122 |
<xsl:apply-templates select="keywordSet/keyword" /> |
|
123 |
<xsl:apply-templates select="distribution/online/url" /> |
|
124 |
|
|
125 |
</xsl:template> |
|
126 |
|
|
127 |
<xsl:template match="keyword"> |
|
128 |
<rdf:Description> |
|
129 |
<xsl:attribute name="rdf:about"> |
|
130 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
131 |
</xsl:attribute> |
|
132 |
<pred:keyword xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
133 |
<xsl:value-of select="@keywordType"/> |
|
134 |
<xsl:text>=</xsl:text> |
|
135 |
<xsl:value-of select="." /> |
|
136 |
</pred:keyword> |
|
137 |
</rdf:Description> |
|
138 |
</xsl:template> |
|
139 |
|
|
140 |
<xsl:template match="url"> |
|
141 |
<rdf:Description> |
|
142 |
<xsl:attribute name="rdf:about"> |
|
143 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
144 |
</xsl:attribute> |
|
145 |
<pred:associatedInfo xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
146 |
|
|
147 |
<xsl:choose> |
|
148 |
<xsl:when test="starts-with(., 'ecogrid://')"> |
|
149 |
<xsl:value-of select="concat('urn:lsid:@LSID_AUTHORITY_STRING@:',substring-after(.,'ecogrid://knr/'))"/> |
|
150 |
</xsl:when> |
|
151 |
<xsl:otherwise> |
|
152 |
<xsl:text><a href="</xsl:text> |
|
153 |
<xsl:value-of select="."/> |
|
154 |
<xsl:text>"></xsl:text> |
|
155 |
<xsl:value-of select="."/> |
|
156 |
<xsl:text></a></xsl:text> |
|
157 |
</xsl:otherwise> |
|
158 |
</xsl:choose> |
|
159 |
</pred:associatedInfo> |
|
160 |
</rdf:Description> |
|
161 |
</xsl:template> |
|
162 |
</xsl:stylesheet> |
|
163 |
|
|
0 | 164 |
lib/lsid_conf/metacat-lsid.properties | ||
---|---|---|
1 | 1 |
metacatserver=@METACAT_SERVER@ |
2 | 2 |
metadatalabels=@METADATA_LABELS@ |
3 |
|
|
4 |
## below is the correspondence between doctypes and stylesheets. The |
|
5 |
## stylesheets are used to format the metadata |
|
6 |
## **remove any colons from the key |
|
7 |
eml//ecoinformatics.org/eml-2.0.1=eml-2.0.1.xslt |
|
8 |
eml//ecoinformatics.org/eml-2.0.0=eml-2.0.0.xslt |
lib/lsid_conf/eml-2.0.1.xslt | ||
---|---|---|
1 |
<?xml version="1.0" encoding='iso-8859-1' ?> |
|
2 |
<xsl:stylesheet xmlns:xalan="http://xml.apache.org/xalan" |
|
3 |
xmlns:java="http://xml.apache.org/xalan/java" |
|
4 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
5 |
version='1.0' |
|
6 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
7 |
xmlns="urn:lsid:@METADATA_LABELS@:predicates:" |
|
8 |
xmlns:pred="urn:lsid:i3c.org:predicates:" |
|
9 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
10 |
xmlns:eml="eml://ecoinformatics.org/eml-2.0.1" |
|
11 |
exclude-result-prefixes="java seek"> |
|
12 |
|
|
13 |
<xsl:template match="/eml:eml"> |
|
14 |
|
|
15 |
<xsl:variable name="metacatServer">@METACAT_SERVER@</xsl:variable> |
|
16 |
<rdf:RDF> |
|
17 |
<xsl:apply-templates select="dataset" /> |
|
18 |
|
|
19 |
<rdf:Description> |
|
20 |
<xsl:attribute name="rdf:about"> |
|
21 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
22 |
</xsl:attribute> |
|
23 |
<xsl:element name="dc:format"> |
|
24 |
<xsl:attribute name="rdf:resource"> |
|
25 |
<xsl:text>urn:lsid:i3c.org:formats:text</xsl:text> |
|
26 |
</xsl:attribute> |
|
27 |
</xsl:element> |
|
28 |
</rdf:Description> |
|
29 |
|
|
30 |
<rdf:Description> |
|
31 |
<xsl:attribute name="rdf:about"> |
|
32 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
33 |
</xsl:attribute> |
|
34 |
<xsl:element name="pred:storedas"> |
|
35 |
<xsl:attribute name="rdf:resource"> |
|
36 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
37 |
</xsl:attribute> |
|
38 |
</xsl:element> |
|
39 |
</rdf:Description> |
|
40 |
|
|
41 |
<rdf:Description> |
|
42 |
<xsl:attribute name="rdf:about"> |
|
43 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
44 |
</xsl:attribute> |
|
45 |
<xsl:element name="rdf:type"> |
|
46 |
<xsl:attribute name="rdf:resource"> |
|
47 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
48 |
</xsl:attribute> |
|
49 |
</xsl:element> |
|
50 |
</rdf:Description> |
|
51 |
|
|
52 |
<rdf:Description> |
|
53 |
<xsl:attribute name="rdf:about"> |
|
54 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
55 |
</xsl:attribute> |
|
56 |
<pred:htmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
57 |
<xsl:text><a href="</xsl:text> |
|
58 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
59 |
<xsl:text>"></xsl:text> |
|
60 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
61 |
<xsl:text></a></xsl:text> |
|
62 |
|
|
63 |
</pred:htmlVersion> |
|
64 |
|
|
65 |
</rdf:Description> |
|
66 |
|
|
67 |
<rdf:Description> |
|
68 |
<xsl:attribute name="rdf:about"> |
|
69 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
70 |
</xsl:attribute> |
|
71 |
<pred:xmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
72 |
<xsl:text><a href="</xsl:text> |
|
73 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
74 |
<xsl:text>"></xsl:text> |
|
75 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
76 |
<xsl:text></a></xsl:text> |
|
77 |
</pred:xmlVersion> |
|
78 |
|
|
79 |
</rdf:Description> |
|
80 |
<rdf:Description> |
|
81 |
<xsl:attribute name="rdf:about"> |
|
82 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
83 |
</xsl:attribute> |
|
84 |
<xsl:element name="rdf:type"> |
|
85 |
<xsl:attribute name="rdf:resource"> |
|
86 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
87 |
</xsl:attribute> |
|
88 |
</xsl:element> |
|
89 |
</rdf:Description> |
|
90 |
|
|
91 |
</rdf:RDF> |
|
92 |
</xsl:template> |
|
93 |
|
|
94 |
<xsl:template match="dataset"> |
|
95 |
<rdf:Description> |
|
96 |
<xsl:attribute name="rdf:about"> |
|
97 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
98 |
</xsl:attribute> |
|
99 |
<pred:title xmlns:pred="http://purl.org/dc/elements/1.1/"> |
|
100 |
<xsl:value-of select="title" /> |
|
101 |
</pred:title> |
|
102 |
</rdf:Description> |
|
103 |
|
|
104 |
<rdf:Description> |
|
105 |
<xsl:attribute name="rdf:about"> |
|
106 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
107 |
</xsl:attribute> |
|
108 |
<pred:creator xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
109 |
<xsl:value-of select="creator" /> |
|
110 |
</pred:creator> |
|
111 |
</rdf:Description> |
|
112 |
|
|
113 |
<rdf:Description> |
|
114 |
<xsl:attribute name="rdf:about"> |
|
115 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
116 |
</xsl:attribute> |
|
117 |
<pred:contact xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
118 |
<xsl:value-of select="contact" /> |
|
119 |
</pred:contact> |
|
120 |
</rdf:Description> |
|
121 |
|
|
122 |
<xsl:apply-templates select="keywordSet/keyword" /> |
|
123 |
<xsl:apply-templates select="distribution/online/url" /> |
|
124 |
|
|
125 |
</xsl:template> |
|
126 |
|
|
127 |
<xsl:template match="keyword"> |
|
128 |
<rdf:Description> |
|
129 |
<xsl:attribute name="rdf:about"> |
|
130 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
131 |
</xsl:attribute> |
|
132 |
<pred:keyword xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
133 |
<xsl:value-of select="@keywordType"/> |
|
134 |
<xsl:text>=</xsl:text> |
|
135 |
<xsl:value-of select="." /> |
|
136 |
</pred:keyword> |
|
137 |
</rdf:Description> |
|
138 |
</xsl:template> |
|
139 |
|
|
140 |
<xsl:template match="url"> |
|
141 |
<rdf:Description> |
|
142 |
<xsl:attribute name="rdf:about"> |
|
143 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
144 |
</xsl:attribute> |
|
145 |
<pred:associatedInfo xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
146 |
|
|
147 |
<xsl:choose> |
|
148 |
<xsl:when test="starts-with(., 'ecogrid://')"> |
|
149 |
<xsl:value-of select="concat('urn:lsid:@LSID_AUTHORITY_STRING@:',substring-after(.,'ecogrid://knr/'))"/> |
|
150 |
</xsl:when> |
|
151 |
<xsl:otherwise> |
|
152 |
<xsl:text><a href="</xsl:text> |
|
153 |
<xsl:value-of select="."/> |
|
154 |
<xsl:text>"></xsl:text> |
|
155 |
<xsl:value-of select="."/> |
|
156 |
<xsl:text></a></xsl:text> |
|
157 |
</xsl:otherwise> |
|
158 |
</xsl:choose> |
|
159 |
</pred:associatedInfo> |
|
160 |
</rdf:Description> |
|
161 |
</xsl:template> |
|
162 |
</xsl:stylesheet> |
|
163 |
|
|
0 | 164 |
lib/lsid_conf/default.xslt | ||
---|---|---|
1 |
<?xml version="1.0" encoding='iso-8859-1' ?> |
|
2 |
<xsl:stylesheet xmlns:xalan="http://xml.apache.org/xalan" |
|
3 |
xmlns:java="http://xml.apache.org/xalan/java" |
|
4 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
5 |
version='1.0' |
|
6 |
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|
7 |
xmlns="urn:lsid:@METADATA_LABELS@:predicates:" |
|
8 |
xmlns:pred="urn:lsid:i3c.org:predicates:" |
|
9 |
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
10 |
xmlns:eml="eml://ecoinformatics.org/eml-2.0.1" |
|
11 |
exclude-result-prefixes="java seek"> |
|
12 |
|
|
13 |
<xsl:template match="/eml:eml"> |
|
14 |
|
|
15 |
<xsl:variable name="metacatServer">@METACAT_SERVER@</xsl:variable> |
|
16 |
<rdf:RDF> |
|
17 |
<xsl:apply-templates select="dataset" /> |
|
18 |
|
|
19 |
<rdf:Description> |
|
20 |
<xsl:attribute name="rdf:about"> |
|
21 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
22 |
</xsl:attribute> |
|
23 |
<xsl:element name="dc:format"> |
|
24 |
<xsl:attribute name="rdf:resource"> |
|
25 |
<xsl:text>urn:lsid:i3c.org:formats:text</xsl:text> |
|
26 |
</xsl:attribute> |
|
27 |
</xsl:element> |
|
28 |
</rdf:Description> |
|
29 |
|
|
30 |
<rdf:Description> |
|
31 |
<xsl:attribute name="rdf:about"> |
|
32 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
33 |
</xsl:attribute> |
|
34 |
<xsl:element name="pred:storedas"> |
|
35 |
<xsl:attribute name="rdf:resource"> |
|
36 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
37 |
</xsl:attribute> |
|
38 |
</xsl:element> |
|
39 |
</rdf:Description> |
|
40 |
|
|
41 |
<rdf:Description> |
|
42 |
<xsl:attribute name="rdf:about"> |
|
43 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
44 |
</xsl:attribute> |
|
45 |
<xsl:element name="rdf:type"> |
|
46 |
<xsl:attribute name="rdf:resource"> |
|
47 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
48 |
</xsl:attribute> |
|
49 |
</xsl:element> |
|
50 |
</rdf:Description> |
|
51 |
|
|
52 |
<rdf:Description> |
|
53 |
<xsl:attribute name="rdf:about"> |
|
54 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
55 |
</xsl:attribute> |
|
56 |
<pred:htmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
57 |
<xsl:text><a href="</xsl:text> |
|
58 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
59 |
<xsl:text>"></xsl:text> |
|
60 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=knb&docid='),@packageId)"/> |
|
61 |
<xsl:text></a></xsl:text> |
|
62 |
|
|
63 |
</pred:htmlVersion> |
|
64 |
|
|
65 |
</rdf:Description> |
|
66 |
|
|
67 |
<rdf:Description> |
|
68 |
<xsl:attribute name="rdf:about"> |
|
69 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
70 |
</xsl:attribute> |
|
71 |
<pred:xmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
72 |
<xsl:text><a href="</xsl:text> |
|
73 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
74 |
<xsl:text>"></xsl:text> |
|
75 |
<xsl:value-of select="concat(concat($metacatServer,'?action=read&qformat=xml&docid='),@packageId)"/> |
|
76 |
<xsl:text></a></xsl:text> |
|
77 |
</pred:xmlVersion> |
|
78 |
|
|
79 |
</rdf:Description> |
|
80 |
<rdf:Description> |
|
81 |
<xsl:attribute name="rdf:about"> |
|
82 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
83 |
</xsl:attribute> |
|
84 |
<xsl:element name="rdf:type"> |
|
85 |
<xsl:attribute name="rdf:resource"> |
|
86 |
<xsl:text>urn:lsid:i3c.org:types:content</xsl:text> |
|
87 |
</xsl:attribute> |
|
88 |
</xsl:element> |
|
89 |
</rdf:Description> |
|
90 |
|
|
91 |
</rdf:RDF> |
|
92 |
</xsl:template> |
|
93 |
|
|
94 |
<xsl:template match="dataset"> |
|
95 |
<rdf:Description> |
|
96 |
<xsl:attribute name="rdf:about"> |
|
97 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
98 |
</xsl:attribute> |
|
99 |
<pred:title xmlns:pred="http://purl.org/dc/elements/1.1/"> |
|
100 |
<xsl:value-of select="title" /> |
|
101 |
</pred:title> |
|
102 |
</rdf:Description> |
|
103 |
|
|
104 |
<rdf:Description> |
|
105 |
<xsl:attribute name="rdf:about"> |
|
106 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
107 |
</xsl:attribute> |
|
108 |
<pred:creator xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
109 |
<xsl:value-of select="creator" /> |
|
110 |
</pred:creator> |
|
111 |
</rdf:Description> |
|
112 |
|
|
113 |
<rdf:Description> |
|
114 |
<xsl:attribute name="rdf:about"> |
|
115 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
116 |
</xsl:attribute> |
|
117 |
<pred:contact xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
118 |
<xsl:value-of select="contact" /> |
|
119 |
</pred:contact> |
|
120 |
</rdf:Description> |
|
121 |
|
|
122 |
<xsl:apply-templates select="keywordSet/keyword" /> |
|
123 |
<xsl:apply-templates select="distribution/online/url" /> |
|
124 |
|
|
125 |
</xsl:template> |
|
126 |
|
|
127 |
<xsl:template match="keyword"> |
|
128 |
<rdf:Description> |
|
129 |
<xsl:attribute name="rdf:about"> |
|
130 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
131 |
</xsl:attribute> |
|
132 |
<pred:keyword xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
133 |
<xsl:value-of select="@keywordType"/> |
|
134 |
<xsl:text>=</xsl:text> |
|
135 |
<xsl:value-of select="." /> |
|
136 |
</pred:keyword> |
|
137 |
</rdf:Description> |
|
138 |
</xsl:template> |
|
139 |
|
|
140 |
<xsl:template match="url"> |
|
141 |
<rdf:Description> |
|
142 |
<xsl:attribute name="rdf:about"> |
|
143 |
<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" /> |
|
144 |
</xsl:attribute> |
|
145 |
<pred:associatedInfo xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:"> |
|
146 |
|
|
147 |
<xsl:choose> |
|
148 |
<xsl:when test="starts-with(., 'ecogrid://')"> |
|
149 |
<xsl:value-of select="concat('urn:lsid:@LSID_AUTHORITY_STRING@:',substring-after(.,'ecogrid://knr/'))"/> |
|
150 |
</xsl:when> |
|
151 |
<xsl:otherwise> |
|
152 |
<xsl:text><a href="</xsl:text> |
|
153 |
<xsl:value-of select="."/> |
|
154 |
<xsl:text>"></xsl:text> |
|
155 |
<xsl:value-of select="."/> |
|
156 |
<xsl:text></a></xsl:text> |
|
157 |
</xsl:otherwise> |
|
158 |
</xsl:choose> |
|
159 |
</pred:associatedInfo> |
|
160 |
</rdf:Description> |
|
161 |
</xsl:template> |
|
162 |
</xsl:stylesheet> |
|
163 |
|
|
0 | 164 |
src/edu/ucsb/nceas/metacat/lsid/LSIDDataLookup.java | ||
---|---|---|
29 | 29 |
import java.net.MalformedURLException; |
30 | 30 |
import java.net.URL; |
31 | 31 |
import java.util.ResourceBundle; |
32 |
import java.util.StringTokenizer; |
|
32 | 33 |
|
33 | 34 |
import org.apache.commons.logging.Log; |
34 | 35 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
50 | 51 |
logger.info("Creating LSIDDataLookup (Metacat)."); |
51 | 52 |
} |
52 | 53 |
|
54 |
public String getDocType(LSID lsid) { |
|
55 |
// example |
|
56 |
//http://metacat.nceas.ucsb.edu/knb/metacat?action=getrevisionanddoctype&docid=knb-lter-gce.109.6 |
|
57 |
// returns rev;doctype |
|
58 |
|
|
59 |
String _docType = null; |
|
60 |
String ns = lsid.getNamespace(); |
|
61 |
String id = lsid.getObject(); |
|
62 |
String ver = lsid.getRevision(); |
|
63 |
InputStream docStream = null; |
|
64 |
|
|
65 |
ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid"); |
|
66 |
String theServer = rb.getString("metacatserver"); |
|
67 |
logger.debug("the server is " + theServer); |
|
68 |
|
|
69 |
String url = theServer + "?action=getrevisionanddoctype&docid="; |
|
70 |
url = url + ns + "." + id + "." + ver; |
|
71 |
try { |
|
72 |
URL theDoc = new URL(url); |
|
73 |
docStream = theDoc.openStream(); |
|
74 |
|
|
75 |
StringTokenizer _st = new StringTokenizer(LSIDAuthorityMetaData. |
|
76 |
getStringFromInputStream( |
|
77 |
docStream), ";"); |
|
78 |
_st.nextToken(); |
|
79 |
_docType = _st.nextToken(); |
|
80 |
docStream.close(); |
|
81 |
} |
|
82 |
catch (MalformedURLException mue) { |
|
83 |
logger.error("MalformedURLException in LSIDDataLookup: " + mue); |
|
84 |
mue.printStackTrace(); |
|
85 |
} |
|
86 |
catch (IOException ioe) { |
|
87 |
logger.error("IOException in LSIDDataLookup: " + ioe); |
|
88 |
ioe.printStackTrace(); |
|
89 |
} |
|
90 |
return _docType; |
|
91 |
} |
|
92 |
|
|
53 | 93 |
public int lsidType(LSID lsid) throws LSIDServerException |
54 | 94 |
{ |
55 | 95 |
|
src/edu/ucsb/nceas/metacat/lsid/LSIDAuthorityMetaData.java | ||
---|---|---|
34 | 34 |
import java.io.StringReader; |
35 | 35 |
import java.util.Hashtable; |
36 | 36 |
import java.util.ResourceBundle; |
37 |
import java.util.Enumeration; |
|
37 | 38 |
|
38 | 39 |
import javax.xml.transform.Transformer; |
39 | 40 |
import javax.xml.transform.TransformerFactory; |
... | ... | |
72 | 73 |
private static final String DC_NS = "http://purl.org/dc/elements/1.1/"; |
73 | 74 |
private static final String I3CP_NS = "urn:lsid:i3c.org:predicates:"; |
74 | 75 |
private static final String I3C_CONTENT = "urn:lsid:i3c.org:types:content"; |
76 |
private static final String DEFAULT_STYLESHEET = "default.xslt"; |
|
75 | 77 |
|
76 | 78 |
public MetadataResponse getMetadata(LSIDRequestContext req, String[] formats) |
77 | 79 |
throws LSIDServerException |
... | ... | |
86 | 88 |
throws LSIDServerException |
87 | 89 |
{ |
88 | 90 |
logger.debug("getting metadata for lsid " + lsid.getLsid()); |
91 |
|
|
89 | 92 |
try { |
90 | 93 |
|
91 |
String styleSheetName = null; |
|
92 |
styleSheetName = "metacat.xslt"; |
|
94 |
|
|
95 |
|
|
93 | 96 |
LSIDDataLookup myLookup = new LSIDDataLookup(); |
94 | 97 |
InputStream content = myLookup.lsidData(lsid); |
95 | 98 |
InputStream content2 = myLookup.lsidData(lsid); |
... | ... | |
98 | 101 |
} |
99 | 102 |
content2.close(); |
100 | 103 |
setCurrentLSID(lsid); |
104 |
|
|
105 |
// based on the doctype choose the appropriate stylesheet |
|
106 |
String styleSheetName = null; |
|
107 |
String _docType = myLookup.getDocType(lsid); |
|
108 |
|
|
109 |
try { |
|
110 |
ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid"); |
|
111 |
|
|
112 |
|
|
113 |
for (Enumeration e = rb.getKeys(); e.hasMoreElements() ;) { |
|
114 |
System.out.println(e.nextElement()); |
|
115 |
} |
|
116 |
|
|
117 |
|
|
118 |
styleSheetName = rb.getString(_docType.replaceAll(":","")); |
|
119 |
logger.debug("the stylesheet: " + styleSheetName); |
|
120 |
|
|
121 |
logger.debug("\n\nlsid is of type: " + _docType + " using stylesheet: " |
|
122 |
+ styleSheetName + "\n\n"); |
|
123 |
} |
|
124 |
catch (java.util.MissingResourceException mre) { |
|
125 |
logger.warn("there is no style corresponding to: '" + _docType + |
|
126 |
"' -- using default"); |
|
127 |
styleSheetName = this.DEFAULT_STYLESHEET; |
|
128 |
mre.getMessage(); |
|
129 |
} |
|
101 | 130 |
InputStream styleSheet = getClass() |
102 | 131 |
.getResourceAsStream(styleSheetName); |
103 | 132 |
TransformerFactory factory = TransformerFactory.newInstance(); |
... | ... | |
115 | 144 |
} |
116 | 145 |
} |
117 | 146 |
|
118 |
private String getStringFromInputStream(InputStream input)
|
|
147 |
public static String getStringFromInputStream(InputStream input)
|
|
119 | 148 |
{ |
120 | 149 |
StringBuffer result = new StringBuffer(); |
121 | 150 |
BufferedReader in = new BufferedReader(new InputStreamReader(input)); |
... | ... | |
127 | 156 |
} catch (IOException e) { |
128 | 157 |
logger.error("IOexception " + e); |
129 | 158 |
} |
130 |
|
|
131 | 159 |
return result.toString(); |
132 |
|
|
133 | 160 |
} |
134 | 161 |
|
135 | 162 |
/** |
136 | 163 |
* figure out is this inputstream is an eml document or not |
137 |
* TODO: need a better way to figure out if this is an eml document
|
|
164 |
* TODO: need a better way to figure out if this is an eml document |
|
138 | 165 |
*/ |
139 | 166 |
private boolean isEML(InputStream input) |
140 | 167 |
{ |
src/edu/ucsb/nceas/metacat/lsid/LSIDAuthorityMain.java | ||
---|---|---|
122 | 122 |
public HostDescriptor(String url) |
123 | 123 |
{ |
124 | 124 |
logger.debug("Creating a HostDescriptor for: " + url); |
125 |
// Thread.dumpStack(); |
|
126 | 125 |
host = "localhost"; |
127 | 126 |
port = -1; |
128 | 127 |
pathPrefix = ""; |
Also available in: Unified diff
Modified the lsid code to lookup document type-appropriate stylesheets from
the lsid prooperties file.