2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 xmlns:xs="http://www.w3.org/2001/XMLSchema#"
5 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
7 xmlns:submission="http://jumpgate.caltech.edu/wiki/UcscSubmissionOntology#"
8 xmlns:sra="http://www.ncbi.nlm.nih.gov/sra"
9 xmlns:sras="http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-3/SRA.package.xsd#"
10 xmlns:sraa="http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-3/SRA.attribute#"
13 <xsl:output method="xml" indent="yes"/>
15 <xsl:template match="/">
16 <rdf:RDF xmlns:ddf="http://encodesubmit.ucsc.edu/pipeline/download_ddf#"
17 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
18 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
19 xmlns:submission="http://jumpgate.caltech.edu/wiki/UcscSubmissionOntology#"
20 xmlns:pipeline="http://encodesubmit.ucsc.edu/pipeline/"
21 xmlns:sra="http://www.ncbi.nlm.nih.gov/sra"
22 xmlns:sras="http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-3/SRA.package.xsd#"
23 xmlns:sraa="http://www.ncbi.nlm.nih.gov/viewvc/v1/trunk/sra/doc/SRA_1-3/SRA.attribute#"
25 <xsl:apply-templates select="*"/>
29 <xsl:template match="EXPERIMENT_PACKAGE">
30 <xsl:apply-templates select="./EXPERIMENT"/>
31 <!-- xsl:for-each select="./EXPERIMENT/EXPERIMENT_ATTRIBUTES/EXPERIMENT_ATTRIBUTE">
32 <xsl:call-template name="node_detail"/>
34 <xsl:apply-templates select="./SUBMISSION"/>
35 <xsl:apply-templates select="./STUDY"/>
36 <xsl:apply-templates select="./SAMPLE"/>
37 <!-- xsl:for-each select="./SAMPLE/SAMPLE_ATTRIBUTES/SAMPLE_ATTRIBUTE">
38 <xsl:call-template name="node_detail"/>
40 <xsl:apply-templates select="./RUN_SET"/>
43 <xsl:template match="EXPERIMENT">
45 <xsl:attribute name="rdf:about">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
46 <sras:experiment_alias><xsl:value-of select="@alias"/></sras:experiment_alias>
47 <sras:center_name><xsl:value-of select="@center_name"/></sras:center_name>
48 <xsl:apply-templates select="STUDY_REF"/>
49 <xsl:apply-templates select="DESIGN"/>
50 <xsl:apply-templates select="PLATFORM"/>
51 <xsl:for-each select="./EXPERIMENT_ATTRIBUTES/EXPERIMENT_ATTRIBUTE">
52 <xsl:call-template name="node_simple"/>
55 <xsl:attribute name="rdf:resource">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="../SUBMISSION/@accession"/></xsl:attribute>
60 <xsl:template match="STUDY_REF">
62 <xsl:attribute name="rdf:resource">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
66 <xsl:template match="DESIGN">
67 <xsl:apply-templates select="SAMPLE_DESCRIPTOR"/>
68 <xsl:apply-templates select="LIBRARY_DESCRIPTOR"/>
71 <xsl:template match="SAMPLE_DESCRIPTOR">
73 <xsl:attribute name="rdf:resource">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
77 <xsl:template match="LIBRARY_DESCRIPTOR">
78 <sras:library_name><xsl:value-of select="LIBRARY_NAME"/></sras:library_name>
79 <sras:library_strategy><xsl:value-of select="LIBRARY_STRATEGY"/></sras:library_strategy>
80 <sras:library_source><xsl:value-of select="LIBRARY_SOURCE"/></sras:library_source>
81 <sras:library_selection><xsl:value-of select="LIBRARY_SELECTION"/></sras:library_selection>
82 <sras:library_protocol>
83 <xsl:attribute name="rdf:resource">http:<xsl:value-of select="substring-after(LIBRARY_CONSTRUCTION_PROTOCOL, 'http')"/></xsl:attribute></sras:library_protocol>
86 <xsl:template match="PLATFORM">
87 <sras:instrument_model><xsl:value-of select="ILLUMINA/INSTRUMENT_MODEL"/></sras:instrument_model>
88 <sras:sequence_length rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal"><xsl:value-of select="ILLUMINA/SEQUENCE_LENGTH"/></sras:sequence_length>
91 <!-- xsl:template select="EXPERIMENT" mode="ref" -->
92 <xsl:template name="node_ref">
94 <xsl:attribute rdf:name="rdf:nodeID"><xsl:value-of select="generate-id(node())"/></xsl:attribute>
98 <!-- xsl:template name="attribute" mode="nodedetail" -->
99 <xsl:template name="node_detail">
101 <xsl:attribute rdf:name="rdf:nodeID"><xsl:value-of select="generate-id(node())"/></xsl:attribute>
102 <sras:attribute_name><xsl:value-of select="TAG"/></sras:attribute_name>
105 <xsl:attribute rdf:name="rdf:nodeID"><xsl:value-of select="generate-id(node())"/></xsl:attribute>
106 <sras:attribute_value><xsl:value-of select="VALUE"/></sras:attribute_value>
110 <!-- try to generate attributes with non blank nodes -->
111 <xsl:template name="node_simple">
112 <xsl:variable name="spacelessTag">
113 <xsl:call-template name="string-replace-all">
114 <xsl:with-param name="text" select="TAG" />
115 <xsl:with-param name="replace" select="' '" />
116 <xsl:with-param name="by" select="'_'" />
119 <xsl:element name="sraa:{$spacelessTag}"><xsl:value-of select="VALUE"/></xsl:element>
122 <!-- SUBMISSION TOP LEVEL -->
123 <xsl:template match="SUBMISSION">
125 <xsl:attribute name="rdf:about">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
126 <sras:alias><xsl:value-of select="@alias"/></sras:alias>
127 <sras:comment><xsl:value-of select="@submission_comment"/></sras:comment>
128 <sras:date rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime"><xsl:value-of select="@submission_date"/></sras:date>
129 <sras:lab_name><xsl:value-of select="@lab_name"/></sras:lab_name>
130 <sras:accession><xsl:value-of select="@accession"/></sras:accession>
134 <xsl:template match="STUDY">
136 <xsl:attribute name="rdf:about">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
137 <sras:study_alias><xsl:value-of select="@alias"/></sras:study_alias>
138 <sras:title><xsl:value-of select="DESCRIPTOR/STUDY_TITLE"/></sras:title>
139 <sras:description><xsl:value-of select="normalize-space(DESCRIPTOR/STUDY_DESCRIPTION)"/></sras:description>
143 <xsl:template match="SAMPLE">
145 <xsl:attribute name="rdf:about">http://www.ncbi.nlm.nih.gov/sra/<xsl:value-of select="@accession"/></xsl:attribute>
146 <sras:sample_alias><xsl:value-of select="@alias"/></sras:sample_alias>
147 <sras:common_name><xsl:value-of select="SAMPLE_NAME/COMMON_NAME"/></sras:common_name>
148 <sras:description><xsl:value-of select="DESCRIPTION"/></sras:description>
149 <xsl:for-each select="./SAMPLE_ATTRIBUTES/SAMPLE_ATTRIBUTE">
150 <xsl:call-template name="node_simple"/>
154 <xsl:template match="RUN_SET">
157 <!-- from http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx -->
158 <xsl:template name="string-replace-all">
159 <xsl:param name="text" />
160 <xsl:param name="replace" />
161 <xsl:param name="by" />
163 <xsl:when test="contains($text, $replace)">
164 <xsl:value-of select="substring-before($text,$replace)" />
165 <xsl:value-of select="$by" />
166 <xsl:call-template name="string-replace-all">
167 <xsl:with-param name="text"
168 select="substring-after($text,$replace)" />
169 <xsl:with-param name="replace" select="$replace" />
170 <xsl:with-param name="by" select="$by" />
174 <xsl:value-of select="$text" />