Commit 2c721081 authored by Sylvain Schmitz's avatar Sylvain Schmitz

updated chord graph generation

parent 4b3a6b41
all: chord.pdf
numqueries: ../tex/benchmarks-all-full.xml $(wildcard ../../benchmark/*-axis-step.xml)
grep '<ast' `grep 'href' $< | sed -e 's/.*href="\([^"]*\).*/\1/'` | wc -l > $@
site/matrix.json: ../../xslt/matrix.xsl build.xml index.html numqueries xpp.css render.js lang-xpath.js prettify.css
ant
chord.inner.svg: site/matrix.json phantom.js chord.css
phantomjs phantom.js "file://$(PWD)/site/index.html" > chord.inner.svg
chord.svg: chord.inner.svg chord.css
echo '<?xml version="1.0" standalone="no"?>' > $@
echo '<svg id="chord" width="650" height="650"><defs><style type="text/css"><![CDATA[' >> $@
cat chord.css >> $@
echo ']]></style></defs>' >> $@
sed -e 's/<svg[^>]*>//g' chord.inner.svg >> $@
chord.pdf: chord.svg
inkscape $< --export-pdf=$@
......@@ -4,8 +4,7 @@
<description>Extract data from benchmark results.</description>
<property name="xml" value="xpathmark"/>
<property name="target.dir" value="./public_html/chord/"/>
<property name="target.dir" value="./site"/>
<property name="project.root" value="../.."/>
<property name="bench.dir" value="${project.root}/benchmark"/>
<property name="lib.dir" value="${project.root}/lib"/>
......@@ -36,12 +35,12 @@
<srcfiles dir="${project.root}/xslt/" includes="matrix.xsl"/>
<srcfiles dir="./" includes="index.html"/>
<srcfiles dir="${bench.dir}" includes="${xml}-full.xml"/>
<mergemapper to="${target.dir}/${xml}/matrix.json"/>
<mergemapper to="${target.dir}/matrix.json"/>
</uptodate>
<target name="matrix" depends="saxon,xtask" unless="extracted">
<mkdir dir="${target.dir}/${xml}"/>
<mkdir dir="${target.dir}/"/>
<xslt style="${project.root}/xslt/matrix.xsl"
in="${bench.dir}/${xml}.xml"
in="${project.root}/tools/tex/benchmarks-all-full.xml"
out="matrix.json">
<classpath>
<pathelement path="${lib.dir}/saxon9he.jar"/>
......@@ -49,29 +48,28 @@
</xslt>
<!-- get the number of fragments -->
<xpath document="${project.root}/relaxng/fragments-full.xml"
xpath="count(//schema)"
xpath="count(//schema)-2"
outputproperty="fragments"/>
<!-- get the number of entries -->
<xpath document="${bench.dir}/${xml}-xml.xml"
xpath="count(//xpath/ast)"
outputproperty="entries"/><!-- //xpath[ast/descendant::*[local-name() = 'xpathAxis']])" -->
<loadfile srcFile="numqueries"
property="entries"/><!-- //xpath[ast/descendant::*[local-name() = 'xpathAxis']])" -->
<!-- process index.html -->
<copy file="index.html" todir="${target.dir}/${xml}">
<copy file="index.html" todir="${target.dir}/">
<filterchain>
<replacetokens>
<token key="FRAGMENTS" value="${fragments}"/>
<token key="BENCHMARK" value="${xml}"/>
<!--token key="BENCHMARK" value="${xml}"/-->
<token key="ENTRIES" value="${entries}"/>
</replacetokens>
</filterchain>
</copy>
<!-- copy benchmark information -->
<move file="matrix.json" todir="${target.dir}/${xml}"/>
<move file="fragments.csv" todir="${target.dir}/${xml}"/>
<bzip2 src="${bench.dir}/${xml}.xml"
<move file="matrix.json" todir="${target.dir}/"/>
<move file="fragments.csv" todir="${target.dir}/"/>
<!--bzip2 src="${bench.dir}/${xml}-full.xml"
destfile="${target.dir}/${xml}/${xml}.xml.bz2"/>
<copy file="${bench.dir}/${xml}.LICENSE"
todir="${target.dir}/${xml}"/>
todir="${target.dir}/${xml}"/-->
</target>
<!-- minify CSS and javascript files -->
......
#circle circle {
fill: none;
pointer-events: all;
}
#circle textpath { font-size: 11px; }
#chord .group path {
fill-opacity: .5;
stroke: #444;
stroke-width: .1pt;
}
#chord path.chord {
cursor: pointer;
stroke: #444;
stroke-width: .1pt;
opacity: .8;
}
path {
transition: opacity 0.1s ease-in-out;
}
path.inactive, #circle:hover path.fade {
opacity: 0;
}
\ No newline at end of file
......@@ -2,12 +2,13 @@
<html>
<head>
<meta charset="utf-8">
<title>XPath fragments in @BENCHMARK@</title>
<link rel="stylesheet" type="text/css" href="../prettify.min.css">
<link rel="stylesheet" type="text/css" href="../xpp.min.css">
<title>XPath fragments in the benchmark</title>
<link rel="stylesheet" type="text/css" href="prettify.min.css">
<link rel="stylesheet" type="text/css" href="xpp.min.css">
<link rel="stylesheet" type="text/css" href="chord.min.css">
<script type="text/javascript"
src="https://cdn.rawgit.com/google/code-prettify/master/loader/prettify.js"></script>
<script type="text/javascript" src="../lang-xpath.min.js"></script>
<script type="text/javascript" src="lang-xpath.min.js"></script>
<script src="https://d3js.org/d3.v4.min.js" charset="utf-8"></script>
<script src="https://d3js.org/queue.v1.min.js"></script>
<body>
......@@ -15,13 +16,11 @@
<h2>(<span style="color:red">preliminary version</span>)</h2>
<p>We extracted <a href="@BENCHMARK@.xml.bz2">@ENTRIES@ XPath
entries</a> from @BENCHMARK@
entries</a>
using <a href="https://git.lsv.fr/schmitz/xpparser">xpparser</a>,
and checked those entries against various XPath fragments. The
following rendering of the results was built
with <a href="http://d3js.org/">D3</a>. See also
@BENCHMARK@'s <a href="@BENCHMARK@.LICENSE">license</a> for
conditions of use.
with <a href="http://d3js.org/">D3</a>.
<p> We are mostly interested in XPath entries belonging to one
fragment but not another, which yields the matrix on the left and
......@@ -44,7 +43,7 @@
<div id="log" style="opacity: 0;"></div>
</div>
<div id="links"></div>
<script type="text/javascript" src="../render.min.js"></script>
<script type="text/javascript" src="render.min.js"></script>
<script type="text/javascript">
var N = @FRAGMENTS@ - 1;
var margin = {top: 80, right: 0, bottom: 10, left: 80},
......
......@@ -13,32 +13,6 @@ a:hover { color: #666; text-decoration: underline; }
}
#left { font-size: 10px; }
#circle circle {
fill: none;
pointer-events: all;
}
#circle textpath { font-size: 11px; }
#chord .group path {
fill-opacity: .5;
stroke: #444;
stroke-width: .1pt;
}
#chord path.chord {
cursor: pointer;
stroke: #444;
stroke-width: .1pt;
}
path {
transition: opacity 0.1s ease-in-out;
}
path.inactive, #circle:hover path.fade {
opacity: 0;
}
#matrix, aside, aside select { font: 10px sans-serif; }
#matrix text { fill: #333; }
#matrix text.active { fill: red }
......
......@@ -4,12 +4,13 @@
<xsl:output method="text"/>
<xsl:param name="fragments"
select="document('../relaxng/fragments-core-1.0.xml')//schema"/>
select="document('../relaxng/fragments-full.xml')//schema[@name
!= 'Downward' and @name != 'Forward']"/>
<xsl:param name="nexamples" select="15"/>
<xsl:template match="/">
<xsl:variable name="root" select="/"/>
<xsl:variable name="benchmarks" select="document(//benchmark/@href)"/>
<!-- fragments -->
<xsl:result-document method="text" href="fragments.csv">
<xsl:text>name,color,entries
......@@ -17,7 +18,7 @@
<xsl:for-each select="$fragments">
<xsl:call-template name="fragment">
<xsl:with-param name="f" select="current()"/>
<xsl:with-param name="root" select="$root"/>
<xsl:with-param name="benchmarks" select="$benchmarks"/>
</xsl:call-template>
<xsl:text>
</xsl:text>
......@@ -29,7 +30,7 @@
<xsl:for-each select="$fragments">
<xsl:call-template name="line">
<xsl:with-param name="source" select="current()"/>
<xsl:with-param name="root" select="$root"/>
<xsl:with-param name="benchmarks" select="$benchmarks"/>
</xsl:call-template>
</xsl:for-each>
<xsl:text>]</xsl:text>
......@@ -39,17 +40,18 @@
<!-- one line of the matrix -->
<xsl:template name="line">
<xsl:param name="source"/>
<xsl:param name="root"/>
<xsl:param name="benchmarks"/>
<xsl:text>[</xsl:text>
<xsl:for-each select="$fragments">
<xsl:call-template name="entry">
<xsl:with-param name="source" select="$source"/>
<xsl:with-param name="target" select="current()"/>
<xsl:with-param name="root" select="$root"/>
<xsl:with-param name="benchmarks" select="$benchmarks"/>
<xsl:with-param name="fragments" select="$fragments"/>
</xsl:call-template>
</xsl:for-each>
<xsl:text>]</xsl:text>
<xsl:if test="$source != $fragments[last()]">
<xsl:if test="$source ne $fragments[last()]">
<xsl:text>,</xsl:text>
</xsl:if>
</xsl:template>
......@@ -58,8 +60,9 @@
<xsl:template name="entry">
<xsl:param name="source"/>
<xsl:param name="target"/>
<xsl:param name="root"/>
<xsl:variable name="examples" select="$root//xpath[schemas/validation[@schema=$source/@file and @valid='yes'] and schemas/validation[@schema=$target/@file and @valid='no']]"/>
<xsl:param name="benchmarks"/>
<xsl:param name="fragments"/>
<xsl:variable name="examples" select="$benchmarks//xpath[schemas/validation[@schema=$source/@file and @valid='yes'] and schemas/validation[@schema=$target/@file and @valid='no']]"/>
<xsl:text>{ "z": </xsl:text><xsl:value-of select="count($examples)"/>
<xsl:if test="$examples">
<xsl:text>, "examples": [</xsl:text>
......@@ -82,11 +85,11 @@
<!-- one fragment -->
<xsl:template name="fragment">
<xsl:param name="f"/>
<xsl:param name="root"/>
<xsl:param name="benchmarks"/>
<xsl:value-of select="$f/@name"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="$f/@color"/>
<xsl:text>,</xsl:text>
<xsl:value-of select="count($root//xpath[schemas/validation[@schema=$f/@file and @valid='yes']])"/>
<xsl:value-of select="count($benchmarks//xpath[schemas/validation[@schema=$f/@file and @valid='yes']])"/>
</xsl:template>
</xsl:stylesheet>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment