update for basex 8.0
5
.project
|
@ -5,6 +5,11 @@
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>de.loskutov.FileSync.FSBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
</natures>
|
</natures>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# graphxq - interface to graphviz for BaseX 7.5
|
# graphxq - interface to graphviz for BaseX 8.0
|
||||||
|
|
||||||
* includes dotML
|
* includes dotML
|
||||||
* BaseX RestXQ interface
|
* BaseX RestXQ interface
|
||||||
|
|
|
@ -52,7 +52,7 @@ declare %private function dot-execute( $dot as xs:string, $params as xs:string*)
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~ run dot command returning binary :)
|
(:~ run dot command returning binary :)
|
||||||
declare %private function dot-executeb( $dot as xs:string, $params as xs:string*) as xs:base64Binary{
|
declare function dot-executeb( $dot as xs:string, $params as xs:string*) as xs:base64Binary{
|
||||||
let $fname:=$gr:tmpdir || random:uuid()
|
let $fname:=$gr:tmpdir || random:uuid()
|
||||||
let $oname:=$fname || ".o"
|
let $oname:=$fname || ".o"
|
||||||
let $junk:=file:write-text($fname,$dot)
|
let $junk:=file:write-text($fname,$dot)
|
||||||
|
|
|
@ -10,14 +10,14 @@ declare default function namespace 'apb.graphviz.web';
|
||||||
import module namespace gr = 'apb.graphviz' at "graphviz.xqm";
|
import module namespace gr = 'apb.graphviz' at "graphviz.xqm";
|
||||||
import module namespace dotml = 'http://www.martin-loetzsch.de/DOTML' at "dotml.xqm";
|
import module namespace dotml = 'http://www.martin-loetzsch.de/DOTML' at "dotml.xqm";
|
||||||
import module namespace dotui = 'apb.graphxq.dotui' at "dotui.xqm";
|
import module namespace dotui = 'apb.graphxq.dotui' at "dotui.xqm";
|
||||||
import module namespace txq = 'apb.txq' at "lib/txq.xqm";
|
import module namespace txq = 'quodatum.txq' at "lib/txq.xqm";
|
||||||
import module namespace request = "http://exquery.org/ns/request";
|
import module namespace request = "http://exquery.org/ns/request";
|
||||||
|
|
||||||
declare namespace svg= "http://www.w3.org/2000/svg";
|
declare namespace svg= "http://www.w3.org/2000/svg";
|
||||||
declare namespace restxq = 'http://exquery.org/ns/restxq';
|
declare namespace restxq = 'http://exquery.org/ns/restxq';
|
||||||
|
|
||||||
(:~ shared page wrapper :)
|
(:~ shared page wrapper :)
|
||||||
declare variable $grxq:layout:=fn:resolve-uri("views/layout.xml");
|
declare variable $grxq:layout:=fn:resolve-uri("views/layout.xq");
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
: Home page for app
|
: Home page for app
|
||||||
|
@ -26,7 +26,7 @@ declare
|
||||||
%restxq:GET %restxq:path("graphxq")
|
%restxq:GET %restxq:path("graphxq")
|
||||||
%output:method("html") %output:version("5.0")
|
%output:method("html") %output:version("5.0")
|
||||||
function home(){
|
function home(){
|
||||||
<restxq:redirect>/restxq/graphxq/about</restxq:redirect>
|
<restxq:redirect>/graphxq/about</restxq:redirect>
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
|
@ -36,7 +36,7 @@ declare
|
||||||
%restxq:GET %restxq:path("graphxq/about")
|
%restxq:GET %restxq:path("graphxq/about")
|
||||||
%output:method("html") %output:version("5.0")
|
%output:method("html") %output:version("5.0")
|
||||||
function about(){
|
function about(){
|
||||||
render("views/about.xml",map{"title":="GraphXQ"})
|
render("views/about.xml",map{"title":"GraphXQ"})
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
|
@ -68,13 +68,13 @@ function dotform($src){
|
||||||
let $dot:= getdot("digraph {a -> b}",$src)
|
let $dot:= getdot("digraph {a -> b}",$src)
|
||||||
let $svgwidget:=fn:doc("views/widget.svg")
|
let $svgwidget:=fn:doc("views/widget.svg")
|
||||||
let $toolbar:=fn:doc("views/toolbar.xml")
|
let $toolbar:=fn:doc("views/toolbar.xml")
|
||||||
let $map:=map{"list-shapes":=dotui:shapes(""),
|
let $map:=map{"list-shapes": dotui:shapes(""),
|
||||||
"list-colors":=dotui:colors(""),
|
"list-colors": dotui:colors(""),
|
||||||
"svgwidget":=$svgwidget,
|
"svgwidget": $svgwidget,
|
||||||
"toolbar":=$toolbar,
|
"toolbar": $toolbar,
|
||||||
"title":="DOT editor",
|
"title": "DOT editor",
|
||||||
"dot":=$dot}
|
"dot": $dot}
|
||||||
return render("views/dotform.xml",$map)
|
return render("views/dotform.xq",$map)
|
||||||
};
|
};
|
||||||
|
|
||||||
declare
|
declare
|
||||||
|
@ -87,12 +87,12 @@ function dotmlform($src){
|
||||||
let $default:=<graph xmlns="http://www.martin-loetzsch.de/DOTML"><node id="test"/></graph>
|
let $default:=<graph xmlns="http://www.martin-loetzsch.de/DOTML"><node id="test"/></graph>
|
||||||
let $dotml:= getdotml($default ,$src)
|
let $dotml:= getdotml($default ,$src)
|
||||||
let $dotml:= fn:serialize($dotml)
|
let $dotml:= fn:serialize($dotml)
|
||||||
let $v:=map{ "svgwidget":=$svgwidget,
|
let $v:=map{ "svgwidget": $svgwidget,
|
||||||
"toolbar":=$toolbar,
|
"toolbar": $toolbar,
|
||||||
"title":="DOTML editor",
|
"title": "DOTML editor",
|
||||||
"bodyclass":="h100",
|
"bodyclass": "h100",
|
||||||
"dotml":=$dotml}
|
"dotml": $dotml}
|
||||||
return render("views/dotmlform.xml",$v)
|
return render("views/dotmlform.xq",$v)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ declare
|
||||||
%restxq:GET %restxq:path("graphxq/api")
|
%restxq:GET %restxq:path("graphxq/api")
|
||||||
%output:method("html") %output:version("5.0")
|
%output:method("html") %output:version("5.0")
|
||||||
function api(){
|
function api(){
|
||||||
render("views/api.xml",map{"title":="API information"})
|
render("views/api.xml",map{"title": "API information"})
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~ static ace page :)
|
(:~ static ace page :)
|
||||||
|
@ -113,8 +113,8 @@ function ace(){
|
||||||
let $svgwidget:=fn:doc("views/widget.svg")
|
let $svgwidget:=fn:doc("views/widget.svg")
|
||||||
let $toolbar:=fn:doc("views/toolbar.xml")
|
let $toolbar:=fn:doc("views/toolbar.xml")
|
||||||
let $v:=map{
|
let $v:=map{
|
||||||
"title":="XQuery editor (for no reason) ",
|
"title": "XQuery editor (for no reason) ",
|
||||||
"bodyclass":="h100"
|
"bodyclass": "h100"
|
||||||
}
|
}
|
||||||
return render("views/ace.xml",$v)
|
return render("views/ace.xml",$v)
|
||||||
};
|
};
|
||||||
|
@ -125,9 +125,9 @@ declare
|
||||||
%output:method("html") %output:version("5.0")
|
%output:method("html") %output:version("5.0")
|
||||||
function library(){
|
function library(){
|
||||||
let $lib:=fn:doc("data/library.xml")
|
let $lib:=fn:doc("data/library.xml")
|
||||||
let $map:=map{"title":="Samples",
|
let $map:=map{"title": "Samples",
|
||||||
"items":=$lib//items,
|
"items": $lib//items,
|
||||||
"url":=function($item){fn:concat($item/url/@type,'?src=data/samples/',$item/url)}
|
"url": function($item){fn:concat($item/url/@type,'?src=data/samples/',$item/url)}
|
||||||
}
|
}
|
||||||
return render("views/library.xml",$map)
|
return render("views/library.xml",$map)
|
||||||
};
|
};
|
||||||
|
@ -199,9 +199,9 @@ declare function active-link($path as xs:string,$page as xs:string) as xs:string
|
||||||
:)
|
:)
|
||||||
declare function render($template as xs:string,$locals){
|
declare function render($template as xs:string,$locals){
|
||||||
let $path:=request:path()
|
let $path:=request:path()
|
||||||
let $default:=map{ "title":=request:path(),
|
let $default:=map{ "title": request:path(),
|
||||||
"active-link":=active-link($path,?), (: *** FAILS IF request:path() :)
|
"active-link": active-link($path,?), (: *** FAILS IF request:path() :)
|
||||||
"bodyclass":=""}
|
"bodyclass": ""}
|
||||||
let $locals:=map:new(($default,$locals))
|
let $locals:=map:merge(($default,$locals))
|
||||||
return txq:render(fn:resolve-uri($template),$locals,$grxq:layout)
|
return txq:render(fn:resolve-uri($template),$locals,$grxq:layout)
|
||||||
};
|
};
|
|
@ -1,14 +1,16 @@
|
||||||
|
xquery version "3.0";
|
||||||
(:~
|
(:~
|
||||||
: A(nother) templating Engine for XQuery (BaseX 7.5 specific)
|
: A(nother) templating Engine for XQuery (BaseX specific)
|
||||||
: specials:
|
: specials:
|
||||||
: partial(file,name,sequence)
|
: partial(file,name,sequence)
|
||||||
:
|
:
|
||||||
: @author andy bunce
|
: @author andy bunce
|
||||||
: @since sept 2012
|
: @since sept 2012
|
||||||
|
: @licence apache 2
|
||||||
:)
|
:)
|
||||||
|
|
||||||
module namespace txq = 'apb.txq';
|
module namespace txq = 'quodatum.txq';
|
||||||
declare default function namespace 'apb.txq';
|
declare default function namespace 'quodatum.txq';
|
||||||
import module namespace xquery = "http://basex.org/modules/xquery";
|
import module namespace xquery = "http://basex.org/modules/xquery";
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
|
@ -18,19 +20,19 @@ import module namespace xquery = "http://basex.org/modules/xquery";
|
||||||
: @return updated doc from map
|
: @return updated doc from map
|
||||||
:)
|
:)
|
||||||
declare function render($template as xs:string,$map as map(*)){
|
declare function render($template as xs:string,$map as map(*)){
|
||||||
let $map:=map:new(($map,map{"partial":=partial(?,?,?,$map,$template)}))
|
let $map:=map:merge(($map,map{"partial": partial(?,?,?,$map,$template)}))
|
||||||
return xquery:invoke($template,$map)
|
return xquery:invoke($template,$map)
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
: template function with wrapping layout
|
: template function with wrapping layout
|
||||||
: @param layout
|
: @param $layout outer template with $body placeholder to insert $template
|
||||||
: @return updated doc from map
|
: @return updated doc from map
|
||||||
:)
|
:)
|
||||||
declare function render($template as xs:string,$map as map(*),$layout as xs:string){
|
declare function render($template as xs:string,$map as map(*),$layout as xs:string){
|
||||||
let $content:=render($template,$map)
|
let $content:=render($template,$map)
|
||||||
let $map:=map:new(($map,map{"body":=$content}))
|
let $map:=map:merge(($map,map{"body": $content}))
|
||||||
return render($layout,$map)
|
return render($layout,$map)
|
||||||
};
|
};
|
||||||
|
|
||||||
(:~
|
(:~
|
||||||
|
@ -38,8 +40,7 @@ declare function render($template as xs:string,$map as map(*),$layout as xs:stri
|
||||||
: @return updated doc from map
|
: @return updated doc from map
|
||||||
:)
|
:)
|
||||||
declare function partial($part as xs:string,$name,$seq,$map,$base){
|
declare function partial($part as xs:string,$name,$seq,$map,$base){
|
||||||
for $s in $seq
|
for $s in $seq
|
||||||
let $map:=map:new(($map,map{$name:=$s}))
|
let $map:=map:merge(($map,map{$name: $s}))
|
||||||
return render(fn:resolve-uri($part,$base),$map)
|
return render(fn:resolve-uri($part,$base),$map)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ for a better way?
|
||||||
<img style="position: absolute; top: 50px; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"/>
|
<img style="position: absolute; top: 50px; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"/>
|
||||||
</a>
|
</a>
|
||||||
<footer>
|
<footer>
|
||||||
<p>© Andy Bunce 2013</p>
|
<p>© Andy Bunce 2013 -2015</p>
|
||||||
<ul class="quick-links">
|
<ul class="quick-links">
|
||||||
<!--
|
<!--
|
||||||
<li><iframe class="github-btn"
|
<li><iframe class="github-btn"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
declare variable $toolbar external :="{tooolbar}";
|
||||||
|
declare variable $dot external :="{dot}";
|
||||||
|
declare variable $svgwidget external :="{svg}";
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
|
||||||
<div class="row-fluid" style="height:24px">
|
<div class="row-fluid" style="height:24px">
|
|
@ -1,3 +1,7 @@
|
||||||
|
declare variable $toolbar external :="{tooolbar}";
|
||||||
|
declare variable $dotml external :="{dotml}";
|
||||||
|
declare variable $svgwidget external :="{svg}";
|
||||||
|
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="row-fluid" style="height:24px">
|
<div class="row-fluid" style="height:24px">
|
||||||
{$toolbar}
|
{$toolbar}
|
|
@ -1,3 +1,8 @@
|
||||||
|
declare variable $body external :="{body}";
|
||||||
|
declare variable $title external :="{title}";
|
||||||
|
declare variable $bodyclass external :="{$bodyclass}";
|
||||||
|
declare variable $active-link external :=function($_){$_};
|
||||||
|
|
||||||
<html >
|
<html >
|
||||||
<head id="head">
|
<head id="head">
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
@ -14,13 +19,13 @@
|
||||||
rel="stylesheet" type="text/css" />
|
rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
<!-- Le fav and touch icons -->
|
<!-- Le fav and touch icons -->
|
||||||
<link rel="shortcut icon" href="/graphxq/graphxq2.png" />
|
<link rel="shortcut icon" href="/static/graphxq/graphxq2.png" />
|
||||||
|
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.1/jquery.min.js" type="text/javascript"></script>
|
||||||
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js" type="text/javascript"></script>
|
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/bootstrap.min.js" type="text/javascript"></script>
|
||||||
<script src="http://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
<script src="http://raw.github.com/ajaxorg/ace-builds/master/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<link href="/graphxq/app.css" rel="stylesheet" type="text/css" />
|
<link href="/static/graphxq/app.css" rel="stylesheet" type="text/css" />
|
||||||
<script src="/graphxq/app.js" type="text/javascript"></script>
|
<script src="/static/graphxq/app.js" type="text/javascript"></script>
|
||||||
<script type="text/javascript"><![CDATA[
|
<script type="text/javascript"><![CDATA[
|
||||||
var _gaq = _gaq || [];
|
var _gaq = _gaq || [];
|
||||||
_gaq.push(['_setAccount', 'UA-34544921-1']);
|
_gaq.push(['_setAccount', 'UA-34544921-1']);
|
||||||
|
@ -44,7 +49,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</a>
|
</a>
|
||||||
<a href="about" class="brand" title="Version 0.4.0">
|
<a href="about" class="brand" title="Version 0.4.0">
|
||||||
<img src="/graphxq/graphxq2.png" />
|
<img src="/static/graphxq/graphxq2.png" />
|
||||||
graphXQ
|
graphXQ
|
||||||
</a>
|
</a>
|
||||||
|
|
Before Width: | Height: | Size: 880 B After Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Before Width: | Height: | Size: 880 B After Width: | Height: | Size: 880 B |
Before Width: | Height: | Size: 880 B After Width: | Height: | Size: 880 B |