Commits

Anonymous committed b7e3eeb Draft

fixed dependencies

  • Participants
  • Parent commits 5d368f8

Comments (0)

Files changed (218)

+syntax: glob
+.classpath
+.project
+.settings
+target
+doc
+output

bin/META-INF/declaratron

-org.xmlcml.cml.declaratron.chem.amber.AmberConverters

bin/log4j.properties

-log4j.rootLogger=DEBUG, A1
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
-log4j.logger.uk.ac.cam=DEBUG
-
-log4j.logger.org.xmlcml.cml.converters.marker = INFO

bin/org/xmlcml/declaratron/chem/chemistry/classList.xml

-<classList>
-	<class tag="arrayTool"    name="org.xmlcml.cml.chemistry.ArrayToolVisitable" />
-	<class tag="atomTypeTool" name="org.xmlcml.cml.chemistry.AtomTypeToolVisitable" />
-	<class tag="energy"       name="org.xmlcml.cml.chemistry.EnergyVisitable" />
-	<class tag="geometry"     name="org.xmlcml.cml.chemistry.GeometryVisitable" />
-	<class tag="moleculeTool" name="org.xmlcml.cml.chemistry.MoleculeToolVisitable" />
-	<class tag="units"        name="org.xmlcml.cml.units.UnitsVisitor" />
-</classList>
-		

bin/org/xmlcml/declaratron/core/semantic/AbstractExecutableElement.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/AssertVisitable.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/ClassNamespaceVisitorTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/CompoundDocumentTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/Computation.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/ComputationTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/HrefxVisitorTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/KeyValueVisitorTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/NodeUtils.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/VisitorTest.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/XMLContext.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/XMLWriter.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/class/cml.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<molecule id="karplus1" hrefSource="src/test/resources/molecules/ClCCF.cml" xmlns="http://www.xml-cml.org/schema">
-  <atomArray>
-    <atom id="a1" elementType="C" x3="-2.033178" y3="1.612364" z3="-0.007709"/>
-    <atom id="a2" elementType="C" x3="-0.574448" y3="0.979605" z3="-0.117286"/>
-    <atom id="a3" elementType="H" x3="-2.171918" y3="2.380359" z3="0.746261"/>
-    <atom id="a4" elementType="F" x3="-2.990196" y3="0.668500" z3="0.198180"/>
-    <atom id="a5" elementType="H" x3="-2.337508" y3="2.111913" z3="-0.960451"/>
-    <atom id="a6" elementType="Cl" x3="0.076343" y3="0.177568" z3="1.361195"/>
-    <atom id="a7" elementType="H" x3="0.194570" y3="1.744410" z3="-0.337749"/>
-    <atom id="a8" elementType="H" x3="-0.470615" y3="0.219947" z3="-0.882438"/>
-  </atomArray>
-  <bondArray>
-    <bond atomRefs2="a1 a2" order="1"/>
-    <bond atomRefs2="a1 a3" order="1"/>
-    <bond atomRefs2="a1 a4" order="1"/>
-    <bond atomRefs2="a1 a5" order="1"/>
-    <bond atomRefs2="a2 a6" order="1"/>
-    <bond atomRefs2="a2 a7" order="1"/>
-    <bond atomRefs2="a2 a8" order="1"/>
-  </bondArray>
-</molecule>

bin/org/xmlcml/declaratron/core/semantic/class/cml1.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-	<molecule id="karplus1" hrefSource="src/test/resources/molecules/ClCCF.cml"
-		xmlns="http://www.xml-cml.org/schema">
-		<atomArray>
-			<atom id="a1" elementType="C" x3="-2.033178" y3="1.612364" z3="-0.007709" />
-			<atom id="a2" elementType="C" x3="-0.574448" y3="0.979605" z3="-0.117286" />
-			<atom id="a3" elementType="H" x3="-2.171918" y3="2.380359" z3="0.746261" />
-			<atom id="a4" elementType="F" x3="-2.990196" y3="0.668500" z3="0.198180" />
-			<atom id="a5" elementType="H" x3="-2.337508" y3="2.111913" z3="-0.960451" />
-			<atom id="a6" elementType="Cl" x3="0.076343" y3="0.177568" z3="1.361195" />
-			<atom id="a7" elementType="H" x3="0.194570" y3="1.744410" z3="-0.337749" />
-			<atom id="a8" elementType="H" x3="-0.470615" y3="0.219947" z3="-0.882438" />
-		</atomArray>
-		<bondArray>
-			<bond atomRefs2="a1 a2" order="1" />
-			<bond atomRefs2="a1 a3" order="1" />
-			<bond atomRefs2="a1 a4" order="1" />
-			<bond atomRefs2="a1 a5" order="1" />
-			<bond atomRefs2="a2 a6" order="1" />
-			<bond atomRefs2="a2 a7" order="1" />
-			<bond atomRefs2="a2 a8" order="1" />
-		</bondArray>
-	</molecule>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/class/cml1out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-  <molecule id="karplus1" hrefSource="src/test/resources/molecules/ClCCF.cml" xmlns="http://www.xml-cml.org/schema">
-    <atomArray>
-      <atom id="a1" elementType="C" x3="-2.033178" y3="1.612364" z3="-0.007709"/>
-      <atom id="a2" elementType="C" x3="-0.574448" y3="0.979605" z3="-0.117286"/>
-      <atom id="a3" elementType="H" x3="-2.171918" y3="2.380359" z3="0.746261"/>
-      <atom id="a4" elementType="F" x3="-2.990196" y3="0.668500" z3="0.198180"/>
-      <atom id="a5" elementType="H" x3="-2.337508" y3="2.111913" z3="-0.960451"/>
-      <atom id="a6" elementType="Cl" x3="0.076343" y3="0.177568" z3="1.361195"/>
-      <atom id="a7" elementType="H" x3="0.194570" y3="1.744410" z3="-0.337749"/>
-      <atom id="a8" elementType="H" x3="-0.470615" y3="0.219947" z3="-0.882438"/>
-    </atomArray>
-    <bondArray>
-      <bond atomRefs2="a1 a2" order="1"/>
-      <bond atomRefs2="a1 a3" order="1"/>
-      <bond atomRefs2="a1 a4" order="1"/>
-      <bond atomRefs2="a1 a5" order="1"/>
-      <bond atomRefs2="a2 a6" order="1"/>
-      <bond atomRefs2="a2 a7" order="1"/>
-      <bond atomRefs2="a2 a8" order="1"/>
-    </bondArray>
-  </molecule>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/class/cmlout.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<molecule id="karplus1" hrefSource="src/test/resources/molecules/ClCCF.cml" xmlns="http://www.xml-cml.org/schema">
-  <atomArray>
-    <atom id="a1" elementType="C" x3="-2.033178" y3="1.612364" z3="-0.007709"/>
-    <atom id="a2" elementType="C" x3="-0.574448" y3="0.979605" z3="-0.117286"/>
-    <atom id="a3" elementType="H" x3="-2.171918" y3="2.380359" z3="0.746261"/>
-    <atom id="a4" elementType="F" x3="-2.990196" y3="0.668500" z3="0.198180"/>
-    <atom id="a5" elementType="H" x3="-2.337508" y3="2.111913" z3="-0.960451"/>
-    <atom id="a6" elementType="Cl" x3="0.076343" y3="0.177568" z3="1.361195"/>
-    <atom id="a7" elementType="H" x3="0.194570" y3="1.744410" z3="-0.337749"/>
-    <atom id="a8" elementType="H" x3="-0.470615" y3="0.219947" z3="-0.882438"/>
-  </atomArray>
-  <bondArray>
-    <bond atomRefs2="a1 a2" order="1"/>
-    <bond atomRefs2="a1 a3" order="1"/>
-    <bond atomRefs2="a1 a4" order="1"/>
-    <bond atomRefs2="a1 a5" order="1"/>
-    <bond atomRefs2="a2 a6" order="1"/>
-    <bond atomRefs2="a2 a7" order="1"/>
-    <bond atomRefs2="a2 a8" order="1"/>
-  </bondArray>
-</molecule>

bin/org/xmlcml/declaratron/core/semantic/compound/compound.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation
-    xmlns:cml="http://www.xml-cml.org/schema">
-
-	<queryNSList>
-		<queryNS prefix="semc" uri="http://www.xml-cml.org/semanticcomputation" />
-		<queryNS prefix="semf" uri="http://www.xml-cml.org/semanticforcefields" />
-		<queryNS prefix="cml" uri="http://www.xml-cml.org/schema" />
-		<queryNS prefix="m" uri="http://www.w3.org/1998/Math/MathML" />
-		<queryNS prefix="cmlx" uri="http://www.xml-cml.org/schema/cmlx" />
-	</queryNSList>
-
-	<keyValueList>
-		<keyValue key="all" value="/*" />
-		<keyValue key="main" value="src/main/resources" />
-		<keyValue key="mainCml" value="${main}/org/xmlcml/cml" />
-		<keyValue key="test" value="src/test/resources" />
-		<keyValue key="testOut" value="target" />
-		<keyValue key="molDir" value="${test}/molecules" />
-		<keyValue key="out" value="output" />
-		<keyValue key="mol" value="//cml:molecule[@id='karplus1']" />
-	</keyValueList>
-
-	<writer xpath="${all}" file="${testOut}/compoundOut.xml" />
-	<cml:molecule id="mol" href="${molDir}/ClCCF.cml" />
-	<writer xpath="${all}" file="${testOut}/compoundOut1.xml" />
-	<moleculeTool method="getOrCreateTorsions" xpath="${mol}" setId="createdTorsions" />
-
-	<writer xpath="${all}" file="${out}/karplusStart.cml" />
-
-</computation>

bin/org/xmlcml/declaratron/core/semantic/compound/compoundOut.xml

-<computation xmlns:cml="http://www.xml-cml.org/schema">
-	<queryNSList>
-		<queryNS prefix="semc" uri="http://www.xml-cml.org/semanticcomputation" />
-		<queryNS prefix="semf" uri="http://www.xml-cml.org/semanticforcefields" />
-		<queryNS prefix="cml" uri="http://www.xml-cml.org/schema" />
-		<queryNS prefix="m" uri="http://www.w3.org/1998/Math/MathML" />
-		<queryNS prefix="cmlx" uri="http://www.xml-cml.org/schema/cmlx" />
-	</queryNSList>
-	<keyValueList>
-		<keyValue key="all" value="/*" />
-		<keyValue key="main" value="src/main/resources" />
-		<keyValue key="mainCml" value="src/main/resources/org/xmlcml/cml" />
-		<keyValue key="test" value="src/test/resources" />
-		<keyValue key="testOut" value="target" />
-		<keyValue key="molDir" value="src/test/resources/molecules" />
-		<keyValue key="out" value="output" />
-		<keyValue key="mol" value="//cml:molecule[@id='karplus1']" />
-	</keyValueList>
-	<writer xpath="/*" file="target/compoundOut.xml" />
-	<molecule xmlns="http://www.xml-cml.org/schema" id="mol"
-		hrefSource="src/test/resources/molecules/ClCCF.cml">
-		<atomArray>
-			<atom id="a1" elementType="C" x3="-2.033178" y3="1.612364" z3="-0.007709" />
-			<atom id="a2" elementType="C" x3="-0.574448" y3="0.979605" z3="-0.117286" />
-			<atom id="a3" elementType="H" x3="-2.171918" y3="2.380359" z3="0.746261" />
-			<atom id="a4" elementType="F" x3="-2.990196" y3="0.6685" z3="0.19818" />
-			<atom id="a5" elementType="H" x3="-2.337508" y3="2.111913" z3="-0.960451" />
-			<atom id="a6" elementType="Cl" x3="0.076343" y3="0.177568" z3="1.361195" />
-			<atom id="a7" elementType="H" x3="0.19457" y3="1.74441" z3="-0.337749" />
-			<atom id="a8" elementType="H" x3="-0.470615" y3="0.219947" z3="-0.882438" />
-		</atomArray>
-		<bondArray>
-			<bond atomRefs2="a1 a2" order="1" />
-			<bond atomRefs2="a1 a3" order="1" />
-			<bond atomRefs2="a1 a4" order="1" />
-			<bond atomRefs2="a1 a5" order="1" />
-			<bond atomRefs2="a2 a6" order="1" />
-			<bond atomRefs2="a2 a7" order="1" />
-			<bond atomRefs2="a2 a8" order="1" />
-		</bondArray>
-	</molecule>
-	<writer xpath="/*" file="target/compoundOut1.xml" />
-	<moleculeTool method="getOrCreateTorsions" xpath="//cml:molecule[@id='karplus1']"
-		setId="createdTorsions" />
-	<writer xpath="/*" file="output/karplusStart.cml" />
-</computation>

bin/org/xmlcml/declaratron/core/semantic/compound/fullDoc.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation xmlns="http://www.xml-cml.org/semanticcomputation"
-    xmlns:cml="http://www.xml-cml.org/schema">
-    <classNamespace href="src/main/resources/org/xmlcml/semantic/visitors/classList.xml"/>
-
-	<queryNSList>
-		<queryNS prefix="semc" uri="http://www.xml-cml.org/semanticcomputation" />
-		<queryNS prefix="m" uri="http://www.w3.org/1998/Math/MathML" />
-	</queryNSList>
-
-	<keyValueList>
-		<keyValue key="all" value="/*" />
-		<keyValue key="main" value="src/main/resources" />
-		<keyValue key="mainCml" value="${main}/org/xmlcml/cml" />
-		<keyValue key="test" value="src/test/resources" />
-		<keyValue key="testOut" value="target" />
-		<keyValue key="molDir" value="${test}/molecules" />
-		<keyValue key="out" value="output" />
-		<keyValue key="mol" value="//cml:molecule[@id='karplus1']" />
-	</keyValueList>
-
-	<writer xpath="${all}" file="${testOut}/compoundOut.xml" />
-	<cml:molecule id="mol" href="${molDir}/ClCCF.cml" />
-	<writer xpath="${all}" file="${testOut}/compoundOut1.xml" />
-	<moleculeTool method="getOrCreateTorsions" xpath="${mol}" setId="createdTorsions" />
-
-	<writer xpath="${all}" file="${out}/karplusStart.cml" />
-
-</computation>

bin/org/xmlcml/declaratron/core/semantic/curve.xml

-<math display="block" xmlns="http://www.w3.org/1998/Math/MathML">
-		<apply>
-		    <times/>
-			<apply>
-				<selector />
-				<ci type="vector">R1</ci>
-				<ci>x</ci>
-			</apply>
-			<apply>
-				<selector />
-				<ci type="vector">R2</ci>
-				<ci>x</ci>
-			</apply>
-		</apply>
-</math>

bin/org/xmlcml/declaratron/core/semantic/href/ab.xml

-<a>
-	<b id="b1"/>
-	<b id="b2"/>
-</a>

bin/org/xmlcml/declaratron/core/semantic/href/abc.xml

-<a>
-	<b id="b1">
-		<c id="c11" />
-		<c id="c12" />
-	</b>
-	<b id="b2">
-		<c id="c21"/>
-		<c id="c22"/>
-	</b>
-</a>

bin/org/xmlcml/declaratron/core/semantic/href/abcdx.xml

-<a>
-	<b id="b1">
-		<c id="c11" />
-		<c id="c12" />
-		<x />
-	</b>
-	<b id="b2">
-		<c id="c21">
-			<d id="d211" />
-			<x />
-		</c>
-		<c id="c22">
-			<d id="d221">
-				<x />
-			</d>
-			<d id="d222" />
-		</c>
-	</b>
-</a>

bin/org/xmlcml/declaratron/core/semantic/href/href0.xml

-<bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>

bin/org/xmlcml/declaratron/core/semantic/href/href00out.xml

-<a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-<b id="b1" />
-<b id="b2" />
-</a>

bin/org/xmlcml/declaratron/core/semantic/href/href0out.xml

-<a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-	<b id="b1" />
-	<b id="b2" />
-</a>

bin/org/xmlcml/declaratron/core/semantic/href/href1.xml

-<foo>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href1dout.xml

-<foo>
-	<a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-		<b id="b1" />
-		<b id="b2" />
-	</a>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href1out.xml

-<foo>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href2.xml

-<foo>
-    <xyzzy href="src/test/resources/org/xmlcml/semantic/href/abc.xml"/>
-    <plugh/>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href2dout.xml

-<foo>
-	<a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-		<b id="b1">
-			<c id="c11" />
-			<c id="c12" />
-		</b>
-		<b id="b2">
-			<c id="c21" />
-			<c id="c22" />
-		</b>
-	</a>
-	<plugh />
-	<a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-		<b id="b1" />
-		<b id="b2" />
-	</a>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href2out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-  <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-    <b id="b1">
-      <c id="c11"/>
-      <c id="c12"/>
-    </b>
-    <b id="b2">
-      <c id="c21"/>
-      <c id="c22"/>
-    </b>
-  </a>
-  <plugh/>
-  <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-    <b id="b1"/>
-    <b id="b2"/>
-  </a>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href3.xml

-<foo>
-    <xyzzy href="src/test/resources/org/xmlcml/semantic/href/abc.xml"/>
-    <plugh/>
-    <zork href="src/test/resources/org/xmlcml/semantic/href/doesNotExist.xml"/>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/href3out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-  <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-    <b id="b1">
-      <c id="c11"/>
-      <c id="c12"/>
-    </b>
-    <b id="b2">
-      <c id="c21"/>
-      <c id="c22"/>
-    </b>
-  </a>
-  <plugh/>
-  <zork href="src/test/resources/org/xmlcml/semantic/href/doesNotExist.xml"/>
-  <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-    <b id="b1"/>
-    <b id="b2"/>
-  </a>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/hrefRecurse3.xml

-<foo>
-    <xyzzy href="src/test/resources/org/xmlcml/semantic/href/href1.xml"/>
-    <plugh/>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/hrefRepeat.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/hrefRecurse3out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-  <foo hrefSource="src/test/resources/org/xmlcml/semantic/href/href1.xml">
-    <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-      <b id="b1"/>
-      <b id="b2"/>
-    </a>
-  </foo>
-  <plugh/>
-  <foo hrefSource="src/test/resources/org/xmlcml/semantic/href/hrefRepeat.xml">
-    <foo hrefSource="src/test/resources/org/xmlcml/semantic/href/href1.xml">
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-        <b id="b1"/>
-        <b id="b2"/>
-      </a>
-    </foo>
-    <plugh/>
-    <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-      <b id="b1"/>
-      <b id="b2"/>
-    </a>
-  </foo>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/hrefRepeat.xml

-<foo>
-    <xyzzy href="src/test/resources/org/xmlcml/semantic/href/href1.xml"/>
-    <plugh/>
-    <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/href/hrefRepeat1out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<foo>
-  <foo hrefSource="src/test/resources/org/xmlcml/semantic/href/href1.xml">
-    <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-      <b id="b1"/>
-      <b id="b2"/>
-    </a>
-  </foo>
-  <plugh/>
-  <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-    <b id="b1"/>
-    <b id="b2"/>
-  </a>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDoc.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation>
-	<keyValueList>
-		<keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic" />
-		<keyValue key="keyvalDir" value="${topDir}/keyValue" />
-		<keyValue key="hrefDir" value="${topDir}/href" />
-		<keyValue key="doc1" value="${keyvalDir}/doc1.xml" />
-		<keyValue key="doc2" value="${keyvalDir}/doc2.xml" />
-	</keyValueList>
-	<docList>
-		<doc id="d1" href="${doc1}" />
-		<doc id="d2" href="${doc2}" />
-	</docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDocOut.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation>
-  <keyValueList>
-    <keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic"/>
-    <keyValue key="keyvalDir" value="src/test/resources/org/xmlcml/semantic/keyValue"/>
-    <keyValue key="hrefDir" value="src/test/resources/org/xmlcml/semantic/href"/>
-    <keyValue key="doc1" value="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml"/>
-    <keyValue key="doc2" value="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml"/>
-  </keyValueList>
-  <docList>
-    <doc id="d1" href="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml"/>
-    <doc id="d2" href="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml"/>
-  </docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDocOut0.xml

-<computation>
-	<keyValueList>
-		<keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic" />
-		<keyValue key="keyvalDir"
-			value="src/test/resources/org/xmlcml/semantic/keyValue" />
-		<keyValue key="hrefDir" value="src/test/resources/org/xmlcml/semantic/href" />
-		<keyValue key="doc1"
-			value="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml" />
-		<keyValue key="doc2"
-			value="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml" />
-	</keyValueList>
-	<docList>
-		<doc id="d1" href="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml" />
-		<doc id="d2" href="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml" />
-	</docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDocOut1.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation>
-  <keyValueList>
-    <keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic"/>
-    <keyValue key="keyvalDir" value="src/test/resources/org/xmlcml/semantic/keyValue"/>
-    <keyValue key="hrefDir" value="src/test/resources/org/xmlcml/semantic/href"/>
-    <keyValue key="doc1" value="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml"/>
-    <keyValue key="doc2" value="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml"/>
-  </keyValueList>
-  <docList>
-    <foo id="d1" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml">
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-        <b id="b1">
-          <c id="c11"/>
-          <c id="c12"/>
-        </b>
-        <b id="b2">
-          <c id="c21"/>
-          <c id="c22"/>
-        </b>
-      </a>
-      <plugh/>
-      <bar href="${hrefDir}/ab.xml"/>
-    </foo>
-    <foo id="d2" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml">
-      <xyzzy href="${hrefDir}/abc.xml"/>
-      <plugh/>
-      <bar href="${hrefDir}/ab.xml"/>
-    </foo>
-  </docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDocOut2.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation>
-  <keyValueList>
-    <keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic"/>
-    <keyValue key="keyvalDir" value="src/test/resources/org/xmlcml/semantic/keyValue"/>
-    <keyValue key="hrefDir" value="src/test/resources/org/xmlcml/semantic/href"/>
-    <keyValue key="doc1" value="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml"/>
-    <keyValue key="doc2" value="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml"/>
-  </keyValueList>
-  <docList>
-    <foo id="d1" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml">
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-        <b id="b1">
-          <c id="c11"/>
-          <c id="c12"/>
-        </b>
-        <b id="b2">
-          <c id="c21"/>
-          <c id="c22"/>
-        </b>
-      </a>
-      <plugh/>
-      <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-    </foo>
-    <foo id="d2" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml">
-      <xyzzy href="src/test/resources/org/xmlcml/semantic/href/abc.xml"/>
-      <plugh/>
-      <bar href="src/test/resources/org/xmlcml/semantic/href/ab.xml"/>
-    </foo>
-  </docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/combinedDocOut3.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<computation>
-  <keyValueList>
-    <keyValue key="topDir" value="src/test/resources/org/xmlcml/semantic"/>
-    <keyValue key="keyvalDir" value="src/test/resources/org/xmlcml/semantic/keyValue"/>
-    <keyValue key="hrefDir" value="src/test/resources/org/xmlcml/semantic/href"/>
-    <keyValue key="doc1" value="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml"/>
-    <keyValue key="doc2" value="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml"/>
-  </keyValueList>
-  <docList>
-    <foo id="d1" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc1.xml">
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-        <b id="b1">
-          <c id="c11"/>
-          <c id="c12"/>
-        </b>
-        <b id="b2">
-          <c id="c21"/>
-          <c id="c22"/>
-        </b>
-      </a>
-      <plugh/>
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-        <b id="b1"/>
-        <b id="b2"/>
-      </a>
-    </foo>
-    <foo id="d2" hrefSource="src/test/resources/org/xmlcml/semantic/keyValue/doc2.xml">
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/abc.xml">
-        <b id="b1">
-          <c id="c11"/>
-          <c id="c12"/>
-        </b>
-        <b id="b2">
-          <c id="c21"/>
-          <c id="c22"/>
-        </b>
-      </a>
-      <plugh/>
-      <a hrefSource="src/test/resources/org/xmlcml/semantic/href/ab.xml">
-        <b id="b1"/>
-        <b id="b2"/>
-      </a>
-    </foo>
-  </docList>
-</computation>

bin/org/xmlcml/declaratron/core/semantic/keyValue/doc1.xml

-<foo>
-    <xyzzy href="src/test/resources/org/xmlcml/semantic/href/abc.xml"/>
-    <plugh/>
-    <bar href="${hrefDir}/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/doc2.xml

-<foo>
-    <xyzzy href="${hrefDir}/abc.xml"/>
-    <plugh/>
-    <bar href="${hrefDir}/ab.xml"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/docWithKeyValue.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<doc>
-<keyValueList>
-  <keyValue key="k1" value="v1"/>
-  <keyValue key="k2" value="v2"/>
-  <keyValue key="k12" value="junk v1 and v2 grot"/>
-  <keyValue key="k3" value="junk junk v1 and v2 grot"/>
-</keyValueList>
-<para>
-  <p class="${k1}">This is a doc with ${k3} and ${k2} as well as ${k12}.</p>
-</para>
-</doc>

bin/org/xmlcml/declaratron/core/semantic/keyValue/docWithKeyValueOut.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<doc>
-  <keyValueList>
-    <keyValue key="k1" value="v1"/>
-    <keyValue key="k2" value="v2"/>
-    <keyValue key="k12" value="junk v1 and v2 grot"/>
-    <keyValue key="k3" value="junk junk v1 and v2 grot"/>
-  </keyValueList>
-  <para>
-    <p class="v1">This is a doc with junk junk v1 and v2 grot and v2 as well as junk v1 and v2 grot.</p>
-  </para>
-</doc>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValue0.xml

-<foo att1="${k1}and${k2}">
-  <bar att="junk1 ${k1} grot"/>
-  <bar att="junk2 ${k2} grot"/>
-  <bar att="junk ${k1} junk2 ${k2} grot" zz="junk2 ${k2} ${k1} ${k2}${k2} grot"/>
-  <content>this is ${k1} and ${k3}</content>
-  <bar key="key attributes are omitted ${k2} remains"/>
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValue1out.xml

-<foo att1="v1andv2">
-	<bar att="junk1 ${k1} grot" />
-	<bar att="junk2 ${k2} grot" />
-	<bar att="junk ${k1} junk2 ${k2} grot" zz="junk2 ${k2} ${k1} ${k2}${k2} grot" />
-	<content>this is ${k1} and ${k3}</content>
-	<bar key="key attributes are omitted ${k2} remains" />
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValue1out1.xml

-<foo att1="v1andv2">
-	<bar att="junk1 v1 grot" />
-	<bar att="junk2 v2 grot" />
-	<bar att="junk v1 junk2 v2 grot" zz="junk2 v2 v1 v2v2 grot" />
-	<content>this is v1 and ${k3}</content>
-	<bar key="key attributes are omitted v2 remains" />
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValue1out2.xml

-<foo att1="${k1}and${k2}">
-	<bar att="junk1 v1 grot" />
-	<bar att="junk2 v2 grot" />
-	<bar att="junk v1 junk2 v2 grot" zz="junk2 v2 v1 v2v2 grot" />
-	<content>this is v1 and ${k3}</content>
-	<bar key="key attributes are omitted v2 remains" />
-</foo>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValueMap0.xml

-<keyValueList>
-	<keyValue key="k1" value="v1" />
-	<keyValue key="k2" value="v2" />
-</keyValueList>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValueMap1.xml

-<keyValueList>
-	<keyValue key="k1" value="v1" />
-	<keyValue key="k2" value="v2" />
-	<keyValue key="k12" value="junk ${k1} and ${k2} grot" />
-	<keyValue key="k3" value="junk ${k12}" />
-</keyValueList>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValueMap1out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<keyValueList>
-  <keyValue key="k1" value="v1"/>
-  <keyValue key="k2" value="v2"/>
-  <keyValue key="k12" value="junk v1 and v2 grot"/>
-  <keyValue key="k3" value="junk junk v1 and v2 grot"/>
-</keyValueList>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValueMap2.xml

-<keyValueList>
-	<keyValue key="k3" value="junk ${k12}" />
-	<keyValue key="k12" value="junk ${k1} and ${k2} grot" />
-	<keyValue key="k1" value="v1" />
-	<keyValue key="k2" value="v2" />
-</keyValueList>

bin/org/xmlcml/declaratron/core/semantic/keyValue/keyValueMap2out.xml

-<?xml version="1.0" encoding="UTF-8"?>
-<keyValueList>
-  <keyValue key="k3" value="junk junk v1 and v2 grot"/>
-  <keyValue key="k12" value="junk v1 and v2 grot"/>
-  <keyValue key="k1" value="v1"/>
-  <keyValue key="k2" value="v2"/>
-</keyValueList>

bin/org/xmlcml/declaratron/core/semantic/visitors/AbstractElementVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/ClassNamespaceVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/EditorVisitable.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/Executable.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/ExecutableVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/HREFVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/InitialVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/KeyValueElement.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/KeyValueListVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/KeyValueVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/NodeVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/ShowTreeVisitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/TreeVisit.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/Visitor.class

Binary file removed.

bin/org/xmlcml/declaratron/core/semantic/visitors/VisitorListVisitor.class

Binary file removed.

bin/semantic/visitors/classList.xml

-<classList>
-	<class tag="assert"          namespace="" name="org.xmlcml.semantic.SCAssert" 
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<class tag="href"            name="org.xmlcml.semantic.visitors.HREFVisitor" 
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<class tag="keyValue"        name="org.xmlcml.semantic.visitors.KeyValueElement"   
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<class tag="keyValueVisitor" name="org.xmlcml.semantic.visitors.KeyValueVisitor" 
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<class tag="writer"          name="org.xmlcml.semantic.XMLWriter" 
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<class tag="editor"          name="org.xmlcml.semantic.visitors.EditorVisitable" 
-	                                 uri="http://www.xml-cml.org/semanticcomputation"/>
-	<classList href="src/main/resources/org/xmlcml/cml/chemistry/classList.xml"/>
-</classList>
 <?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+<project 
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 
+   xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <modelVersion>4.0.0</modelVersion>
-
+    
     <parent>
         <groupId>cml</groupId>
         <artifactId>declaratron-top</artifactId>
     <packaging>jar</packaging>
     <name>declaratron-core</name>
 
-
+<!-- 
 	<build>
 		<plugins>
 			<plugin>
 			</plugin>
 		</plugins>
 	</build>
-
-    <dependencyManagement>
+-->
+<!--     <dependencyManagement>  -->
         <dependencies>
             <dependency>
                 <groupId>${jumbo.groupId}</groupId>
                 <version>1.8.0</version>
             </dependency>
         </dependencies>
-    </dependencyManagement>
+<!--     </dependencyManagement>  -->
 
 </project>
 

src/main/java/org/xmlcml/declaratron/core/AbstractExecutableElement.java

+package org.xmlcml.declaratron.core;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import nu.xom.Element;
+import nu.xom.Nodes;
+import nu.xom.XPathContext;
+
+import org.apache.log4j.Logger;
+import org.xmlcml.cml.base.CMLConstants;
+
+
+public abstract class AbstractExecutableElement extends Element
+{
+
+	/** attribute names */
+	public static final String ARGS     = "args";
+	public static final String FILE     = "file";
+	public static final String FROM     = "from";
+	public static final String HREF     = "href";
+	public static final String ID       = "id";
+	public static final String METHOD   = "method";
+	public static final String JOIN     = "join";
+	public static final String KEY      = "key";
+	public static final String REQUIRED = "required";
+	public static final String SET_ID   = "setId";
+	public static final String USING    = "using";
+	public static final String VALUE    = "value";
+	public static final String XPATH    = "xpath";
+	
+	protected Logger log = Logger.getLogger( getClass() );
+
+	/** attributes */
+	protected String[] args;
+	protected String file;
+	protected String from;
+	protected String href;
+	protected String join;
+	protected String key;
+	protected String method;
+	protected String setId;
+	protected String using;
+	protected String value;
+	protected String xpath;
+
+	protected Element result;
+	
+	public abstract Element runTreeVisit();
+	public AbstractExecutableElement( Element e , String tag)
+	{
+		super( e.getLocalName(), e.getNamespaceURI() );
+		if (!e.getLocalName().equals(tag)) {
+			throw new RuntimeException("expected element name: "+tag+", found "+e.getLocalName());
+		}
+		NodeUtils.copyAttributes( e, this );
+		NodeUtils.moveChildren(e, this);
+		log.trace("created "+this.toXML());
+	}
+
+	protected <T> T getSingleElementWithNamespaces( String query )
+	{
+		return (T) getSingleElementNS( this, query );
+	}
+	
+	public Nodes doQueryWithNamespaces( Element element, String query )
+	{
+		if (element == null) return null;
+		XPathContext xPathContext = getXPathContext();
+		if (xPathContext == null) {
+			return element.query(query);
+		} else {
+			return element.query( query, xPathContext );
+		}
+	}
+	
+	@SuppressWarnings("unchecked")
+	public <T> T getSingleElementNS( Element element, String query )
+	{
+		Nodes nodes = doQueryWithNamespaces( element, query );
+		log.trace("Getting single element with query: " + query + " on element: " + element +" => "+nodes.size()+" nodes");
+		if( nodes.size() == 1 )
+		{
+			return (T) nodes.get( 0 );
+		}
+		else
+		{
+			log.error("Whole tree was: " + ((Element)element.query("/*").get( 0 )).toXML() );
+			log.error("Couldn't find single element with query: " + query + " got " + nodes.size() + " nodes");
+		}
+		return null;
+	}
+	
+
+	
+	@SuppressWarnings("unchecked")
+	public <T> List<T> queryElementsNS( Element element, String query )
+	{
+		Nodes nodes = doQueryWithNamespaces( element, query );
+		List<T> elements = new ArrayList<T>(nodes.size());
+		for( int i = 0; i < nodes.size(); i++ ) elements.add( (T) nodes.get(i));
+		return elements;
+	}
+	
+	public Computation getComputationalContext()
+	{
+		log.trace("Parent/elem "+this.getParent()+" / "+this.getLocalName());
+		Element element = (Element) query("/*").get( 0 );
+		return element instanceof Computation ? (Computation) element : null;
+	}
+	
+	public <T> List<T> queryElementsNS( String query )
+	{
+		return queryElementsNS( this, query );
+	}
+
+	/** ========== attributes processing and specific attributes ========== */
+	
+	private String getAttributeValue(String attName, boolean failOnError) {
+		String attValue = getAttributeValue( attName);
+		failOnError(attName, failOnError, attValue);
+		return attValue;
+	}
+	
+	private static void failOnError(String attName, boolean failOnError, String attValue) {
+		if (attValue == null && failOnError) {
+			throw new RuntimeException("Must give attribute "+attName);
+		}
+	}
+	
+	protected Integer getIntegerAttributeValue(String attName) {
+		Integer i = null;
+		try {
+			String s = getAttributeValue(attName);
+			i = new Integer(s);
+		} catch (Exception e) {
+//			throw new RuntimeException("Cannot find/parse integer attribute: "+attName);
+		}
+		return i;
+	}
+	
+	protected Double getDoubleAttributeValue(String attName) {
+		Double d = null;
+		try {
+			String s = getAttributeValue(attName);
+			d = new Double(s);
+		} catch (Exception e) {
+//			throw new RuntimeException("Cannot find/parse double attribute: "+attName);
+		}
+		return d;
+	}
+	
+	public String resolveVariables(String string) {
+		log.trace(""+this.toXML());
+		Computation computation = getComputationalContext();
+		return (computation == null) ? string : computation.resolveVariables(string);
+	}
+	
+	public String getVariable(String key) {
+		return getComputationalContext().getVariable(key);
+	}
+	
+	public void setVariable(String key, String value) {
+		getComputationalContext().setVariable(key, value);
+	}
+
+	protected String[] getArgs(boolean failOnError) {
+		String argString = getAttributeValue( ARGS, failOnError );
+		argString = resolveVariables(argString);
+		return args = (argString == null) ? new String[0] : argString.split(CMLConstants.S_WHITEREGEX);
+	}
+	
+	protected String getFile( boolean failOnError) {
+		return file = resolveVariables(getAttributeValue(FILE, failOnError));
+	}
+	
+	protected String getFrom( boolean failOnError) {
+		return from = resolveVariables(getAttributeValue(FROM, failOnError));
+	}
+	
+	protected String getHref(boolean failOnError) {
+		return this.getHref(this, failOnError);
+	}
+	
+	protected String getHref(Element elementWithHref, boolean failOnError) {
+		return AbstractExecutableElement.getHref(elementWithHref, this.getComputationalContext(), failOnError);
+	}
+	
+	public static String getHref(Element elementWithHref, Computation computationRoot, boolean failOnError) {
+		String href = elementWithHref.getAttributeValue(HREF);
+		href = (computationRoot == null) ? href : computationRoot.resolveVariables(href);
+		AbstractExecutableElement.failOnError(HREF, failOnError, href);
+		return href;
+	}
+	
+	protected String getJoin(boolean failOnError) {
+		return join = resolveVariables(getAttributeValue(JOIN, failOnError));
+	}
+	
+	protected String getKey(boolean failOnError) {
+		return key = resolveVariables(getAttributeValue(KEY, failOnError));
+	}
+	
+	protected String getMethod(boolean failOnError) {
+		return method = resolveVariables(getAttributeValue( METHOD, failOnError ));
+	}
+	
+	protected String getSetId( ) {
+		return setId = resolveVariables(getAttributeValue(SET_ID, false));
+	}
+	
+	protected String getId() {
+		return getAttributeValue(ID);
+	}
+
+	protected String getUsing( boolean failOnError) {
+		return using = getAttributeValue(USING, failOnError);
+	}
+	
+	protected String getValue(boolean failOnError) {
+		return value = resolveVariables(getAttributeValue(VALUE, failOnError));
+	}
+
+	protected String getXpath() {
+		return getXpath(true);
+	}
+	
+	protected String getXpath( boolean failOnError) {
+		return xpath = resolveVariables(getAttributeValue(XPATH, failOnError));
+	}
+	
+	/** ================================================ */
+	
+	public XPathContext getXPathContext()
+	{
+		Computation computation = getComputationalContext();
+		return computation == null ? null : computation.getXPathContext();
+	}
+	
+}

src/main/java/org/xmlcml/declaratron/core/AssertVisitable.java

+package org.xmlcml.declaratron.core;
+
+import java.util.List;
+
+import nu.xom.Element;
+
+import org.xmlcml.cml.base.CMLElement;
+
+
+
+public class AssertVisitable extends AbstractExecutableElement
+{
+	public static final String TAG = "assert";
+	
+	private static final String COUNT = "count";
+	private static final String FILE = "file";
+	private static final String VALIDITY = "validity";
+	private static final String VALUE = "value";
+	
+	private Boolean validity;
+	private Integer count;
+	private String value;
+	private String file;
+	
+	public AssertVisitable( )
+	{
+		this( new Element(TAG));
+	}
+
+	public AssertVisitable( Element e )
+	{
+		super( e , TAG);
+		log.debug(e.toXML());
+	}
+
+	public Element runTreeVisit()
+	{
+		processAttributes();
+		if (xpath != null) {
+			String msg = null;
+			List<CMLElement> elements = queryElementsNS(xpath);
+			if (count != null) {
+				msg = assertCount(elements.size(), count);
+			} else if (file != null) {
+				msg = assertFile(elements, file);
+			} else if (file != null) {
+				msg = assertValue(elements, value);
+			}
+			if (msg != null) {
+				throw new RuntimeException("Failed assert: "+msg+" should be "+validity);
+			}
+		}
+		return result;
+
+	}
+
+	private String assertCount(int elementCount, Integer count) {
+		Boolean ok = validity == (elementCount == count);
+		return (ok) ? null : "failed: "+elementCount+" != "+count;
+	}
+
+	private String assertFile(List<CMLElement> elements, String file) {
+//		String elementValue = (elements.size() == 1) ? elements.get(0).getValue() : null;
+//		Boolean ok = validity == (value.equals(elementValue));
+//		return (ok) ? null : "failed: "+elements.size()+" => "+elementValue+" != "+value;
+		throw new RuntimeException("NYI");
+	}
+
+	private String assertValue(List<CMLElement> elements, String value) {
+		String elementValue = (elements.size() == 1) ? elements.get(0).getValue() : null;
+		Boolean ok = validity == (value.equals(elementValue));
+		return (ok) ? null : "failed: "+elements.size()+" => "+elementValue+" != "+value;
+	}
+
+	private void processAttributes() {
+		getXpath(true);
+		String s = getAttributeValue( VALIDITY );
+		validity = (s == null) ? true : Boolean.parseBoolean(s);
+		s = getAttributeValue( COUNT );
+		count = (s == null) ? null : Integer.parseInt(s);
+		value = getAttributeValue( VALUE );
+		file = getAttributeValue( FILE );
+	}
+}

src/main/java/org/xmlcml/declaratron/core/CMLClassVisitor.java

+package org.xmlcml.declaratron.core;
+
+import nu.xom.Element;
+
+import org.xmlcml.cml.base.CMLConstants;
+import org.xmlcml.cml.base.CMLElement;
+import org.xmlcml.declaratron.core.visitors.AbstractElementVisitor;
+
+public class CMLClassVisitor extends AbstractElementVisitor {
+	String namespace = CMLConstants.CML_NS;
+
+	public final static String TAG = "cmlClassVisitor";
+	
+	public CMLClassVisitor( ) {
+		this (new Element(TAG));
+	}
+	
+	public CMLClassVisitor( Element e )	{
+		super( e , TAG);
+	}
+
+	public Element visitElementWithoutDescent( Element e) {
+		visitedNodesList.add(e);
+		//If we're namespaced and it's wrong, do nothing
+		if( namespace != null && ! namespace.equals(e.getNamespaceURI())) return e;
+		if( e instanceof CMLElement ) return e;
+		try {
+			CMLElement newElement = CMLElement.createCMLElement( e );
+			NodeUtils.copyAttributes( e, newElement );
+			changedNodesList.add(e);
+			return newElement;
+		} catch( Exception ex )	{
+			failedNodesList.add(e);
+			log.fatal("Couldn't make CML element: " + e.toXML(), ex );
+		}
+		return e;
+	}
+}

src/main/java/org/xmlcml/declaratron/core/Computation.java

+package org.xmlcml.declaratron.core;
+
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import nu.xom.Attribute;
+import nu.xom.Element;
+import nu.xom.Node;
+import nu.xom.Nodes;
+import nu.xom.XPathContext;
+
+import org.apache.log4j.Logger;
+import org.xmlcml.declaratron.core.visitors.AbstractElementVisitor;
+import org.xmlcml.declaratron.core.visitors.ClassNamespaceVisitor;
+import org.xmlcml.declaratron.core.visitors.InitialVisitor;
+import org.xmlcml.declaratron.core.visitors.KeyValueElement;
+
+/**
+ * Top level object/element in any computation
+ * <semc:computation> is analogous to <svg:svg>, <cml:cml> or <h:html>
+ * Designers and users can insist on this being present and rely on access to its functions.
+ *
+ * It is primarily:
+ *  - a container for a (complete) problem
+ *  - a means of initiating a computation
+ *  
+ *  <computation> can process syntactic constructs (HREF/include, KeyValue substitution and
+ *  addition of classes). This may be initiated by default or it may be defined by some of the 
+ *  visitors explicit in the problem.
+ *  
+ *  Common containers include:
+ *   - keyvalue definitions
+ *   - namespace/prefix binding
+ *   - visitor collections
+ *   - visitable collections
+ * 
+ * @author Dave Murray-Rust <dave@mo-seph.com>
+ * @author Peter Murray-Rust <pm286@cam.ac.uk>
+ *
+ */
+public class Computation extends Element
+{
+
+	private static final String SEM_PREFIX = "semc";
+	private static final String KEY_VALUE_LIST = SEM_PREFIX+":keyValueList";
+	private static final String KEY_VALUES = KEY_VALUE_LIST+"/"+SEM_PREFIX+":keyValue";
+	private static final String SEM_VISITOR_LIST = "//"+SEM_PREFIX+":visitorList";
+	private static final String VISITORS = SEM_VISITOR_LIST+"/"+SEM_PREFIX+":visitor";
+	private static final String CLASS = "class";
+	/** start and end of variable references */
+	private static final String VAR_REF_START_ESC = "\\$\\{";
+	private static final String VAR_REF_END_ESC = "\\}";
+	
+	private static final String KEY = "key";
+	private static final String VALUE = "value";
+
+	Logger log = Logger.getLogger( getClass() );
+
+	public static final String SEMANTIC_NS = "http://www.xml-cml.org/semanticcomputation";
+	public static final String QUERY_NS_ELEMENT = SEM_PREFIX+":queryNSList/"+SEM_PREFIX+":queryNS";
+	
+	XPathContext xpathContext = new XPathContext();
+	
+	public Computation( String url )
+	{
+		this(NodeUtils.getElementFromURL( url ));
+	}
+	
+	public Computation( Element element )
+	{
+		super( element );
+		NodeUtils.copyAttributes( element, this );
+		runSyntacticMethods();
+	}
+
+	private void runSyntacticMethods() {
+		buildClassNamespaces();
+		buildXPathContext();
+		runInitialVisitor();
+	}
+
+//	public void compute()
+//	{
+//		log.info( "Running Computation!" );
+//		Elements childElements = getChildElements();
+//		for( int i = 0; i < childElements.size(); i++ ) {
+//			Element elem = childElements.get(i);
+//			if( elem instanceof AbstractComputationalElement )
+//			{
+//				log.info( "Running computational element: " + elem.getClass().getSimpleName() );
+//				AbstractComputationalElement comp = (AbstractComputationalElement) elem;
+//				comp.compute();
+//			}
+//		}
+//
+//	}
+
+	public void runVisitors() {
+		System.err.println("RUN OTHER VISTORS NYI");
+	}
+
+	public void runInitialVisitorsOld()
+	{
+		Nodes nodes = query( VISITORS, new XPathContext(SEM_PREFIX, SEMANTIC_NS ) );
+		log.debug("Running initial visitors: " + nodes.size());
+		for( int i = 0; i < nodes.size(); i++ )
+		{
+			Node n = nodes.get(i);
+			Element e = (Element)n;
+			String classname = e.getAttributeValue( CLASS );
+			try
+			{
+				AbstractElementVisitor visitor = (AbstractElementVisitor) Class.forName( classname ).getConstructor( Element.class ).newInstance( e );
+				NodeUtils.copyAttributes( e, visitor );
+				e.getParent().replaceChild( e, visitor );
+				visitor.visitElement( this );
+			} catch (Exception e1)
+			{
+				log.error("Couldn't create/compute Visitor class for Element " + e.toXML() );
+				e1.printStackTrace();
+			}
+		}
+	}
+
+	public void runInitialVisitor()
+	{
+		InitialVisitor initialVisitor = new InitialVisitor();
+		initialVisitor.visitElement(this);
+	}
+
+	public void buildClassNamespaces()
+	{
+		Nodes nodes = this.query( SEM_PREFIX+":"+ClassNamespaceVisitor.CLASS_NAMESPACE, new XPathContext(SEM_PREFIX, SEMANTIC_NS) );
+		log.debug( "Building ClassNamespaces with "+nodes.size()+" namespaces" );
+		ClassNamespaceVisitor cnVisitor = new ClassNamespaceVisitor();
+		
+		for( int i = 0; i < nodes.size(); i++ )
+		{
+			Element e = (Element) nodes.get( i );
+			cnVisitor.addClasses(e);
+			
+		}
+	}
+	
+	public void buildXPathContext()
+	{
+		Nodes nodes = this.query( QUERY_NS_ELEMENT, new XPathContext(SEM_PREFIX, SEMANTIC_NS) );
+		log.debug( "Building XPath Context with "+nodes.size()+" namespaces" );
+		
+		for( int i = 0; i < nodes.size(); i++ )
+		{
+			Element e = (Element) nodes.get( i );
+			String prefix = e.getAttributeValue( "prefix" );
+			String uri = e.getAttributeValue( "uri" );
+			xpathContext.addNamespace( prefix, uri );
+			log.trace( "Added namespace prefix " + prefix + ": " + uri );
+		}
+	}
+	
+	public XPathContext getXPathContext()
+	{
+		return xpathContext;
+	}
+
+	public String resolveVariables(String value) {
+		if (value == null) return null;
+		Pattern pattern = Pattern.compile(VAR_REF_START_ESC+"[^"+VAR_REF_END_ESC+"]*"+VAR_REF_END_ESC);
+		Matcher matcher = pattern.matcher(value);
+		StringBuilder sb = new StringBuilder();
+		int last = 0;
+		while (matcher.find()) {
+			int start = matcher.start();
+			int end = matcher.end();
+			sb.append(value.substring(last, start));
+			String key = value.substring(start + 2, end-1);
+			String lookupValue = this.getVariable(key);
+			if (lookupValue == null) {
+				lookupValue = key+"=NULL";
+				throw new RuntimeException("failed: "+lookupValue);
+			}
+			sb.append(lookupValue);
+			last = end;
+		}
+		sb.append(value.substring(last));
+		return sb.toString();
+	}
+
+	private static void usage() 
+	{
+		System.err.println("Usage: ");
+		System.err.println("Args:  file or URL name for computation");
+	}
+	
+	public static void main( String[] args )
+	{
+		if (args.length == 1) {
+			Computation cc = new Computation( args[0] );
+			cc.runVisitors();
+		} else {
+			usage();
+		}
+	}
+
+	public void setVariable(String key, String value) {
+		Element keyValueElement = getKeyValueElement(key);
+		if (keyValueElement == null) {
+			keyValueElement = new KeyValueElement(new Element(KeyValueElement.TAG));
+			this.insertChild(keyValueElement, 0);
+		}
+		keyValueElement.addAttribute(new Attribute(KEY, key));
+		keyValueElement.addAttribute(new Attribute(KeyValueElement.VALUE, value));
+	}