3 SPDX-FileCopyrightText: 2024 Lady <https://www.ladys.computer/about/#lady>
4 SPDX-License-Identifier: MPL-2.0
7 © 2024 Lady [@ Ladys Computer].
9 This Source Code Form is subject to the terms of the Mozilla Public License, v 2.0.
10 If a copy of the M·P·L was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
13 xmlns="http://www.w3.org/1999/XSL/Transform"
14 xmlns:Vocab="urn:fdc:vocab.ladys.computer:20240731:ns"
15 xmlns:Vocabvocab="urn:fdc:vocab.ladys.computer:20240731:vocab:"
16 xmlns:html="http://www.w3.org/1999/xhtml"
17 xmlns:owl="http://www.w3.org/2002/07/owl#"
18 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
19 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
20 xmlns:shacl="http://www.w3.org/ns/shacl#"
21 xmlns:书社="urn:fdc:ladys.computer:20231231:Shu1She4"
22 exclude-result-prefixes="Vocab Vocabvocab"
25 <书社:id>urn:fdc:vocab.ladys.computer:20240731:transforms:data:rdf.xslt</书社:id>
26 <key name="Vocab:name" match="owl:AnnotationProperty|owl:Class|owl:DatatypeProperty|owl:NamedIndividual|owl:ObjectProperty|rdfs:Datatype" use="@rdf:about|owl:sameAs/@rdf:resource"/>
27 <template name="Vocab:base">
28 <value-of select="//rdf:RDF//owl:Ontology/shacl:declare/shacl:namespace[preceding-sibling::shacl:prefix='']"/>
30 <template name="Vocab:prefix">
31 <param name="unprefixed" select="''"/>
32 <variable name="namespace" select="//rdf:RDF//owl:Ontology/shacl:declare/shacl:namespace[starts-with($unprefixed, string()) and string(preceding-sibling::shacl:prefix)!=''][1]"/>
34 <when test="not($namespace)">
35 <value-of select="$unprefixed"/>
38 <value-of select="$namespace/preceding-sibling::shacl:prefix"/>
40 <value-of select="substring-after($unprefixed, $namespace)"/>
44 <template match="rdf:RDF/*[@rdf:about and Vocabvocab:superClassOf]" priority="2">
46 <apply-templates select="@*|node()[not(self::Vocabvocab:superClassOf)]"/>
48 <for-each select="Vocabvocab:superClassOf/*[1]">
50 <apply-templates select="@*|node()"/>
51 <element name="rdfs:subClassOf">
52 <attribute name="rdf:resource">
53 <value-of select="../../@rdf:about"/>
59 <template match="@rdf:resource" priority="2">
60 <variable name="base-iri">
61 <call-template name="Vocab:base"/>
63 <attribute name="rdf:resource">
65 <when test="starts-with(., 'about:vocab?') and contains(., '=')">
66 <variable name="query" select="substring-after(., 'about:vocab?')"/>
67 <variable name="qterm" select="substring-before($query, '=')"/>
68 <variable name="subdir">
70 <when test="$qterm='class'">
73 <when test="$qterm='property'">
74 <text>properties/</text>
77 <text>individuals/</text>
81 <variable name="match" select="//*[rdfs:isDefinedBy[starts-with(@rdf:resource, $base-iri) and substring-after(@rdf:resource, $base-iri)=concat($subdir, substring-after($query, '='), '.xhtml')]]"/>
84 <value-of select="$match/@rdf:about"/>
87 <value-of select="."/>
92 <value-of select="."/>
97 <template match="html:a" priority="1">
98 <variable name="base-prefix">
99 <call-template name="Vocab:prefix">
100 <with-param name="unprefixed">
101 <call-template name="Vocab:base"/>
105 <variable name="kind" select="@data-kind"/>
106 <variable name="linked-resource" select="key('Vocab:name', @href)[not($kind) or $kind='class' and (self::owl:Class or self::owl:Datatype) or $kind='property' and (self::owl:AnnotationProperty or self::owl:ObjectProperty or self::owl:DatatypeProperty) or $kind='individual' and self::owl:NamedIndividual][1]"/>
108 <apply-templates select="@*[not(contains(' data-curie data-kind ', local-name()) and namespace-uri()='')]"/>
110 <when test="$linked-resource">
111 <variable name="curie">
112 <call-template name="Vocab:prefix">
113 <with-param name="unprefixed" select="string(@href)"/>
116 <variable name="localid">
118 <when test="starts-with($curie, $base-prefix)">
119 <value-of select="substring-after($curie, $base-prefix)"/>
122 <value-of select="$curie"/>
126 <attribute name="data-curie">
127 <value-of select="$curie"/>
129 <attribute name="data-kind">
131 <when test="@data-kind">
132 <value-of select="@data-kind"/>
134 <when test="$linked-resource[self::owl:Class or self::owl:Datatype]">
137 <when test="$linked-resource[self::owl:AnnotationProperty or self::owl:ObjectProperty or self::owl:DatatypeProperty]">
138 <text>property</text>
141 <text>individual</text>
146 <when test="html:code[not(preceding-sibling::node() or following-sibling::node())]">
147 <for-each select="$linked-resource">
148 <variable name="wrappername">
150 <when test="substring($localid, 1, 1)='(' and substring($localid, string-length($localid), 1)=')'">
158 <attribute name="title">
159 <value-of select="rdfs:label[1]"/>
161 <value-of select="$curie"/>
164 <element name="html:{$wrappername}">
165 <attribute name="lang">
166 <value-of select="rdfs:label[1]/@xml:lang"/>
168 <attribute name="xml:lang">
169 <value-of select="rdfs:label[1]/@xml:lang"/>
171 <value-of select="rdfs:label[1]"/>
186 <template match="html:a/@href[starts-with(., '#footnote-')]">
187 <attribute name="href">
188 <text>#footnote-</text>
189 <value-of select="generate-id(ancestor::rdfs:comment//@id[string()=substring-after(current(), '#')])"/>
192 <template match="html:*/@id[starts-with(., 'footnote-')]" priority="1">
193 <attribute name="id">
194 <text>footnote-</text>
195 <value-of select="generate-id()"/>