]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/style/mk_meta_graph.xsl
Ported to RDF syntax.
[helm.git] / helm / style / mk_meta_graph.xsl
index 44d5a9070a9a4ed1889ea4aad34c48b384b26a8c..020a64af52758c95b0f13a5057900c4b43971589 100644 (file)
 ">
 ]>
 
-<xsl:stylesheet version="0.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-                              xmlns:ht="http://www.cs.unibo.it/helm/namespaces/helm-theory">
+<xsl:stylesheet version="0.1"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:h="http:/www.cs.unibo.it/helm/schemas/schema-h.rdf#">
 
 <xsl:output method="text"/>
 
@@ -40,7 +42,7 @@
 <xsl:param name="getterURL" select="''"/>
 <xsl:param name="uri_set_queueURL" select="''"/>
 <xsl:param name="uri_set_size" select="30"/>
-<xsl:variable name="RDF_base_URL_of_CIC_URI" select="concat($getterURL,'getxml?uri=helm:rdf:www.cs.unibo.it/helm/rdf/rdfprova//')"/>
+<xsl:variable name="base_URL_of_URI" select="concat($getterURL,'getxml?uri=')"/>
 
 <!-- CSC: next functions because I don't remember the name of the    -->
 <!-- CSC: subst function of xslt and I don't have the specs with me -->
  </xsl:choose>
 </xsl:template>
 
+<xsl:template name="RDFURI_of_CICURI">
+ <xsl:param name="uri" select="''"/>
+ <xsl:variable name="base_RDF_URI" select="'helm:rdf:www.cs.unibo.it/helm/rdf/backward//'"/>
+ <xsl:variable name="before" select="substring-before($uri,'#xpointer(1/')"/>
+ <xsl:value-of select="$base_RDF_URI"/>
+ <xsl:choose>
+  <xsl:when test="$before=''">
+   <xsl:value-of select="$uri"/>
+  </xsl:when>
+  <xsl:otherwise>
+   <xsl:value-of select="concat($before,',')"/>
+   <xsl:variable name="after" select="substring-after($uri,'#xpointer(1/')"/>
+   <xsl:value-of select="translate(substring-before($after,')'),'/',',')"/>
+  </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
 <xsl:template match="/">
  <!--
  <xsl:text>strict digraph L0 { size = "83,83"; concentrate=true; node [style=filled, shape = box];&CSCbr;</xsl:text>
   </xsl:call-template>
  </xsl:variable>
  <!-- The nonce is used to force the document reload -->
- <xsl:variable name="dummy0" select="document(concat($uri_set_queueURL,'set_uri_set_size?uri=',$CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID,'&amp;size=',$uri_set_size))"/>
+ <xsl:variable name="dummy0" select="document(concat($uri_set_queueURL,'set_uri_set_size?uri=',$quoted_CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID,'&amp;size=',$uri_set_size))"/>
  <xsl:variable name="dummy1" select="document(concat($uri_set_queueURL,'add_if_not_in?uri=',$quoted_CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
  <xsl:apply-templates mode="loop" select="document(concat($uri_set_queueURL,'get_next?uri=',$quoted_CICURI,'&amp;nonce=',generate-id(),'&amp;PID=',$PID))"/>
  <xsl:variable name="dummy2" select="document(concat($uri_set_queueURL,'reset_to_empty?PID=',$PID))"/>
 <xsl:template mode="loop" match="empty"/>
 
 <xsl:template mode="loop" match="uri|marked_uri">
- <xsl:variable name="document" select="document(concat($RDF_base_URL_of_CIC_URI,@value))"/>
+ <xsl:variable name="rdfuri">
+  <xsl:call-template name="RDFURI_of_CICURI">
+   <xsl:with-param name="uri" select="@value"/>
+  </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="document" select="document(concat($base_URL_of_URI,$rdfuri))"/>
  <xsl:choose>
   <xsl:when test="$document/*">
    <xsl:apply-templates mode="first_time" select="$document/*">
  <xsl:text>];&CSCbr;</xsl:text>
 </xsl:template>
 
-<xsl:template match="occurs">
+<xsl:template match="*">
  <xsl:param name="currentCICURI" select="''"/>
  <xsl:param name="quotedCurrentCICURI" select="''"/>
- <xsl:for-each select="*">
+ <xsl:for-each select="*/*/*">
   <xsl:variable name="quotedURI">
    <xsl:call-template name="quote">
-    <xsl:with-param name="s" select="@uri"/>
+    <xsl:with-param name="s" select="@rdf:value"/>
+   </xsl:call-template>
+  </xsl:variable>
+  <xsl:variable name="quoted_uri">
+   <xsl:call-template name="quote_url">
+    <xsl:with-param name="s" select="@rdf:value"/>
    </xsl:call-template>
   </xsl:variable>
- <xsl:variable name="quoted_uri">
-  <xsl:call-template name="quote_url">
-   <xsl:with-param name="s" select="@uri"/>
-  </xsl:call-template>
- </xsl:variable>
   <!-- The nonce, quotedCurrentCICURI are used to force the document reload -->
   <xsl:if test="not(name(document(concat($uri_set_queueURL,'add_if_not_in?uri=',$quoted_uri,'&amp;nonce=',generate-id(),'&amp;PID=',$PID,'&amp;quotedCurrentCICURI=',$quotedCurrentCICURI))/*)='not_added_because_already_too_many')">
    <xsl:text> </xsl:text>