3 <!-- Copyright (C) 2000, HELM Team -->
5 <!-- This file is part of HELM, an Hypertextual, Electronic -->
6 <!-- Library of Mathematics, developed at the Computer Science -->
7 <!-- Department, University of Bologna, Italy. -->
9 <!-- HELM is free software; you can redistribute it and/or -->
10 <!-- modify it under the terms of the GNU General Public License -->
11 <!-- as published by the Free Software Foundation; either version 2 -->
12 <!-- of the License, or (at your option) any later version. -->
14 <!-- HELM is distributed in the hope that it will be useful, -->
15 <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
16 <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
17 <!-- GNU General Public License for more details. -->
19 <!-- You should have received a copy of the GNU General Public License -->
20 <!-- along with HELM; if not, write to the Free Software -->
21 <!-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, -->
22 <!-- MA 02111-1307, USA. -->
24 <!-- For details, see the HELM World-Wide-Web page, -->
25 <!-- http://cs.unibo.it/helm/. -->
27 <!-- CSC: Sostituire l'andata a capo con la entity numerica opportuna -->
33 <xsl:stylesheet version="0.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
34 xmlns:ht="http://www.cs.unibo.it/helm/namespaces/helm-theory">
36 <xsl:output method="text"/>
38 <xsl:param name="CICURI" select="''"/>
39 <xsl:param name="PID" select="''"/>
40 <xsl:param name="getterURL" select="''"/>
41 <xsl:param name="uri_set_queueURL" select="'http://localhost:8084/'"/>
42 <xsl:param name="uri_set_size" select="30"/>
43 <xsl:variable name="RDF_base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/rdfprova//')"/>
45 <!-- CSC: next functions because I don't remember the name of the -->
46 <!-- CSC: subst function of xslt and I don't have the specs with me -->
48 <!-- The next function is used to quote URIs for dotty -->
49 <xsl:template name="quote">
50 <xsl:param name="s" select="''"/>
51 <xsl:param name="news" select="''"/>
53 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
55 <xsl:variable name="char" select="substring($s,1,1)"/>
57 <xsl:when test="$char = '/'">
58 <xsl:call-template name="quote">
59 <xsl:with-param name="s" select="substring($s,2)"/>
60 <xsl:with-param name="news" select="concat($news,'X')"/>
63 <xsl:when test="$char = ':'">
64 <xsl:call-template name="quote">
65 <xsl:with-param name="s" select="substring($s,2)"/>
66 <xsl:with-param name="news" select="concat($news,'Y')"/>
69 <xsl:when test="$char = '.'">
70 <xsl:call-template name="quote">
71 <xsl:with-param name="s" select="substring($s,2)"/>
72 <xsl:with-param name="news" select="concat($news,'Z')"/>
75 <xsl:when test='$char = "'"'>
76 <xsl:call-template name="quote">
77 <xsl:with-param name="s" select="substring($s,2)"/>
78 <xsl:with-param name="news" select="concat($news,'W')"/>
81 <xsl:when test="$char = '-'">
82 <xsl:call-template name="quote">
83 <xsl:with-param name="s" select="substring($s,2)"/>
84 <xsl:with-param name="news" select="concat($news,'J')"/>
87 <xsl:when test="$char = '#'">
88 <xsl:call-template name="quote">
89 <xsl:with-param name="s" select="substring($s,2)"/>
90 <xsl:with-param name="news" select="concat($news,'G')"/>
93 <xsl:when test="$char = '('">
94 <xsl:call-template name="quote">
95 <xsl:with-param name="s" select="substring($s,2)"/>
96 <xsl:with-param name="news" select="concat($news,'O')"/>
99 <xsl:when test="$char = ')'">
100 <xsl:call-template name="quote">
101 <xsl:with-param name="s" select="substring($s,2)"/>
102 <xsl:with-param name="news" select="concat($news,'C')"/>
106 <xsl:call-template name="quote">
107 <xsl:with-param name="s" select="substring($s,2)"/>
108 <xsl:with-param name="news" select="concat($news,$char)"/>
116 <!-- The next function is used to quote URIs to embed them in an URL -->
117 <xsl:template name="quote_url">
118 <xsl:param name="s" select="''"/>
119 <xsl:param name="news" select="''"/>
121 <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
123 <xsl:variable name="char" select="substring($s,1,1)"/>
125 <xsl:when test="$char = '#'">
126 <xsl:call-template name="quote_url">
127 <xsl:with-param name="s" select="substring($s,2)"/>
128 <xsl:with-param name="news" select="concat($news,'%23')"/>
132 <xsl:call-template name="quote_url">
133 <xsl:with-param name="s" select="substring($s,2)"/>
134 <xsl:with-param name="news" select="concat($news,$char)"/>
142 <xsl:template match="/">
144 <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
146 <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
147 <xsl:variable name="quoted_CICURI">
148 <xsl:call-template name="quote_url">
149 <xsl:with-param name="s" select="$CICURI"/>
152 <!-- The nonce is used to force the document reload -->
153 <xsl:variable name="dummy0" select="document(concat($uri_set_queueURL,'set_uri_set_size?uri=',$CICURI,'&nonce=',generate-id(),'&PID=',$PID,'&size=',$uri_set_size))"/>
154 <xsl:variable name="dummy1" select="document(concat($uri_set_queueURL,'add_if_not_in?uri=',$quoted_CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
155 <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',$quoted_CICURI,'&nonce=',generate-id(),'&PID=',$PID))"/>
156 <xsl:variable name="dummy2" select="document(concat($uri_set_queueURL,'reset_to_empty?PID=',$PID))"/>
157 <xsl:text>}</xsl:text>
160 <xsl:template mode="loop" match="empty"/>
162 <xsl:template mode="loop" match="uri|marked_uri">
163 <xsl:variable name="document" select="document(concat($RDF_base_URL_of_CIC_URI,@value))"/>
165 <xsl:when test="$document/*">
166 <xsl:apply-templates mode="first_time" select="$document/*">
167 <xsl:with-param name="currentCICURI" select="@value"/>
168 <xsl:with-param name="quotedCurrentCICURI">
169 <xsl:call-template name="quote">
170 <xsl:with-param name="s" select="@value"/>
173 <xsl:with-param name="do_not_visit" select="name(.)"/>
174 </xsl:apply-templates>
177 <xsl:apply-templates mode="first_time" select=".">
178 <xsl:with-param name="currentCICURI" select="@value"/>
179 <xsl:with-param name="quotedCurrentCICURI">
180 <xsl:call-template name="quote">
181 <xsl:with-param name="s" select="@value"/>
184 <xsl:with-param name="do_not_visit" select="'no_deps'"/>
185 </xsl:apply-templates>
188 <xsl:variable name="quoted_value">
189 <xsl:call-template name="quote_url">
190 <xsl:with-param name="s" select="@value"/>
193 <!-- The couple (uri,nonce) is used to force the document reload -->
194 <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',$quoted_value,'&nonce=',generate-id(),'&PID=',$PID))"/>
198 <xsl:template mode="first_time" match="*">
199 <xsl:param name="currentCICURI" select="''"/>
200 <xsl:param name="quotedCurrentCICURI" select="''"/>
201 <xsl:param name="do_not_visit" select="'uri'"/>
202 <xsl:if test="$do_not_visit='uri'">
203 <xsl:apply-templates select=".">
204 <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
205 <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
206 </xsl:apply-templates>
208 <xsl:text> </xsl:text>
209 <xsl:value-of select="$quotedCurrentCICURI"/>
210 <!-- <xsl:text> [fontname="LucidaSansRegular",color=red,label="</xsl:text> -->
211 <xsl:text> [label="</xsl:text>
212 <xsl:value-of select="$currentCICURI"/>
213 <xsl:text>",URL="</xsl:text>
214 <xsl:value-of select="$currentCICURI"/>
215 <xsl:text>"</xsl:text>
216 <xsl:if test="name(document(concat($uri_set_queueURL,'is_overflowed?uri=',$quotedCurrentCICURI,'&nonce=',generate-id(),'&PID=',$PID))/*)='true'">
217 <xsl:text>,color=red</xsl:text>
219 <xsl:text>];&CSCbr;</xsl:text>
222 <xsl:template match="occurs">
223 <xsl:param name="currentCICURI" select="''"/>
224 <xsl:param name="quotedCurrentCICURI" select="''"/>
225 <xsl:for-each select="*">
226 <xsl:variable name="quotedURI">
227 <xsl:call-template name="quote">
228 <xsl:with-param name="s" select="@uri"/>
231 <xsl:variable name="quoted_uri">
232 <xsl:call-template name="quote_url">
233 <xsl:with-param name="s" select="@uri"/>
236 <!-- The nonce, quotedCurrentCICURI are used to force the document reload -->
237 <xsl:if test="not(name(document(concat($uri_set_queueURL,'add_if_not_in?uri=',$quoted_uri,'&nonce=',generate-id(),'&PID=',$PID,'&quotedCurrentCICURI=',$quotedCurrentCICURI))/*)='not_added_because_already_too_many')">
238 <xsl:text> </xsl:text>
239 <xsl:value-of select="$quotedCurrentCICURI"/>
240 <xsl:text> -> </xsl:text>
241 <xsl:value-of select="$quotedURI"/>
242 <xsl:text>;&CSCbr;</xsl:text>