Integrates (TEI) graphing through the jung2 and batik libraries into eXist-db.
We combine parts of the TEI namesdates module, like <listPerson> and <listOrg> with relations in <listRelation> elements to create graphs of relations between persons (cast and non-cast) and orgs or interaction on stage (cast only) sociograms.
Every <person> or <org> element can have zero to many relations based on IDREF.
if "svg" (SVG) is used as output type we differentiate between persons and organisations in the graphs by making the <person> nodes elliptic and the <org> ones rectangular.
Similarily cast persons have a solid node outline while non-cast persons have a dashed outline. This is based on the @type attribute on the outmost ancestor <listPerson> elements.
We have followed the default of three <relation> @type values “personal”, “social”, and “other”. These are represented by dashed, solid, and dotted edges respectively.
Sociograms are created dynamically and can be created based on any criteria of what constitutes interaction in your project.
These can also be weighted by giving a numeric value to the @sortKey attribute of the <relation> element.
Of course you can also create other types of graphs based on dynamic data.
There is currently one main function:
graphing:relation-graph($listPersons as element()+, $listRelations as element ()+) as node()
Serializes a relation graph based on provided persons/organisations and relations. All other parameters use default values.
Parameters:
$listPersons+ The tei:listPerson elements to create the graph from
$listRelations+ The tei:listRelation elements to create the graph from
Returns: node() : The serialized relation graph in default SVG output-type.
graphing:relation-graph($listPersons as element()+, $listRelations as element ()+, $configuration as element()) as node()
Serializes a relation graph based on provided persons/organisations and relations. All other parameters use default values if empty.
Parameters:
$listPersons+ The tei:listPerson elements to create the graph from
$listRelations+ The tei:listRelation elements to create the graph from
$configuration The configuration, eg <parameters><param name='output' value='svg'/></parameters>.'.
Returns: node() : The serialized relation graph.
Configuration parameters can be given as a parameters element fragment, eg <parameters><param name='output' value='svg'/></parameters>. The current parameters are the following with the default given as first value:
Some of the values are not immediately meaningful but tries to mirror the jung2 values and thus might be removed in case they cannot be bootstraped in this context, eg options can be dependent on other options not implemented and so on.
xquery version "3.0";
import module namespace graphing="http://exist-db.org/xquery/tei-graphing";
declare namespace tei="http://www.tei-c.org/ns/1.0";
let $doc := doc("/db/dramawebben/data/works/IndebetouH_IDetGrona/IndebetouH_IDetGrona.xml")
return
graphing:relation-graph($doc//tei:listPerson[not(parent::tei:listPerson)], $doc//tei:listRelation, <parameters><param name="output" value="graphml"/></parameters>)