|
|
pl:miw:miw08_xtt_xml [2008/03/22 18:54] miw |
pl:miw:miw08_xtt_xml [2019/06/27 15:50] |
====== Opis ====== | |
Szymon Deja <szydej@gmail.com> | |
| |
Translacja XTTML do innych formatów z użyciem XSLT. : ontologie (OWL), graphviz | |
| |
====== Spotkania ====== | |
| |
===== 080311 ===== | |
* XSLT | |
* obsługa XSD | |
* repr. reguł w OWL, RIF? | |
* gotowe transl xslt do owl | |
* format graphviz: wizualizacja tablic :!: | |
| |
| |
===== 080318 ===== | |
* próba translacji [[student:xttml20|XTTML20]] do graphviza | |
| |
===== 080401 ===== | |
* syntetyczny opis ograniczeń podejścia xttml->gv (czego i dlaczego nie da się zrobić) | |
* próba zrobienia tego w [[http://www.w3.org/Graphics/SVG/|SVG]] patrz FIXME proj z miw z zeszlego roku | |
| |
====== Projekt ====== | |
| |
Reprezentajca tabel w graphizie : | |
| |
<code graphviz> | |
| |
digraph structs { | |
node [shape=record]; | |
struct1 [shape=record,label="<f0> left|<f1> mid\ dle|<f2> right"]; | |
struct2 [shape=record,label="<f0> one|<f1> two"]; | |
struct3 [shape=record,label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"]; | |
struct1 -> struct2; | |
struct1 -> struct3; | |
} | |
| |
</code> | |
| |
| |
{{:pl:miw:record.gif|:pl:miw:record.gif}} | |
| |
Translacja XTTML20 do graphviza | |
* Translacja dotml do grapviza (dot) {{:pl:miw:dotml2dot.txt|dotml2dot.xsl}} | |
* Translacja XTTML20 do dotml (XSLT) {{:pl:miw:xtt2dot.txt|xtt2dotml.xsl}} | |
| |
<code xml> | |
| |
| |
<xsl:stylesheet version="1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:strip-space elements="doc chapter section"/> | |
<xsl:output indent="yes" method="xml"/> | |
<xsl:template match="/"> | |
<graph xmlns="http://www.martin-loetzsch.de/DOTML"> | |
<xsl:for-each select="/xttml/xtt_list_table/xtt_table"> | |
<xsl:variable name="tabela" select="@name"/> | |
<record> | |
<xsl:for-each select="./column_attributes/ca"> | |
<xsl:variable name="col" select="position()"/> | |
<record> | |
<xsl:variable name="kolumna" select="."/> | |
<xsl:element name="node"> | |
<xsl:attribute name="id">555</xsl:attribute> | |
<xsl:attribute name="label"> | |
<xsl:value-of select="."/> | |
</xsl:attribute> | |
</xsl:element> | |
<xsl:for-each select="../../row"> | |
<xsl:variable name="i" select="position()"/> | |
<xsl:for-each select="cell[$col]"> | |
<xsl:variable name="id"> | |
<xsl:value-of select="$tabela"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$i"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$kolumna"/> | |
</xsl:variable> | |
<xsl:variable name="label" select="translate(translate(@content,'{','('),'}',')')"/> | |
<xsl:choose> | |
<xsl:when test="./@operator='e'"> | |
<node id="{$id}" label="= {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='ne'"> | |
<node id="{$id}" label="=! {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='g'"> | |
<node id="{$id}" label="gt; {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='ge'"> | |
<node id="{$id}" label="gt;= {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='l'"> | |
<node id="{$id}" label="lt; {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='le'"> | |
<node id="{$id}" label="lt;= {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='min'"> | |
<node id="{$id}" label="min {$label}"/> | |
</xsl:when> | |
<xsl:when test="./@operator='in'"> | |
<node id="{$id}" label="in {$label}"/> | |
</xsl:when> | |
</xsl:choose> | |
</xsl:for-each> | |
</xsl:for-each> | |
</record> | |
</xsl:for-each> | |
</record> | |
</xsl:for-each> | |
<xsl:for-each select="//xtt_list_connections/xtt_connection"> | |
<xsl:variable name="tabfrom" select="@source_table_name"/> | |
<xsl:variable name="tabto" select="@destination_table_name"/> | |
<xsl:variable name="sr" select="@source_row"/> | |
<xsl:variable name="dr" select="@destination_row"/> | |
<xsl:variable name="srow" select="//xtt_table[@name = $tabfrom]/column_attributes/ca[last()]"/> | |
<xsl:variable name="drow" select="//xtt_table[@name = $tabto]/column_attributes/ca[1]"/> | |
<xsl:variable name="from"> | |
<xsl:value-of select="$tabfrom"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$sr + 1"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$srow"/> | |
</xsl:variable> | |
<xsl:variable name="to"> | |
<xsl:value-of select="$tabto"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$dr + 1"/> | |
<xsl:text>_</xsl:text> | |
<xsl:value-of select="$drow"/> | |
</xsl:variable> | |
<xsl:element name="edge"> | |
<xsl:attribute name="from"> | |
<xsl:value-of select="$from"/> | |
</xsl:attribute> | |
<xsl:attribute name="to"> | |
<xsl:value-of select="$to"/> | |
</xsl:attribute> | |
<xsl:attribute name="constraint"> | |
<xsl:text>false</xsl:text> | |
</xsl:attribute> | |
<xsl:attribute name="tailport"> | |
<xsl:text>:e</xsl:text> | |
</xsl:attribute> | |
<xsl:attribute name="headport"> | |
<xsl:text>:w</xsl:text> | |
</xsl:attribute> | |
</xsl:element> | |
</xsl:for-each> | |
</graph> | |
</xsl:template> | |
</xsl:stylesheet> | |
| |
| |
</code> | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
====== Sprawozdanie ====== | |
Opis ograniczeń podejścia xttml→gv | |
* Tekst w komurakch tabeli nie moze zawierać znaków : <, >, }, { | |
* graviz nie radzi sobie z odpowiednim ustawieniem przy złożonych diagramach (źle rysuje polączenia miedzy tabelami) | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
====== Materiały ====== | |
[[http://www.w3.org/Style/XSL/|XSLT]] (tutoriale): | |
* [[http://zvon.org/xxl/XSLTutorial/Output/index.html|ZVON XSLT]] | |
* [[http://w3schools.com/xsl/default.asp|W3S XSLT]] | |
| |
[[http://www.w3.org/XML/Schema| XSD]] (tutoriale): | |
* [[http://www.w3schools.com/schema/default.asp |W3S XSD]] | |
| |
| |
[[http://www.w3.org/2004/OWL/ |OWL ]] | |
* [[http://www.cs.man.ac.uk/~horrocks/ISWC2003/Tutorial/ |Tutorial]] | |
* [[http://www.jfsowa.com/ontology/ | ontologie ]] | |
* [[http://protege.stanford.edu/publications/ontology_development/ontology101-noy-mcguinness.html| ontologie]] | |
| |
[[http://www.w3.org/2005/rules/wg/wiki/PRdialect/Overview | RIF-PRD]] Reguły w RIF | |
| |
[[http://www.graphviz.org/About.php|graphviz]] | |
*[[http://www.martin-loetzsch.de/DOTML/]] | |
| |
Gotowe tlanslatory XSLT | |
| |
* [[http://www.ag-nbi.de/research/owltrans/]] | |
| |
| |
[[http://www.w3schools.com/svg/default.asp| SVG tutorial ]] | |
| |
| |