| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
|---|
| 2 | <!DOCTYPE rdf:RDF [ |
|---|
| 3 | <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"> |
|---|
| 4 | <!ENTITY owl "http://www.w3.org/2002/07/owl#"> |
|---|
| 5 | <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"> |
|---|
| 6 | <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#"> |
|---|
| 7 | ]> |
|---|
| 8 | <xsl:stylesheet |
|---|
| 9 | version="1.0" |
|---|
| 10 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|---|
| 11 | xmlns:xsd="http://www.w3.org/2001/XMLSchema" |
|---|
| 12 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|---|
| 13 | xmlns:PDBx="http://pdbml.pdb.org/schema/pdbx-v32.xsd" |
|---|
| 14 | xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
|---|
| 15 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|---|
| 16 | xmlns:owl="http://www.w3.org/2002/07/owl#"> |
|---|
| 17 | <xsl:output method="xml" indent="yes"/> |
|---|
| 18 | <xsl:strip-space elements="*"/> |
|---|
| 19 | |
|---|
| 20 | <xsl:template match="/"> |
|---|
| 21 | <rdf:RDF |
|---|
| 22 | xmlns:owl="http://www.w3.org/2002/07/owl#" |
|---|
| 23 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|---|
| 24 | xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" |
|---|
| 25 | xmlns:xsd="http://www.w3.org/2001/XMLSchema#" |
|---|
| 26 | xmlns:PDBo="http://www.pdbj.org/schema/pdbx-v32.owl#" |
|---|
| 27 | > |
|---|
| 28 | <owl:Ontology rdf:about=""> |
|---|
| 29 | <rdfs:label>PDBx ontology</rdfs:label> |
|---|
| 30 | <rdfs:comment>The PDBx OWL ontology translated from the PDBML schema.</rdfs:comment> |
|---|
| 31 | </owl:Ontology> |
|---|
| 32 | |
|---|
| 33 | <owl:Class rdf:ID="CategoryElement"> |
|---|
| 34 | <rdfs:label>CategoryElement</rdfs:label> |
|---|
| 35 | <rdfs:comment>Abstract class for category elements.</rdfs:comment> |
|---|
| 36 | </owl:Class> |
|---|
| 37 | |
|---|
| 38 | <owl:DatatypeProperty rdf:ID="categoryItem"> |
|---|
| 39 | <rdfs:label>categoryItem</rdfs:label> |
|---|
| 40 | <rdfs:comment>Abstract Datatype property for category items</rdfs:comment> |
|---|
| 41 | <rdfs:domain rdf:resource="#CategoryElement"/> |
|---|
| 42 | </owl:DatatypeProperty> |
|---|
| 43 | |
|---|
| 44 | <owl:ObjectProperty rdf:ID="crossReference"> |
|---|
| 45 | <rdfs:comment>Abstract property for cross-references.</rdfs:comment> |
|---|
| 46 | </owl:ObjectProperty> |
|---|
| 47 | |
|---|
| 48 | <owl:ObjectProperty rdf:ID="reference_to"> |
|---|
| 49 | <rdfs:comment>Abstract property for cross-references between categories.</rdfs:comment> |
|---|
| 50 | <rdfs:subPropertyOf rdf:resource="#crossReference"/> |
|---|
| 51 | <rdfs:domain rdf:resource="#CategoryElement"/> |
|---|
| 52 | <rdfs:range rdf:resource="#CategoryElement"/> |
|---|
| 53 | </owl:ObjectProperty> |
|---|
| 54 | |
|---|
| 55 | <owl:ObjectProperty rdf:ID="link_to"> |
|---|
| 56 | <rdfs:subPropertyOf rdf:resource="#crossReference"/> |
|---|
| 57 | <rdfs:comment>Abstract property for external links</rdfs:comment> |
|---|
| 58 | </owl:ObjectProperty> |
|---|
| 59 | |
|---|
| 60 | <owl:ObjectProperty rdf:ID="link_to_pdb"> |
|---|
| 61 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 62 | <rdfs:comment>link to related PDB entry</rdfs:comment> |
|---|
| 63 | </owl:ObjectProperty> |
|---|
| 64 | |
|---|
| 65 | <owl:ObjectProperty rdf:ID="link_to_pubmed"> |
|---|
| 66 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 67 | <rdfs:comment>external link to pubmed</rdfs:comment> |
|---|
| 68 | </owl:ObjectProperty> |
|---|
| 69 | |
|---|
| 70 | <owl:ObjectProperty rdf:ID="link_to_sequence_db"> |
|---|
| 71 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 72 | <rdfs:comment>external link to sequence databases</rdfs:comment> |
|---|
| 73 | </owl:ObjectProperty> |
|---|
| 74 | |
|---|
| 75 | <owl:ObjectProperty rdf:ID="link_to_uniprot"> |
|---|
| 76 | <rdfs:subPropertyOf rdf:resource="#link_to_sequence_db"/> |
|---|
| 77 | <rdfs:comment>external link to UniProt</rdfs:comment> |
|---|
| 78 | </owl:ObjectProperty> |
|---|
| 79 | |
|---|
| 80 | <owl:ObjectProperty rdf:ID="link_to_genbank"> |
|---|
| 81 | <rdfs:subPropertyOf rdf:resource="#link_to_sequence_db"/> |
|---|
| 82 | <rdfs:comment>external link to GenBank</rdfs:comment> |
|---|
| 83 | </owl:ObjectProperty> |
|---|
| 84 | |
|---|
| 85 | <owl:ObjectProperty rdf:ID="link_to_embl"> |
|---|
| 86 | <rdfs:subPropertyOf rdf:resource="#link_to_sequence_db"/> |
|---|
| 87 | <rdfs:comment>external link to EMBL</rdfs:comment> |
|---|
| 88 | </owl:ObjectProperty> |
|---|
| 89 | |
|---|
| 90 | <owl:ObjectProperty rdf:ID="link_to_doi"> |
|---|
| 91 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 92 | <rdfs:comment>external link to DOI (digital object identifier)</rdfs:comment> |
|---|
| 93 | </owl:ObjectProperty> |
|---|
| 94 | |
|---|
| 95 | <owl:ObjectProperty rdf:ID="link_to_taxonomy"> |
|---|
| 96 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 97 | <rdfs:comment>external link to NCBI taxonomy</rdfs:comment> |
|---|
| 98 | </owl:ObjectProperty> |
|---|
| 99 | |
|---|
| 100 | <owl:ObjectProperty rdf:ID="link_to_taxonomy_source"> |
|---|
| 101 | <rdfs:subPropertyOf rdf:resource="#link_to_taxonomy"/> |
|---|
| 102 | <rdfs:comment>external link to NCBI taxonomy (source organism)</rdfs:comment> |
|---|
| 103 | </owl:ObjectProperty> |
|---|
| 104 | |
|---|
| 105 | <owl:ObjectProperty rdf:ID="link_to_taxonomy_host"> |
|---|
| 106 | <rdfs:subPropertyOf rdf:resource="#link_to_taxonomy"/> |
|---|
| 107 | <rdfs:comment>external link to NCBI taxonomy (host organism)</rdfs:comment> |
|---|
| 108 | </owl:ObjectProperty> |
|---|
| 109 | |
|---|
| 110 | <owl:ObjectProperty rdf:ID="link_to_enzyme"> |
|---|
| 111 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 112 | <rdfs:comment>external link to enzyme code</rdfs:comment> |
|---|
| 113 | </owl:ObjectProperty> |
|---|
| 114 | |
|---|
| 115 | <owl:ObjectProperty rdf:ID="link_to_go"> |
|---|
| 116 | <rdfs:subPropertyOf rdf:resource="#link_to"/> |
|---|
| 117 | <rdfs:comment>external link to gene ontology</rdfs:comment> |
|---|
| 118 | </owl:ObjectProperty> |
|---|
| 119 | |
|---|
| 120 | <xsl:apply-templates/> |
|---|
| 121 | </rdf:RDF> |
|---|
| 122 | </xsl:template> |
|---|
| 123 | |
|---|
| 124 | <!-- schema root --> |
|---|
| 125 | <xsl:template match="xsd:schema"> |
|---|
| 126 | <xsl:call-template name="datablockType"/> |
|---|
| 127 | <xsl:apply-templates select="./xsd:complexType/xsd:sequence/*" mode="category_element"/> |
|---|
| 128 | </xsl:template> |
|---|
| 129 | |
|---|
| 130 | <!-- datablockType is special --> |
|---|
| 131 | <xsl:template name="datablockType"> |
|---|
| 132 | <owl:Class rdf:ID="datablock"> |
|---|
| 133 | <rdfs:label>datablock</rdfs:label> |
|---|
| 134 | <rdfs:comment>DATABLOCK class holds all categories of PDB data.</rdfs:comment> |
|---|
| 135 | <rdfs:subClassOf> |
|---|
| 136 | <owl:Class> |
|---|
| 137 | <owl:intersectionOf rdf:parseType="Collection"> |
|---|
| 138 | <xsl:for-each select="/xsd:schema/xsd:complexType[@name='datablockType']/xsd:all/*"> |
|---|
| 139 | <xsl:variable name="category"><xsl:value-of select="substring-before(@name,'Category')"/></xsl:variable> |
|---|
| 140 | <xsl:call-template name="hasCategory_restriction"> |
|---|
| 141 | <xsl:with-param name="category" select="$category"/> |
|---|
| 142 | </xsl:call-template> |
|---|
| 143 | </xsl:for-each> |
|---|
| 144 | </owl:intersectionOf> |
|---|
| 145 | </owl:Class> |
|---|
| 146 | </rdfs:subClassOf> |
|---|
| 147 | </owl:Class> |
|---|
| 148 | |
|---|
| 149 | <owl:DatatypeProperty rdf:ID="datablockName"> |
|---|
| 150 | <rdfs:domain rdf:resource="#datablock"/> |
|---|
| 151 | <rdfs:range rdf:resource="&xsd;string"/> |
|---|
| 152 | <xsl:apply-templates select="./xsd:annotation"/> |
|---|
| 153 | </owl:DatatypeProperty> |
|---|
| 154 | |
|---|
| 155 | <owl:InverseFunctionalProperty rdf:ID="hasCategoryElement"> |
|---|
| 156 | <rdfs:comment>Abstract property for xxxCategory.</rdfs:comment> |
|---|
| 157 | <rdfs:domain rdf:resource="#datablock"/> |
|---|
| 158 | <rdfs:range rdf:resource="#CategoryElement"/> |
|---|
| 159 | </owl:InverseFunctionalProperty> |
|---|
| 160 | </xsl:template> |
|---|
| 161 | |
|---|
| 162 | <xsl:template name="hasCategory_restriction"> |
|---|
| 163 | <xsl:param name="category"/> |
|---|
| 164 | <xsl:variable name="categoryType" select="/xsd:schema/xsd:complexType[@name=concat($category,'Type')]/xsd:sequence/xsd:element"/> |
|---|
| 165 | <owl:Restriction> |
|---|
| 166 | <owl:onProperty rdf:resource="#{$category}Category"/> |
|---|
| 167 | <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger"><xsl:value-of select="$categoryType/@minOccurs"/></owl:minCardinality> |
|---|
| 168 | </owl:Restriction> |
|---|
| 169 | <xsl:if test="$categoryType/@maxOccurs != 'unbounded'"> |
|---|
| 170 | <owl:Restriction> |
|---|
| 171 | <owl:onProperty rdf:resource="#{$category}Category"/> |
|---|
| 172 | <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger"><xsl:value-of select="$categoryType/@maxOccurs"/></owl:maxCardinality> |
|---|
| 173 | </owl:Restriction> |
|---|
| 174 | </xsl:if> |
|---|
| 175 | </xsl:template> |
|---|
| 176 | |
|---|
| 177 | <!-- basic category types --> |
|---|
| 178 | <xsl:template match="xsd:element" mode="category_element"> |
|---|
| 179 | <xsl:variable name="category"><xsl:value-of select="@name"/></xsl:variable> |
|---|
| 180 | <owl:Class rdf:ID="{@name}"> |
|---|
| 181 | <rdfs:label><xsl:value-of select="@name"/></rdfs:label> |
|---|
| 182 | <xsl:apply-templates select="../../xsd:annotation"/> |
|---|
| 183 | <rdfs:subClassOf> |
|---|
| 184 | <owl:Class> |
|---|
| 185 | <owl:intersectionOf rdf:parseType="Collection"> |
|---|
| 186 | <owl:Class rdf:about="#CategoryElement"/> |
|---|
| 187 | <xsl:for-each select="./xsd:complexType/xsd:all/*|./xsd:complexType/xsd:attribute"> |
|---|
| 188 | <xsl:call-template name="category_item_restriction"> |
|---|
| 189 | <xsl:with-param name="category" select="$category"/> |
|---|
| 190 | </xsl:call-template> |
|---|
| 191 | </xsl:for-each> |
|---|
| 192 | </owl:intersectionOf> |
|---|
| 193 | </owl:Class> |
|---|
| 194 | </rdfs:subClassOf> |
|---|
| 195 | </owl:Class> |
|---|
| 196 | |
|---|
| 197 | <owl:InverseFunctionalProperty rdf:ID="{@name}Category"> |
|---|
| 198 | <rdfs:label><xsl:value-of select="@name"/>Category</rdfs:label> |
|---|
| 199 | <rdfs:comment> |
|---|
| 200 | This property indicates that datablock |
|---|
| 201 | has a category element <xsl:value-of select="@name"/>. |
|---|
| 202 | </rdfs:comment> |
|---|
| 203 | <rdfs:subPropertyOf rdf:resource="#hasCategoryElement"/> |
|---|
| 204 | <rdfs:seeAlso rdf:resource="#{@name}"/> |
|---|
| 205 | <rdfs:range rdf:resource="#{@name}"/> |
|---|
| 206 | </owl:InverseFunctionalProperty> |
|---|
| 207 | |
|---|
| 208 | <owl:DatatypeProperty rdf:ID="{@name}Item"> |
|---|
| 209 | <rdfs:label><xsl:value-of select="@name"/>Item</rdfs:label> |
|---|
| 210 | <rdfs:comment>Abstract Datatype property for <xsl:value-of select="@name"/> items.</rdfs:comment> |
|---|
| 211 | <rdfs:subPropertyOf rdf:resource="#categoryItem"/> |
|---|
| 212 | <rdfs:domain rdf:resource="#{@name}"/> |
|---|
| 213 | </owl:DatatypeProperty> |
|---|
| 214 | |
|---|
| 215 | <owl:ObjectProperty rdf:ID="reference_to_{@name}"> |
|---|
| 216 | <rdfs:label>reference_to_<xsl:value-of select="@name"/></rdfs:label> |
|---|
| 217 | <rdfs:comment>cross-reference to <xsl:value-of select="@name"/></rdfs:comment> |
|---|
| 218 | <rdfs:subPropertyOf rdf:resource="#reference_to"/> |
|---|
| 219 | <rdfs:range rdf:resource="#{@name}"/> |
|---|
| 220 | </owl:ObjectProperty> |
|---|
| 221 | |
|---|
| 222 | <xsl:for-each select="./xsd:complexType/xsd:all/*|./xsd:complexType/xsd:attribute"> |
|---|
| 223 | <xsl:call-template name="category_item"> |
|---|
| 224 | <xsl:with-param name="category" select="$category"/> |
|---|
| 225 | </xsl:call-template> |
|---|
| 226 | </xsl:for-each> |
|---|
| 227 | </xsl:template> |
|---|
| 228 | |
|---|
| 229 | <xsl:template name="category_item_restriction"> |
|---|
| 230 | <xsl:param name="category"/> |
|---|
| 231 | <xsl:choose> |
|---|
| 232 | <xsl:when test="@use='required'"> |
|---|
| 233 | <owl:Restriction> |
|---|
| 234 | <owl:onProperty rdf:resource="#{$category}.{@name}"/> |
|---|
| 235 | <owl:cardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:cardinality> |
|---|
| 236 | </owl:Restriction> |
|---|
| 237 | </xsl:when> |
|---|
| 238 | <xsl:when test="@use='optional'"> |
|---|
| 239 | <owl:Restriction> |
|---|
| 240 | <owl:onProperty rdf:resource="#{$category}.{@name}"/> |
|---|
| 241 | <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger">0</owl:minCardinality> |
|---|
| 242 | </owl:Restriction> |
|---|
| 243 | <owl:Restriction> |
|---|
| 244 | <owl:onProperty rdf:resource="#{$category}.{@name}"/> |
|---|
| 245 | <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">1</owl:maxCardinality> |
|---|
| 246 | </owl:Restriction> |
|---|
| 247 | </xsl:when> |
|---|
| 248 | <xsl:otherwise> |
|---|
| 249 | <owl:Restriction> |
|---|
| 250 | <owl:onProperty rdf:resource="#{$category}.{@name}"/> |
|---|
| 251 | <owl:minCardinality rdf:datatype="&xsd;nonNegativeInteger"><xsl:value-of select="@minOccurs"/></owl:minCardinality> |
|---|
| 252 | </owl:Restriction> |
|---|
| 253 | <owl:Restriction> |
|---|
| 254 | <owl:onProperty rdf:resource="#{$category}.{@name}"/> |
|---|
| 255 | <owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger"><xsl:value-of select="@maxOccurs"/></owl:maxCardinality> |
|---|
| 256 | </owl:Restriction> |
|---|
| 257 | </xsl:otherwise> |
|---|
| 258 | </xsl:choose> |
|---|
| 259 | </xsl:template> |
|---|
| 260 | |
|---|
| 261 | <xsl:template name="category_item"> |
|---|
| 262 | <xsl:param name="category"/> |
|---|
| 263 | <xsl:choose> |
|---|
| 264 | <xsl:when test="count(.//xsd:enumeration) = 0"> |
|---|
| 265 | <!-- basic types --> |
|---|
| 266 | <xsl:variable name="datatype1"><xsl:value-of select="substring-after(@type,':')"/></xsl:variable> |
|---|
| 267 | <xsl:variable name="datatype2"><xsl:value-of select="substring-after(.//@base[1],':')"/></xsl:variable> |
|---|
| 268 | <owl:DatatypeProperty rdf:ID="{$category}.{@name}"> |
|---|
| 269 | <rdfs:subPropertyOf rdf:resource="#{$category}Item"/> |
|---|
| 270 | <rdfs:range rdf:resource="&xsd;{concat($datatype1,$datatype2)}"/> |
|---|
| 271 | <rdfs:label><xsl:value-of select="concat($category,'.',@name)"/></rdfs:label> |
|---|
| 272 | <xsl:apply-templates select="./xsd:annotation"/> |
|---|
| 273 | </owl:DatatypeProperty> |
|---|
| 274 | </xsl:when> |
|---|
| 275 | <xsl:otherwise> |
|---|
| 276 | <xsl:variable name="datatype"><xsl:value-of select="substring-after(.//@base[1],':')"/></xsl:variable> |
|---|
| 277 | <owl:DatatypeProperty rdf:ID="{$category}.{@name}"> |
|---|
| 278 | <rdfs:subPropertyOf rdf:resource="#{$category}Item"/> |
|---|
| 279 | <rdfs:domain rdf:resource="#{$category}"/> |
|---|
| 280 | <rdfs:range> |
|---|
| 281 | <owl:DataRange> |
|---|
| 282 | <owl:oneOf> |
|---|
| 283 | <xsl:call-template name="enumeration"> |
|---|
| 284 | <xsl:with-param name="elm" select=".//xsd:enumeration[1]"/> |
|---|
| 285 | <xsl:with-param name="t" select="$datatype"/> |
|---|
| 286 | </xsl:call-template> |
|---|
| 287 | </owl:oneOf> |
|---|
| 288 | </owl:DataRange> |
|---|
| 289 | </rdfs:range> |
|---|
| 290 | <xsl:apply-templates select="./xsd:annotation"/> |
|---|
| 291 | </owl:DatatypeProperty> |
|---|
| 292 | </xsl:otherwise> |
|---|
| 293 | </xsl:choose> |
|---|
| 294 | </xsl:template> |
|---|
| 295 | |
|---|
| 296 | <xsl:template name="enumeration"> |
|---|
| 297 | <xsl:param name="elm"/> |
|---|
| 298 | <xsl:param name="t"/> |
|---|
| 299 | <rdf:List> |
|---|
| 300 | <rdf:first rdf:datatype="&xsd;{$t}"><xsl:value-of select="$elm/@value"/></rdf:first> |
|---|
| 301 | <xsl:choose> |
|---|
| 302 | <xsl:when test="count($elm/following-sibling::node()) = 0"> |
|---|
| 303 | <rdf:rest rdf:resource="&rdf;nil"/> |
|---|
| 304 | </xsl:when> |
|---|
| 305 | <xsl:otherwise> |
|---|
| 306 | <rdf:rest> |
|---|
| 307 | <xsl:call-template name="enumeration"> |
|---|
| 308 | <xsl:with-param name="elm" |
|---|
| 309 | select="$elm/following-sibling::node()[1]"/> |
|---|
| 310 | <xsl:with-param name="t" select="$t"/> |
|---|
| 311 | </xsl:call-template> |
|---|
| 312 | </rdf:rest> |
|---|
| 313 | </xsl:otherwise> |
|---|
| 314 | </xsl:choose> |
|---|
| 315 | </rdf:List> |
|---|
| 316 | </xsl:template> |
|---|
| 317 | |
|---|
| 318 | <!-- annotation of categories and items --> |
|---|
| 319 | <xsl:template match="xsd:annotation"> |
|---|
| 320 | <rdfs:comment> |
|---|
| 321 | <xsl:value-of select="./xsd:documentation"/> |
|---|
| 322 | </rdfs:comment> |
|---|
| 323 | </xsl:template> |
|---|
| 324 | |
|---|
| 325 | <xsl:template match="text()|*|@*"/> |
|---|
| 326 | <xsl:template match="text()|*|@*" mode="annotation"/> |
|---|
| 327 | |
|---|
| 328 | </xsl:stylesheet> |
|---|