]> matita.cs.unibo.it Git - helm.git/blob - helm/style/mk_meta_graph.xsl
First set of hard-coded URLs removed.
[helm.git] / helm / style / mk_meta_graph.xsl
1 <?xml version="1.0"?>
2
3 <!-- Copyright (C) 2000, HELM Team                                     -->
4 <!--                                                                   -->
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.                         -->
8 <!--                                                                   -->
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.            -->
13 <!--                                                                   -->
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.                      -->
18 <!--                                                                   -->
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.                                              -->
23 <!--                                                                   -->
24 <!-- For details, see the HELM World-Wide-Web page,                    -->
25 <!-- http://cs.unibo.it/helm/.                                         -->
26
27 <!-- CSC: Sostituire l'andata a capo con la entity numerica opportuna -->
28 <!DOCTYPE html [
29  <!ENTITY CSCbr "
30 ">
31 ]>
32
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">
35
36 <xsl:output method="text"/>
37
38 <xsl:param name="CICURI" select="''"/>
39 <xsl:param name="PID" select="''"/>
40 <xsl:param name="getterURL" select="''"/>
41 <xsl:variable name="RDF_base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/rdfprova//')"/>
42
43 <!-- CSC: next function because I don't remember the name of the    -->
44 <!-- CSC: subst function of xslt and I don't have the specs with me -->
45 <xsl:template name="quote">
46  <xsl:param name="s" select="''"/>
47  <xsl:param name="news" select="''"/>
48  <xsl:choose>
49   <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
50   <xsl:otherwise>
51    <xsl:variable name="char" select="substring($s,1,1)"/>
52    <xsl:choose>
53     <xsl:when test="$char = '/'">
54      <xsl:call-template name="quote">
55       <xsl:with-param name="s" select="substring($s,2)"/>
56       <xsl:with-param name="news" select="concat($news,'X')"/>
57      </xsl:call-template>
58     </xsl:when>
59     <xsl:when test="$char = ':'">
60      <xsl:call-template name="quote">
61       <xsl:with-param name="s" select="substring($s,2)"/>
62       <xsl:with-param name="news" select="concat($news,'Y')"/>
63      </xsl:call-template>
64     </xsl:when>
65     <xsl:when test="$char = '.'">
66      <xsl:call-template name="quote">
67       <xsl:with-param name="s" select="substring($s,2)"/>
68       <xsl:with-param name="news" select="concat($news,'Z')"/>
69      </xsl:call-template>
70     </xsl:when>
71     <xsl:when test='$char = "&apos;"'>
72      <xsl:call-template name="quote">
73       <xsl:with-param name="s" select="substring($s,2)"/>
74       <xsl:with-param name="news" select="concat($news,'W')"/>
75      </xsl:call-template>
76     </xsl:when>
77     <xsl:when test="$char = '-'">
78      <xsl:call-template name="quote">
79       <xsl:with-param name="s" select="substring($s,2)"/>
80       <xsl:with-param name="news" select="concat($news,'J')"/>
81      </xsl:call-template>
82     </xsl:when>
83     <xsl:when test="$char = '#'">
84      <xsl:call-template name="quote">
85       <xsl:with-param name="s" select="substring($s,2)"/>
86       <xsl:with-param name="news" select="concat($news,'S')"/>
87      </xsl:call-template>
88     </xsl:when>
89     <xsl:when test="$char = '('">
90      <xsl:call-template name="quote">
91       <xsl:with-param name="s" select="substring($s,2)"/>
92       <xsl:with-param name="news" select="concat($news,'P1')"/>
93      </xsl:call-template>
94     </xsl:when>
95     <xsl:when test="$char = ')'">
96      <xsl:call-template name="quote">
97       <xsl:with-param name="s" select="substring($s,2)"/>
98       <xsl:with-param name="news" select="concat($news,'P2')"/>
99      </xsl:call-template>
100     </xsl:when>
101     <xsl:otherwise>
102      <xsl:call-template name="quote">
103       <xsl:with-param name="s" select="substring($s,2)"/>
104       <xsl:with-param name="news" select="concat($news,$char)"/>
105      </xsl:call-template>
106     </xsl:otherwise>
107    </xsl:choose>
108   </xsl:otherwise>
109  </xsl:choose>
110 </xsl:template>
111
112 <xsl:template match="/">
113  <!-- draw_graph_url -->
114  <xsl:text>http://phd.cs.unibo.it:8083&CSCbr;</xsl:text>
115  <!-- dep_url_scheme -->
116  <xsl:text>http://phd.cs.unibo.it:8083/draw?url=http%3A//phd.cs.unibo.it%3A8080/helm/servlet/uwobo/apply%3Fxmluri%3Dhttp%3A//phd.cs.unibo.it%3A8081/getxml%253Furi%253D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>%26keys%3DMDG%26param.getterURL%3Dhttp%253A//phd.cs.unibo.it%253A8081/%26prop.media-type%3Dtext/plain%26param.CICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>&CSCbr;</xsl:text>
117  <!-- meta_url_scheme -->
118  <xsl:text>http://phd.cs.unibo.it:8083/draw?url=http%3A%2F%2Fphd.cs.unibo.it%3A8080%2Fhelm%2Fservlet%2Fuwobo%2Fapply%3Fxmluri%3Dhttp%3A%2F%2Fphd.cs.unibo.it%3A8081%2Fgetxml%253Furi%253Dhelm%3Ardf%3Awww%2Ecs%2Eunibo.it/helm/rdf/rdfprova//</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>%26keys%3DMMG%26param.getterURL%3Dhttp%253A//phd.cs.unibo.it%253A8081/%26prop.media-type%3Dtext/plain%26param.CICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>%26keys%3DMMG%26param%2EgetterURL%3Dhttp%253A%2F%2Fphd.cs.unibo.it%253A8081%2F%26prop%2Emedia%2Dtype%3Dtext%2Fplain%26param%2ECICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>&CSCbr;</xsl:text>
119  <!-- cic_url_scheme -->
120  <xsl:text>file:///projects/helm/on-line/html/cic/index.html?url=http://phd.cs.unibo.it:8080/helm/servlet/uwobo/apply%3Fkeys%3DC1%252CHC2%252CL%26prop.media-type%3Dtext/html%26prop.encoding%3Diso-8859-1%26param.naturalLanguage%3Dyes%26param.UNICODEvsSYMBOL%3Dsymbol%26param.annotations%3DNO%26prop.doctype-public%3D-//W3C//DTD%2520XHTML%25201.0%2520Transitional//EN%26param.doctype-public%3D-//W3C//DTD%2520XHTML%25201.0%2520Transitional//EN%26param.encoding%3Diso-8859-1%26param.media-type%3Dtext/html%26param.keys%3DC1%252CHC2%252CL%26param.getterURL%3Dhttp://phd.cs.unibo.it:8081/%26param.processorURL%3Dhttp://phd.cs.unibo.it:8080/helm/servlet/uwobo/%26param.interfaceURL%3Dfile:///projects/helm/on-line/html/cic/index.html%26param.topurl%3Dfile:///projects/helm/on-line%26xmluri%3Dhttp://phd.cs.unibo.it:8081/getxml%253Furi%253D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>%26param.CICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>&CSCbr;</xsl:text>
121  <!--
122  <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
123  -->
124  <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
125  <!-- The nonce is used to force the document reload -->
126  <xsl:variable name="dummy1" select="document(concat('http://phd.cs.unibo.it:8084/add_if_not_in?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
127  <xsl:apply-templates mode="loop" select="document(concat('http://phd.cs.unibo.it:8084/get_next?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
128  <xsl:variable name="dummy2" select="document(concat('http://phd.cs.unibo.it:8084/reset_to_empty?PID=',$PID))"/>
129  <xsl:text>}</xsl:text>
130 </xsl:template>
131
132 <xsl:template mode="loop" match="empty"/>
133
134 <xsl:template mode="loop" match="uri|marked_uri">
135  <xsl:variable name="document" select="document(concat($RDF_base_URL_of_CIC_URI,@value))"/>
136  <xsl:choose>
137   <xsl:when test="$document/*">
138    <xsl:apply-templates mode="first_time" select="$document/*">
139     <xsl:with-param name="currentCICURI" select="@value"/>
140     <xsl:with-param name="quotedCurrentCICURI">
141      <xsl:call-template name="quote">
142       <xsl:with-param name="s" select="@value"/>
143      </xsl:call-template>
144     </xsl:with-param>
145     <xsl:with-param name="do_not_visit" select="name(.)"/>
146    </xsl:apply-templates>
147   </xsl:when>
148   <xsl:otherwise>
149    <xsl:apply-templates mode="first_time" select=".">
150     <xsl:with-param name="currentCICURI" select="@value"/>
151     <xsl:with-param name="quotedCurrentCICURI">
152      <xsl:call-template name="quote">
153       <xsl:with-param name="s" select="@value"/>
154      </xsl:call-template>
155     </xsl:with-param>
156     <xsl:with-param name="do_not_visit" select="'no_deps'"/>
157    </xsl:apply-templates>
158   </xsl:otherwise>
159  </xsl:choose>
160  <!-- The couple (uri,nonce) is used to force the document reload -->
161  <xsl:apply-templates mode="loop" select="document(concat('http://phd.cs.unibo.it:8084/get_next?uri=',@value,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
162 </xsl:template>
163
164
165 <xsl:template mode="first_time" match="*">
166  <xsl:param name="currentCICURI" select="''"/>
167  <xsl:param name="quotedCurrentCICURI" select="''"/>
168  <xsl:param name="do_not_visit" select="'uri'"/>
169  <xsl:text> </xsl:text>
170  <xsl:value-of select="$quotedCurrentCICURI"/>
171 <!-- <xsl:text> [fontname="LucidaSansRegular",color=red,label="</xsl:text> -->
172  <xsl:text> [label="</xsl:text>
173  <xsl:value-of select="$currentCICURI"/>
174  <xsl:text>",URL="</xsl:text>
175  <xsl:value-of select="$currentCICURI"/>
176  <xsl:text>"</xsl:text>
177  <xsl:if test="$do_not_visit='marked_uri'">
178   <xsl:text>,color=red</xsl:text>
179  </xsl:if>
180  <xsl:text>];&CSCbr;</xsl:text>
181  <xsl:if test="$do_not_visit='uri'">
182   <xsl:apply-templates select=".">
183    <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
184    <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
185   </xsl:apply-templates>
186  </xsl:if>
187 </xsl:template>
188
189 <xsl:template match="occurs">
190  <xsl:param name="currentCICURI" select="''"/>
191  <xsl:param name="quotedCurrentCICURI" select="''"/>
192  <xsl:for-each select="*">
193   <xsl:variable name="quotedURI">
194    <xsl:call-template name="quote">
195     <xsl:with-param name="s" select="@uri"/>
196    </xsl:call-template>
197   </xsl:variable>
198   <xsl:text> </xsl:text>
199   <xsl:value-of select="$quotedCurrentCICURI"/>
200   <xsl:text> -&gt; </xsl:text>
201   <xsl:value-of select="$quotedURI"/>
202   <xsl:text>;&CSCbr;</xsl:text>
203   <!-- The nonce is used to force the document reload -->
204   <xsl:variable name="dummy" select="document(concat('http://phd.cs.unibo.it:8084/add_if_not_in?uri=',@uri,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
205  </xsl:for-each>
206 </xsl:template>
207
208 </xsl:stylesheet>