]> matita.cs.unibo.it Git - helm.git/blob - helm/style/mk_dep_graph.xsl
First implementation of graphs stuff. Working on my notebook,
[helm.git] / helm / style / mk_dep_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="maxDepth" select="4"/>
41 <xsl:param name="getterURL" select="''"/>
42 <xsl:variable name="base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=')"/>
43
44 <!-- CSC: next function because I don't remember the name of the    -->
45 <!-- CSC: subst function of xslt and I don't have the specs with me -->
46 <xsl:template name="quote">
47  <xsl:param name="s" select="''"/>
48  <xsl:param name="news" select="''"/>
49  <xsl:choose>
50   <xsl:when test="$s = ''"><xsl:value-of select="$news"/></xsl:when>
51   <xsl:otherwise>
52    <xsl:variable name="char" select="substring($s,1,1)"/>
53    <xsl:choose>
54     <xsl:when test="$char = '/'">
55      <xsl:call-template name="quote">
56       <xsl:with-param name="s" select="substring($s,2)"/>
57       <xsl:with-param name="news" select="concat($news,'X')"/>
58      </xsl:call-template>
59     </xsl:when>
60     <xsl:when test="$char = ':'">
61      <xsl:call-template name="quote">
62       <xsl:with-param name="s" select="substring($s,2)"/>
63       <xsl:with-param name="news" select="concat($news,'Y')"/>
64      </xsl:call-template>
65     </xsl:when>
66     <xsl:when test="$char = '.'">
67      <xsl:call-template name="quote">
68       <xsl:with-param name="s" select="substring($s,2)"/>
69       <xsl:with-param name="news" select="concat($news,'Z')"/>
70      </xsl:call-template>
71     </xsl:when>
72     <xsl:when test='$char = "&apos;"'>
73      <xsl:call-template name="quote">
74       <xsl:with-param name="s" select="substring($s,2)"/>
75       <xsl:with-param name="news" select="concat($news,'W')"/>
76      </xsl:call-template>
77     </xsl:when>
78     <xsl:when test="$char = '-'">
79      <xsl:call-template name="quote">
80       <xsl:with-param name="s" select="substring($s,2)"/>
81       <xsl:with-param name="news" select="concat($news,'J')"/>
82      </xsl:call-template>
83     </xsl:when>
84     <xsl:otherwise>
85      <xsl:call-template name="quote">
86       <xsl:with-param name="s" select="substring($s,2)"/>
87       <xsl:with-param name="news" select="concat($news,$char)"/>
88      </xsl:call-template>
89     </xsl:otherwise>
90    </xsl:choose>
91   </xsl:otherwise>
92  </xsl:choose>
93 </xsl:template>
94
95 <xsl:template match="/">
96  <!-- dep_url_scheme -->
97  <xsl:text>http://localhost:8083/draw?url=http%3A//localhost%3A8080/helm/servlet/uwobo/apply%3Fxmluri%3Dhttp%3A//localhost%3A8081/getxml%253Furi%253D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>%26keys%3DMDG%26param.getterURL%3Dhttp%253A//localhost%253A8081/%26prop.media-type%3Dtext/plain%26param.CICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>&CSCbr;</xsl:text>
98  <!-- meta_url_scheme -->
99  <xsl:text>http://localhost:8083/draw?url=http%3A%2F%2Flocalhost%3A8080%2Fhelm%2Fservlet%2Fuwobo%2Fapply%3Fxmluri%3Dhttp%3A%2F%2Flocalhost%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//localhost%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%2Flocalhost%253A8081%2F%26prop%2Emedia%2Dtype%3Dtext%2Fplain%26param%2ECICURI%3D</xsl:text><xsl:value-of select="'#uri#'"/><xsl:text>&CSCbr;</xsl:text>
100  <!-- cic_url_scheme -->
101  <xsl:text>file:///projects/helm/on-line/html/cic/index.html?url=http://localhost: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://localhost:8081/%26param.processorURL%3Dhttp://localhost:8080/helm/servlet/uwobo/%26param.interfaceURL%3Dfile:///projects/helm/on-line/html/cic/index.html%26param.topurl%3Dfile:///projects/helm/on-line%26xmluri%3Dhttp://localhost: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>
102  <!--
103  <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
104  -->
105  <xsl:text>strict digraph L0 { size = "83,83"; node [style=filled, shape = box];&CSCbr;</xsl:text>
106  <!-- The nonce is used to force the document reload -->
107  <xsl:variable name="dummy1" select="document(concat('http://localhost:8084/add_if_not_in?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
108  <xsl:apply-templates mode="loop" select="document(concat('http://localhost:8084/get_next?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
109  <xsl:variable name="dummy2" select="document(concat('http://localhost:8084/reset_to_empty?PID=',$PID))"/>
110  <xsl:text>}</xsl:text>
111 </xsl:template>
112
113 <xsl:template mode="loop" match="empty"/>
114
115 <xsl:template mode="loop" match="uri|marked_uri">
116  <xsl:apply-templates mode="first_time" select="document(concat($base_URL_of_CIC_URI,@value))/*">
117   <xsl:with-param name="currentCICURI" select="@value"/>
118   <xsl:with-param name="quotedCurrentCICURI">
119    <xsl:call-template name="quote">
120     <xsl:with-param name="s" select="@value"/>
121    </xsl:call-template>
122   </xsl:with-param>
123   <xsl:with-param name="do_not_visit" select="name(.)"/>
124  </xsl:apply-templates>
125  <!-- The couple (uri,nonce) is used to force the document reload -->
126  <xsl:apply-templates mode="loop" select="document(concat('http://localhost:8084/get_next?uri=',@value,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
127 </xsl:template>
128
129 <xsl:template mode="first_time" match="*">
130  <xsl:param name="currentCICURI" select="''"/>
131  <xsl:param name="quotedCurrentCICURI" select="''"/>
132  <xsl:param name="do_not_visit" select="'uri'"/>
133  <xsl:text> </xsl:text>
134  <xsl:value-of select="$quotedCurrentCICURI"/>
135 <!-- <xsl:text> [fontname="LucidaSansRegular",color=red,label="</xsl:text> -->
136  <xsl:text> [label="</xsl:text>
137  <xsl:value-of select="$currentCICURI"/>
138  <xsl:text>",URL="</xsl:text>
139  <xsl:value-of select="$currentCICURI"/>
140  <xsl:text>"</xsl:text>
141  <xsl:if test="$do_not_visit='marked_uri'">
142   <xsl:text>,color=red</xsl:text>
143  </xsl:if>
144  <xsl:text>];&CSCbr;</xsl:text>
145  <xsl:if test="$do_not_visit='uri'">
146   <xsl:apply-templates select=".">
147    <xsl:with-param name="maxDepth" select="$newMaxDepth"/>
148    <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
149    <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
150   </xsl:apply-templates>
151  </xsl:if>
152 </xsl:template>
153
154 <!-- CSC: uriType missing!!! -->
155 <xsl:template match="*">
156  <xsl:param name="currentCICURI" select="''"/>
157  <xsl:param name="quotedCurrentCICURI" select="''"/>
158  <xsl:if test="@uri">
159   <xsl:variable name="quotedURI">
160    <xsl:call-template name="quote">
161     <xsl:with-param name="s" select="@uri"/>
162    </xsl:call-template>
163   </xsl:variable>
164   <xsl:text> </xsl:text>
165   <xsl:value-of select="$quotedCurrentCICURI"/>
166   <xsl:text> -&gt; </xsl:text>
167   <xsl:value-of select="$quotedURI"/>
168   <xsl:text>;&CSCbr;</xsl:text>
169   <!-- The nonce is used to force the document reload -->
170   <xsl:variable name="dummy" select="document(concat('http://localhost:8084/add_if_not_in?uri=',@uri,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
171  </xsl:if>
172  <xsl:apply-templates>
173   <xsl:with-param name="currentCICURI" select="$currentCICURI"/>
174   <xsl:with-param name="quotedCurrentCICURI" select="$quotedCurrentCICURI"/>
175  </xsl:apply-templates>
176 </xsl:template>
177
178 <xsl:template match="text()"/>
179 </xsl:stylesheet>