diff --git a/lib/GoUldI b/lib/GoUldI
index cb3c00e3..f18ca809 160000
--- a/lib/GoUldI
+++ b/lib/GoUldI
@@ -1 +1 @@
-Subproject commit cb3c00e39c367043a23fb0f2e9ee7870f9c1d833
+Subproject commit f18ca809264d47badc2b0d78e1f80939dd873862
diff --git a/pomlp/pom.xml b/pomlp/pom.xml
index 75d99861..1a595356 100644
--- a/pomlp/pom.xml
+++ b/pomlp/pom.xml
@@ -110,7 +110,7 @@
1.0.0-SNAPSHOT
-
+
com.formulasearchengine
mathmltools
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathmltools/mml/elements/MathDocWrapper.java b/pomlp/src/main/java/com/formulasearchengine/mathmltools/mml/elements/MathDocWrapper.java
new file mode 100644
index 00000000..0e3f46a8
--- /dev/null
+++ b/pomlp/src/main/java/com/formulasearchengine/mathmltools/mml/elements/MathDocWrapper.java
@@ -0,0 +1,26 @@
+package com.formulasearchengine.mathmltools.mml.elements;
+
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.IOException;
+
+/**
+ * A wrapper for MathDoc from MathMLTools because of bad visibilities.
+ * @author Andre Greiner-Petter
+ */
+public class MathDocWrapper extends MathDoc {
+ public MathDocWrapper(String inputXMLString) throws ParserConfigurationException, SAXException, IOException {
+ super(inputXMLString);
+ }
+
+ @Override
+ public void changeTeXAnnotation(String newTeX){
+ super.changeTeXAnnotation(newTeX);
+ }
+
+ @Override
+ public void fixGoldCd(){
+ super.fixGoldCd();
+ }
+}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/GoldStandardLoader.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/GoldStandardLoader.java
index b20085ee..6184010a 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/GoldStandardLoader.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/GoldStandardLoader.java
@@ -1,8 +1,17 @@
package com.formulasearchengine.mathosphere.pomlp;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+
import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiBean;
import com.formulasearchengine.mathosphere.pomlp.util.GoldUtils;
+import com.formulasearchengine.mathosphere.pomlp.util.GouldiRegenerator;
import com.formulasearchengine.mathosphere.pomlp.util.config.ConfigLoader;
import com.formulasearchengine.mathosphere.pomlp.util.rest.GitHubFileResponse;
import com.formulasearchengine.mathosphere.pomlp.util.rest.RESTPathBuilder;
@@ -11,17 +20,8 @@
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
public class GoldStandardLoader {
- private static final Logger LOG = LogManager.getLogger( GoldStandardLoader.class.getName() );
+ private static final Logger LOG = LogManager.getLogger(GoldStandardLoader.class.getName());
// Time out is 5sec
public static final int CONN_TIME_OUT = 5 * 1000;
@@ -46,63 +46,63 @@ public class GoldStandardLoader {
private static JsonGouldiBean[] gouldi;
/**
- *
* @throws RuntimeException if the configurations cannot be loaded from config.properties
*/
- private GoldStandardLoader() {}
+ private GoldStandardLoader() {
+ }
private static final GoldStandardLoader loader = new GoldStandardLoader();
- public static GoldStandardLoader getInstance(){
+ public static GoldStandardLoader getInstance() {
return loader;
}
- public void init(){
+ public void init() {
props = ConfigLoader.CONFIG;
- max = Integer.parseInt(props.getProperty( ConfigLoader.GOULDI_MAXIMUM_NUM ));
+ max = Integer.parseInt(props.getProperty(ConfigLoader.GOULDI_MAXIMUM_NUM));
- String repo = props.getProperty( ConfigLoader.GITHUB_REPO_NAME );
- String owner = props.getProperty( ConfigLoader.GITHUB_REPO_OWNER );
- String path = props.getProperty( ConfigLoader.GITHUB_REPO_PATH );
- String githubLink = props.getProperty( ConfigLoader.GITHUB_URL );
+ String repo = props.getProperty(ConfigLoader.GITHUB_REPO_NAME);
+ String owner = props.getProperty(ConfigLoader.GITHUB_REPO_OWNER);
+ String path = props.getProperty(ConfigLoader.GITHUB_REPO_PATH);
+ String githubLink = props.getProperty(ConfigLoader.GITHUB_URL);
- if ( repo == null || owner == null || githubLink == null ){
+ if (repo == null || owner == null || githubLink == null) {
LOG.info("Cannot find GitHub access -> switch to local initialization.");
initLocally();
return;
}
LOG.debug("Load all github properties.");
- gitHubApiURL = new RESTPathBuilder( githubLink )
+ gitHubApiURL = new RESTPathBuilder(githubLink)
.setGithubContent(owner, repo)
.setInnerPath(path)
.getURL();
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
- factory.setConnectTimeout( CONN_TIME_OUT );
- factory.setReadTimeout( READ_TIME_OUT );
+ factory.setConnectTimeout(CONN_TIME_OUT);
+ factory.setReadTimeout(READ_TIME_OUT);
rest = new RestTemplate(factory);
}
public int initLocally() {
props = ConfigLoader.CONFIG;
- max = Integer.parseInt(props.getProperty( ConfigLoader.GOULDI_MAXIMUM_NUM ));
+ max = Integer.parseInt(props.getProperty(ConfigLoader.GOULDI_MAXIMUM_NUM));
- String goldPath = props.getProperty( ConfigLoader.GOULDI_LOCAL_PATH );
+ String goldPath = props.getProperty(ConfigLoader.GOULDI_LOCAL_PATH);
Path path = Paths.get(goldPath);
gouldi = new JsonGouldiBean[max];
- ExecutorService executor = Executors.newFixedThreadPool( Runtime.getRuntime().availableProcessors()*2 );
- for ( int i = 1; i <= max; i++ ){
- executor.execute( new JSONReader( path, i ) );
+ ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
+ for (int i = 1; i <= max; i++) {
+ executor.execute(new JSONReader(path, i));
}
executor.shutdown();
try {
- executor.awaitTermination( PARALLEL_READING_TIMEOUT, PARALLEL_READING_TIMEOUT_UNIT );
- } catch ( InterruptedException ie ){
+ executor.awaitTermination(PARALLEL_READING_TIMEOUT, PARALLEL_READING_TIMEOUT_UNIT);
+ } catch (InterruptedException ie) {
LOG.warn("Executor service exceeds timeouts to read files. It maybe didn't properly load all gouldi-files.");
}
@@ -111,12 +111,12 @@ public int initLocally() {
}
private class JSONReader implements Runnable {
- private final Logger IN_LOG = LogManager.getLogger( JSONReader.class.getName() );
+ private final Logger IN_LOG = LogManager.getLogger(JSONReader.class.getName());
private Path path;
private int number;
- public JSONReader( Path goldPath, int number ){
+ public JSONReader(Path goldPath, int number) {
this.path = goldPath;
this.number = number;
}
@@ -124,15 +124,15 @@ public JSONReader( Path goldPath, int number ){
@Override
public void run() {
try {
- Path p = path.resolve( number + ".json" );
- gouldi[number-1] = GoldUtils.readGoldFile(p);
- } catch ( Exception e ){
+ Path p = path.resolve(number + ".json");
+ gouldi[number - 1] = GoldUtils.readGoldFile(p);
+ } catch (Exception e) {
IN_LOG.error("Parallel process cannot parse " + path.toString() + number + ".json - " + e.getMessage(), e);
}
}
}
- public GitHubFileResponse getResponseFromGouldiRequest( int number ){
+ public GitHubFileResponse getResponseFromGouldiRequest(int number) {
String file = number + ".json";
return rest.getForObject(
gitHubApiURL + RESTPathBuilder.BIND + file,
@@ -140,21 +140,28 @@ public GitHubFileResponse getResponseFromGouldiRequest( int number ){
);
}
- public JsonGouldiBean getGouldiJson( int number )
- throws IOException
- {
- if ( local ) {
+ public JsonGouldiBean getGouldiJson(int number)
+ throws IOException {
+ if (local) {
LOG.trace("Local mode. Get Json: " + number);
- return gouldi[number-1];
+ return gouldi[number - 1];
}
- GitHubFileResponse response = getResponseFromGouldiRequest( number );
+ GitHubFileResponse response = getResponseFromGouldiRequest(number);
// TODO handle response codes here
return response.getJsonBeanFromContent();
}
- public static void main(String[] args){
- GoldStandardLoader gold = new GoldStandardLoader();
- gold.initLocally();
+ public static void main(String[] args) {
+ // TODO: DO NOT USE THIS MAIN, IF YOU DON'T KNOW WHAT YOU ARE DOING!
+ // it's just a main for manually executions and changes constantly
+
+ // regenerate all gold files once!
+ //String goldPath = ConfigLoader.CONFIG.getProperty(ConfigLoader.GOULDI_LOCAL_PATH);
+ //Path outputPath = Paths.get( goldPath );
+ Path outputPath = Paths.get("outputTmp");
+ GouldiRegenerator regenerator = new GouldiRegenerator(outputPath);
+ regenerator.init();
+ regenerator.regenerateAllMML();
}
}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/TreeFilesGenerator.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/TreeFilesGenerator.java
index ab0f63dc..46cf2847 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/TreeFilesGenerator.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/TreeFilesGenerator.java
@@ -83,46 +83,30 @@ public void generate( int number, Converters converter ) throws Exception{
* Generates all third party MMLs at once
*/
public void generateAllSubs(){
-// ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(16);
-
- // each number 1-300
for ( int i = 1; i <= maxNumber; i++ ){
try {
JsonGouldiBean bean = loader.getGouldiJson(i);
LOG.info("Start pre-processing of tex input.");
- bean.setMathTex( Utility.latexPreProcessing(bean.getOriginalTex()) );
- // each converter which is available
+ bean.setOriginalTex( Utility.latexPreProcessing(bean.getOriginalTex()) );
+ // use all available converters
for ( Converters c : Converters.values() ){
- final int index = i;
if (!c.skip()) {
-// executor.submit( () -> generate(index, bean, c) );
- generate(index, bean, c);
+ generate(i, bean, c);
}
}
} catch ( IOException e ){
LOG.error("SKIP: " + i, e);
}
}
-
-// LOG.info("Shutdown thread pool. All threads in queue.");
-// executor.shutdown();
-// LOG.info("Wait for termination now.");
-// try {
-// executor.awaitTermination( 10, TimeUnit.MINUTES );
-// LOG.info("Finished all threads in thread pool.");
-// } catch ( InterruptedException ie ){
-// LOG.error( "Waited 10 Minutes but still the thread pool is not terminated.", ie );
-// LOG.error( "Shutdown now!" );
-// executor.shutdownNow();
-// }
}
public static void main(String[] args) throws Exception{
+ // TODO: WILL GENERATE AND OVERWRITE ALL MML FILES BY THIRD PARTY TOOLS
+ // TODO: DO NOT START IF YOU DON'T KNOW WHAT YOU ARE DOING HERE!
preStartCommandCheck();
TreeFilesGenerator gen = new TreeFilesGenerator();
gen.init();
gen.generateAllSubs();
-
}
/**
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/LatexmlGenerator.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/LatexmlGenerator.java
index a55d5f02..726e5669 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/LatexmlGenerator.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/LatexmlGenerator.java
@@ -1,6 +1,6 @@
package com.formulasearchengine.mathosphere.pomlp.convertor;
-import com.formulasearchengine.mathmlconverters.latexml.LaTeXMLConverter;
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.xml.MathMLDocumentReader;
import com.formulasearchengine.nativetools.CommandExecutor;
import com.formulasearchengine.nativetools.NativeResponse;
@@ -11,50 +11,22 @@
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
+import static com.formulasearchengine.mathosphere.pomlp.util.config.LatexMLConfig.*;
+
public class LatexmlGenerator implements Parser, Canonicalizable{
private static Logger LOG = LogManager.getLogger(LatexmlGenerator.class.getName());
private static final String NAME = "LaTeXML";
- private static final String COMMAND = "latexmlc";
-
- private static final String[] DEFAULT_CMD = new String[]{
- COMMAND,
- "--includestyles",
- "--format=xhtml",
- "--whatsin=math",
- "--whatsout=math",
- "--pmml",
- "--cmml",
- "--nodefaultresources",
- "--linelength=90",
- "--preload", "LaTeX.pool",
- "--preload", "article.cls",
- "--preload", "amsmath.sty",
- "--preload", "amsthm.sty",
- "--preload", "amstext.sty",
- "--preload", "amssymb.sty",
- "--preload", "eucal.sty",
- "--preload", "[dvipsnames]xcolor.sty",
- "--preload", "url.sty",
- "--preload", "hyperref.sty",
- "--preload", "[ids]latexml.sty",
- "--preload", "texvc"
- };
- private LaTeXMLConverter converter;
private NativeResponse response;
public LatexmlGenerator(){}
@Override
- public void init() {
- // we only need latexmlc -> no configuration needed
- converter = new LaTeXMLConverter(null);
- }
+ public void init() {}
@Override
public Document parse(String latex) {
@@ -63,7 +35,7 @@ public Document parse(String latex) {
response = executor.exec( CommandExecutor.DEFAULT_TIMEOUT, Level.TRACE );
if ( handleResponseCode(response, NAME, LOG) != 0 ) return null;
LOG.info(NAME + " conversion successful.");
- return MathMLDocumentReader.getDocumentFromXMLString( response.getResult() );
+ return XmlDocumentReader.getDocumentFromXMLString( response.getResult() );
}
@Override
@@ -78,17 +50,17 @@ public void parseToFile(String latex, Path outputFile) {
@Override
public String getNativeCommand(){
- return COMMAND;
+ return NATIVE_COMMAND;
}
public ArrayList buildArguments(String latex ){
- ArrayList args = new ArrayList<>(Arrays.asList(DEFAULT_CMD));
+ ArrayList args = asList( GENERIC_CONFIG );
args.add( "literal:" + latex );
return args;
}
public List buildArguments(String latex, Path outputFile ){
- ArrayList args = new ArrayList<>(Arrays.asList(DEFAULT_CMD));
+ ArrayList args = asList( GENERIC_CONFIG );
args.add( "--dest=" + outputFile.toAbsolutePath().toString() );
args.add( "literal:" + latex );
return args;
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/MathToWebConverter.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/MathToWebConverter.java
index 87c4ee62..4d4f03e3 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/MathToWebConverter.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/MathToWebConverter.java
@@ -1,8 +1,7 @@
package com.formulasearchengine.mathosphere.pomlp.convertor;
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.util.Utility;
-import com.formulasearchengine.mathosphere.pomlp.xml.MathMLDocumentReader;
-import com.formulasearchengine.mathosphere.pomlp.xml.XmlDocumentReader;
import mathtoweb.engine.MathToWeb;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/NativeConverter.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/NativeConverter.java
index 1db81344..b46fa399 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/NativeConverter.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/NativeConverter.java
@@ -1,7 +1,7 @@
package com.formulasearchengine.mathosphere.pomlp.convertor;
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.util.Utility;
-import com.formulasearchengine.mathosphere.pomlp.xml.XmlDocumentReader;
import com.formulasearchengine.nativetools.CommandExecutor;
import com.formulasearchengine.nativetools.NativeResponse;
import org.apache.logging.log4j.LogManager;
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/POMConverter.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/POMConverter.java
index a8b2b5e1..6bc703db 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/POMConverter.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/POMConverter.java
@@ -1,8 +1,8 @@
package com.formulasearchengine.mathosphere.pomlp.convertor;
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.util.POMLoader;
import com.formulasearchengine.mathosphere.pomlp.xml.PomXmlWriter;
-import com.formulasearchengine.mathosphere.pomlp.xml.XmlDocumentReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
@@ -80,7 +80,9 @@ public Document parseLatexMathToDOM( String latex )
// create a builder to parse input stream to a document
LOG.trace("Create document builder factory");
- DocumentBuilderFactory factory = XmlDocumentReader.FACTORY;
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setIgnoringComments(true);
+ factory.setExpandEntityReferences(true);
DocumentBuilder builder = factory.newDocumentBuilder();
// First step, parse the mathematical expression
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/SnuggleTexConverter.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/SnuggleTexConverter.java
index a1cd158d..f19707b9 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/SnuggleTexConverter.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/convertor/SnuggleTexConverter.java
@@ -2,8 +2,6 @@
import com.formulasearchengine.mathosphere.pomlp.util.Constants;
import com.formulasearchengine.mathosphere.pomlp.util.Utility;
-import com.formulasearchengine.mathosphere.pomlp.xml.MathMLDocumentReader;
-import com.formulasearchengine.mathosphere.pomlp.xml.XmlDocumentReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document;
@@ -18,7 +16,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.List;
public class SnuggleTexConverter implements Parser, Canonicalizable {
@@ -51,7 +48,9 @@ public void init(){
options.setAddingMathSourceAnnotations(true);
options.addDOMPostProcessors(upProcessor);
- DocumentBuilderFactory factory = XmlDocumentReader.FACTORY;
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setIgnoringComments(true);
+ factory.setExpandEntityReferences(true);
try {
builder = factory.newDocumentBuilder();
} catch ( ParserConfigurationException pe ){
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiBean.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiBean.java
index 82c84c13..3591019b 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiBean.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiBean.java
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
@@ -18,6 +19,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+@SuppressWarnings( "unused" )
@JsonIgnoreProperties( ignoreUnknown = true )
@JsonPropertyOrder({
"definitions",
@@ -57,7 +59,7 @@ public class JsonGouldiBean {
private String mml;
@JsonProperty("constraints")
- private String[] constraints;
+ private List constraints;
@JsonProperty("comment")
private String comment;
@@ -68,13 +70,25 @@ public class JsonGouldiBean {
@JsonProperty("check")
private JsonGouldiCheckBean check;
+ // stores definitions -> ignore because the annotated functions should be used
+ // for serialization and deserialization
@JsonIgnore
private JsonGouldiDefinitionsBean definitionsBean;
+ // stores unknown properties
+ @JsonIgnore
+ private Map other = new HashMap<>();
+
+ // Just a default constructor
public JsonGouldiBean(){}
+ /**
+ * Provide a custom deserialization for definitions
+ * @param defs the generic object for definitions field in gouldi
+ */
+ @SuppressWarnings( "unchecked" ) // bla bla, we know what we are doing here...
@JsonProperty("definitions")
- private void unpackNested( Map defs ){
+ private void deserializeDefinitionsField( Map defs ){
definitionsBean = new JsonGouldiDefinitionsBean();
LinkedList list = new LinkedList<>();
definitionsBean.setIdentifierDefiniens(list);
@@ -114,18 +128,40 @@ public JsonGouldiDefinitionsBean getDefinitions(){
return definitionsBean;
}
- public void setDefinitions( JsonGouldiDefinitionsBean definitionsBean ){
- this.definitionsBean = definitionsBean;
+ @JsonAnyGetter
+ public Map getUnknownProperties() {
+ return other;
+ }
+
+ @JsonAnySetter
+ public void unknownPropertySet(String name, Object value) {
+ other.put(name, value);
+ }
+
+ /**
+ * Debugger function to find out if the current bean object has stored unknown properties.
+ * @return true if there are unknown properties in this object.
+ */
+ public boolean hasUnknowProperties() {
+ return !other.isEmpty();
}
public String getOriginalTex() {
return mathTex;
}
- public void setMathTex(String mathTex) {
+ public void setOriginalTex(String mathTex) {
this.mathTex = mathTex;
}
+ public String getSemanticTex() {
+ return mathTexSemantic;
+ }
+
+ public void setSemanticTex(String mathTexSemantic) {
+ this.mathTexSemantic = mathTexSemantic;
+ }
+
public String getTitle() {
return title;
}
@@ -134,11 +170,11 @@ public void setTitle(String title) {
this.title = title;
}
- public String getCorrectTex() {
+ public String getCorrectedTex() {
return correctTex;
}
- public void setCorrectTex(String correctTex) {
+ public void setCorrectedTex(String correctTex) {
this.correctTex = correctTex;
}
@@ -158,15 +194,11 @@ public void setMml(String mml) {
this.mml = mml;
}
- public String getMathTex() {
- return mathTex;
- }
-
- public String[] getConstraints() {
+ public List getConstraints() {
return constraints;
}
- public void setConstraints(String[] constraints) {
+ public void setConstraints(List constraints) {
this.constraints = constraints;
}
@@ -194,13 +226,12 @@ public void setCheck(JsonGouldiCheckBean check) {
this.check = check;
}
-
- public String getMathTexSemantic() {
- return mathTexSemantic;
+ public JsonGouldiDefinitionsBean getDefinitionsBean() {
+ return definitionsBean;
}
- public void setMathTexSemantic(String mathTexSemantic) {
- this.mathTexSemantic = mathTexSemantic;
+ public void setDefinitionsBean(JsonGouldiDefinitionsBean definitionsBean) {
+ this.definitionsBean = definitionsBean;
}
@Override
@@ -213,19 +244,4 @@ public String toString(){
return e.getMessage();
}
}
-
- @JsonIgnore
- private Map other = new HashMap<>();
- @JsonAnyGetter
- public Map any() {
- return other;
- }
-
- @JsonAnySetter
- public void set(String name, Object value) {
- other.put(name, value);
- }
- public boolean hasUnknowProperties() {
- return !other.isEmpty();
- }
}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiCheckBean.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiCheckBean.java
index 0351ef7b..40a77c24 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiCheckBean.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/gouldi/JsonGouldiCheckBean.java
@@ -9,24 +9,24 @@
@JsonPropertyOrder({"tree", "qid"})
public class JsonGouldiCheckBean {
@JsonProperty("tree")
- private boolean tree;
+ private Boolean tree;
@JsonProperty("qid")
- private boolean qid;
+ private Boolean qid;
- public boolean isTree() {
+ public Boolean isTree() {
return tree;
}
- public void setTree(boolean tree) {
+ public void setTree(Boolean tree) {
this.tree = tree;
}
- public boolean isQid() {
+ public Boolean isQid() {
return qid;
}
- public void setQid(boolean qid) {
+ public void setQid(Boolean qid) {
this.qid = qid;
}
}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GoldUtils.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GoldUtils.java
index 6f7d9829..c84fa2af 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GoldUtils.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GoldUtils.java
@@ -1,49 +1,61 @@
package com.formulasearchengine.mathosphere.pomlp.util;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiBean;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
+import java.io.BufferedWriter;
import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiBean;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
/**
* @author Andre Greiner-Petter
*/
public class GoldUtils {
- private static final Logger LOG = LogManager.getLogger( GoldUtils.class.getName() );
+ private static final Logger LOG = LogManager.getLogger(GoldUtils.class.getName());
/**
* Reads a gold file in json format from the given path. It will be stored as Java objects.
+ *
* @param pathToSingleGoldFile path to the json format gouldi entry
* @return java object representing the gouldi entry
* @throws IOException will be thrown if we cannot read from the file
*/
- public static JsonGouldiBean readGoldFile( Path pathToSingleGoldFile ) throws IOException {
+ public static JsonGouldiBean readGoldFile(Path pathToSingleGoldFile) throws IOException {
File f = pathToSingleGoldFile.toFile();
ObjectMapper mapper = new ObjectMapper();
- return mapper.readValue( f, JsonGouldiBean.class );
+ return mapper.readValue(f, JsonGouldiBean.class);
}
/**
* Writes a gouldi entry to the given path. Note that if the file already exists, it will be
* overwritten and logging a warning message.
+ *
* @param outputPath where the gouldi entry will be stored
- * @param goldEntry the gouldi entry as java object
+ * @param goldEntry the gouldi entry as java object
* @throws IOException
*/
- public static void writeGoldFile( Path outputPath, JsonGouldiBean goldEntry ) throws IOException{
- try { Files.createFile( outputPath ); }
- catch ( FileAlreadyExistsException e ){
- LOG.warn("File already exists!");
+ public static void writeGoldFile(Path outputPath, JsonGouldiBean goldEntry) {
+ try {
+ try {
+ Files.createFile(outputPath);
+ } catch (FileAlreadyExistsException e) {
+ LOG.warn("File already exists!");
+ }
+ try (Writer out = new BufferedWriter(new OutputStreamWriter(
+ new FileOutputStream(outputPath.toFile()), "UTF-8"))) {
+ out.write(goldEntry.toString());
+ }
+ } catch (IOException e) {
+ LOG.error(e);
+ throw new RuntimeException(e);
}
- ObjectMapper mapper = new ObjectMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- mapper.writeValue( outputPath.toFile(), goldEntry );
}
}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GouldiRegenerator.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GouldiRegenerator.java
new file mode 100644
index 00000000..d7ddec15
--- /dev/null
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/GouldiRegenerator.java
@@ -0,0 +1,111 @@
+package com.formulasearchengine.mathosphere.pomlp.util;
+
+import com.formulasearchengine.mathmltools.mml.elements.MathDoc;
+import com.formulasearchengine.mathmltools.mml.elements.MathDocWrapper;
+import com.formulasearchengine.mathosphere.pomlp.GoldStandardLoader;
+import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiBean;
+import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiCheckBean;
+import com.formulasearchengine.mathosphere.pomlp.util.config.ConfigLoader;
+import com.formulasearchengine.mathosphere.pomlp.util.config.LatexMLConfig;
+import com.formulasearchengine.nativetools.CommandExecutor;
+import com.formulasearchengine.nativetools.NativeResponse;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.LinkedList;
+import java.util.regex.Pattern;
+
+/**
+ * @author Andre Greiner-Petter
+ */
+public class GouldiRegenerator {
+
+ private static final Logger LOG = LogManager.getLogger(GouldiRegenerator.class.getName());
+
+ private Path outputPath;
+ private GoldStandardLoader loader;
+ private int max;
+ private LinkedList arguments;
+ private Path workingDir;
+
+ public GouldiRegenerator( Path outputPath ){
+ this.outputPath = outputPath;
+ this.loader = GoldStandardLoader.getInstance();
+ }
+
+ /**
+ * Will load all gold files to cache.
+ */
+ public void init(){
+ loader.initLocally();
+ String maxNumStr = ConfigLoader.CONFIG.getProperty( ConfigLoader.GOULDI_MAXIMUM_NUM );
+ max = Integer.parseInt( maxNumStr );
+ arguments = new LinkedList<>(LatexMLConfig.asList( LatexMLConfig.SEMANTIC_CONFIG ));
+
+ // TODO need a path to drmf folder to use macros...
+ String homeDirStr = System.getProperty( "user.home" );
+ workingDir = Paths
+ .get( homeDirStr )
+ .resolve("Projects")
+ .resolve("DRMF");
+ }
+
+ /**
+ * Will change all cached gold files MML.
+ */
+ public void regenerateAllMML(){
+ for ( int i = 1; i <= max; i++){
+ try {
+ JsonGouldiBean bean = loader.getGouldiJson( i );
+ regenerateMMLViaLatexML( bean );
+ postLatexmlProcessing( bean );
+ augmentSingleGouldiEntry( bean );
+ JsonGouldiCheckBean checker = bean.getCheck();
+ if ( checker != null ){
+ checker.setQid( false );
+ checker.setTree( false );
+ }
+ bean.setCheck( checker );
+ //GoldUtils.writeGoldFile( outputPath.resolve( i+".json" ), bean );
+ LOG.info("Successfully augmented gouldi entry with QID: " + i);
+ } catch ( Exception e ){
+ LOG.warn("Cannot augment gould entry with QID: " + i, e);
+ }
+ }
+ LOG.info("Regenerated every MML from all gouldi entries.");
+ }
+
+ public void regenerateMMLViaLatexML( JsonGouldiBean bean ) {
+ String semanticTex = bean.getSemanticTex(); // manually semantified
+ arguments.addLast( "literal:" + semanticTex );
+
+ CommandExecutor executor = new CommandExecutor( "LaTeXML", arguments);
+ executor.setWorkingDirectoryForProcess( workingDir );
+ NativeResponse response = executor.execWithoutTimeout( Level.DEBUG );
+ if ( response.getResult() != null ){
+ bean.setMml( response.getResult() );
+ LOG.debug("Regenerated MML with LaTeXML.");
+ } else {
+ LOG.warn("Something went wrong during LaTeXML native process.", response.getThrowedException());
+ }
+
+ arguments.removeLast();
+ }
+
+ public void postLatexmlProcessing( JsonGouldiBean bean ){
+ String latexmml = bean.getMml();
+ latexmml = latexmml.replaceAll("xmlns:m=\"http://www.w3.org/1998/Math/MathML\"","");
+ bean.setMml(latexmml);
+ }
+
+ public void augmentSingleGouldiEntry(JsonGouldiBean bean) throws Exception {
+ LOG.debug("Start augment new generated gouldi entry.");
+ final MathDocWrapper math = new MathDocWrapper(MathDoc.tryFixHeader(bean.getMml()));
+ math.fixGoldCd();
+ math.changeTeXAnnotation( bean.getOriginalTex() );
+ bean.setMml( math.toString() );
+ }
+}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/Utility.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/Utility.java
index c31b0fb6..3f026248 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/Utility.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/Utility.java
@@ -1,6 +1,7 @@
package com.formulasearchengine.mathosphere.pomlp.util;
import com.formulasearchengine.mathmlconverters.canonicalize.MathMLCanUtil;
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.xml.MathMLDocumentReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -108,7 +109,7 @@ public static String documentToString(Document doc, boolean indent ){
public static Document getCanonicalizedDocument( Document doc ) {
String strDoc = documentToString(doc, false);
String canonical = getCanoicalizedString( strDoc );
- return MathMLDocumentReader.getDocumentFromXMLString(canonical);
+ return XmlDocumentReader.getDocumentFromXMLString(canonical);
}
public static String getCanoicalizedString( String doc ){
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/config/LatexMLConfig.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/config/LatexMLConfig.java
new file mode 100644
index 00000000..04c94386
--- /dev/null
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/util/config/LatexMLConfig.java
@@ -0,0 +1,72 @@
+package com.formulasearchengine.mathosphere.pomlp.util.config;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+/**
+ * As long as there is no centralized version this config, we need here our
+ * own config.
+ * @author Andre Greiner-Petter
+ */
+public class LatexMLConfig {
+
+ public static final String NATIVE_COMMAND = "latexmlc";
+
+ public static final String[] GENERIC_CONFIG = new String[]{
+ NATIVE_COMMAND,
+ "--includestyles",
+ "--format=xhtml",
+ "--whatsin=math",
+ "--whatsout=math",
+ "--pmml",
+ "--cmml",
+ "--nodefaultresources",
+ "--linelength=90",
+ "--preload", "LaTeX.pool",
+ "--preload", "article.cls",
+ "--preload", "amsmath.sty",
+ "--preload", "amsthm.sty",
+ "--preload", "amstext.sty",
+ "--preload", "amssymb.sty",
+ "--preload", "eucal.sty",
+ "--preload", "[dvipsnames]xcolor.sty",
+ "--preload", "url.sty",
+ "--preload", "hyperref.sty",
+ "--preload", "[ids]latexml.sty",
+ "--preload", "texvc"
+ };
+
+ public static final String[] SEMANTIC_CONFIG = new String[]{
+ NATIVE_COMMAND,
+ "--whatsin=math",
+ "--whatsout=math",
+ "--includestyles",
+ "--format=xhtml",
+ "--pmml",
+ "--cmml",
+ "--mathtex",
+ "--nodefaultresources",
+ "--linelength=90",
+ "--quiet",
+ "--stylesheet", "DRMF.xsl",
+ "--preload", "LaTeX.pool",
+ "--preload", "article.cls",
+ "--preload", "amsmath.sty",
+ "--preload", "amsthm.sty",
+ "--preload", "amstext.sty",
+ "--preload", "amssymb.sty",
+ "--preload", "eucal.sty",
+ "--preload", "mleftright.sty", // new macros uses \mleft( and \mright
+ "--preload", "[dvipsnames]xcolor.sty",
+ "--preload", "url.sty",
+ "--preload", "hyperref.sty",
+ "--preload", "DLMFmath.sty",
+ "--preload", "[ids]latexml.sty",
+ "--preload", "texvc",
+ "--preload", "wikidata.sty"
+ };
+
+ public static ArrayList asList(String[] array ){
+ return new ArrayList<>(Arrays.asList( array ));
+ }
+}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/DLMFWebLoader.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/DLMFWebLoader.java
index 26efc3f5..80115587 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/DLMFWebLoader.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/DLMFWebLoader.java
@@ -45,7 +45,7 @@ public class DLMFWebLoader {
private RestTemplate restTemplate;
- private static final int min = 101, max = 200;
+ private static final int min = 101, max = 103;
public DLMFWebLoader(){
gouldi = GoldStandardLoader.getInstance();
@@ -60,7 +60,7 @@ public void init() throws IOException, URISyntaxException {
.get( gouldiPath )
.resolve("..")
.resolve("dlmfSource")
- .resolve("dlmf.xml");
+ .resolve("dlmf-small.xml");
if ( !Files.exists(outputFile) ) Files.createFile(outputFile);
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/MathMLDocumentReader.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/MathMLDocumentReader.java
index 46a764d6..4e614c07 100644
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/MathMLDocumentReader.java
+++ b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/MathMLDocumentReader.java
@@ -1,6 +1,8 @@
package com.formulasearchengine.mathosphere.pomlp.xml;
import com.formulasearchengine.mathmlquerygenerator.XQueryGenerator;
+import com.formulasearchengine.mathmltools.mml.CMMLInfo;
+import com.formulasearchengine.mathmltools.xmlhelper.XMLHelper;
import com.formulasearchengine.mathosphere.pomlp.util.Utility;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -18,15 +20,12 @@
import java.io.StringWriter;
import java.nio.file.Path;
-public class MathMLDocumentReader extends XmlDocumentReader {
+import static com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader.getDocumentFromXML;
+import static com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader.getDocumentFromXMLString;
- private static final Logger LOG = LogManager.getLogger( MathMLDocumentReader.class.getName() );
+public class MathMLDocumentReader {
- /* TODO
- XML getContentMML();
- XML getPresentationMML();
- String getBlaBla
- */
+ private static final Logger LOG = LogManager.getLogger( MathMLDocumentReader.class.getName() );
private Document mmlDoc;
private Node presentationNode, contentNode;
@@ -54,11 +53,10 @@ private void init( Path mmlFile ){
}
private void init(){
- // first copy...
- Document copy = MathMLDocumentReader.createNewDocumentSubtree( mmlDoc.getDocumentElement() );
+ // first copy..
+ Document copy = (Document) mmlDoc.cloneNode(true);
try {
-
contentNode = XQueryGenerator.getMainElement( copy );
if ( contentNode.getNodeName().equals("math") ){
presentationNode = contentNode;
@@ -81,39 +79,11 @@ private void init(){
presentationNode = copy.getDocumentElement();
}
- private static Document createNewDocumentSubtree( Node subtree ) {
- try {
- Document copy = FACTORY.newDocumentBuilder().newDocument();
- Node parent = copy.importNode( subtree, true );
- copy.appendChild(parent);
- return copy;
- } catch ( ParserConfigurationException e ){
- LOG.error("Something went wrong when copying subtree from MML.", e);
- return null;
- }
- }
-
public void canonicalize(){
this.mmlDoc = Utility.getCanonicalizedDocument(mmlDoc);
this.init();
}
- /**
- * Returns a copy of the presentation MML subtree
- * @return
- */
- public Document getPresentationSubtree(){
- return createNewDocumentSubtree(presentationNode);
- }
-
- /**
- * Returns a copy of the content MML subtree
- * @return
- */
- public Document getContentSubtree(){
- return createNewDocumentSubtree(contentNode);
- }
-
public Node getContentNode(){
return contentNode;
}
diff --git a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/XmlDocumentReader.java b/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/XmlDocumentReader.java
deleted file mode 100644
index 8e6ba512..00000000
--- a/pomlp/src/main/java/com/formulasearchengine/mathosphere/pomlp/xml/XmlDocumentReader.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package com.formulasearchengine.mathosphere.pomlp.xml;
-
-import com.formulasearchengine.mathosphere.pomlp.util.Utility;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-/**
- * Helper class to format XML files to Document and Node types
- */
-public class XmlDocumentReader {
- private static final Logger LOG = LogManager.getLogger( XmlDocumentReader.class.getName() );
-
- public static DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance();
-
- static {
- FACTORY.setIgnoringComments(true);
- //FACTORY.setIgnoringElementContentWhitespace(true);
- //FACTORY.setValidating(true);
- FACTORY.setExpandEntityReferences(true);
- }
-
- public static Document getDocumentFromXML( Path xmlF ){
- try {
- LOG.debug("Start reading process from XML file.");
- DocumentBuilder builder = FACTORY.newDocumentBuilder();
- InputStream inputStream = Files.newInputStream( xmlF.toAbsolutePath() );
- Document doc = builder.parse( inputStream );
- LOG.debug("Successfully read from XML file.");
- return doc;
- } catch ( ParserConfigurationException pce ){
- // how could this happen, without any configurations? ---
- LOG.error("Cannot create DocumentBuilder...", pce);
- } catch (SAXException e) {
- LOG.error("Cannot parse XML file: " + xmlF.toString(), e);
- } catch (IOException e) {
- LOG.error("Cannot read file: " + xmlF.toString(), e);
- }
- return null;
- }
-
- public static Document getDocumentFromXMLString( String xml ){
- try {
- LOG.debug("Start reading process from XML file.");
- DocumentBuilder builder = FACTORY.newDocumentBuilder();
- InputSource input = new InputSource( new StringReader(xml));
- Document doc = builder.parse( input );
- LOG.debug("Successfully read from XML file.");
- return doc;
- } catch ( ParserConfigurationException pce ){
- // how could this happen, without any configurations? ---
- LOG.error("Cannot create DocumentBuilder...", pce);
- } catch (SAXException e) {
- LOG.error("Cannot parse XML file: " + xml, e);
- } catch (IOException e) {
- LOG.error("Cannot read file: " + xml.toString(), e);
- }
- return null;
- }
-
- public static Node getNodeFromXML( Path xmlF ){
- Document document = getDocumentFromXML( xmlF );
- return document.getDocumentElement();
- }
-}
diff --git a/pomlp/src/main/resources/config.properties b/pomlp/src/main/resources/config.properties
index 0593827d..ba3caa21 100644
--- a/pomlp/src/main/resources/config.properties
+++ b/pomlp/src/main/resources/config.properties
@@ -5,7 +5,7 @@ github.repo.name = gouldi
github.repo.subpath = data
# Maximum number of Gouldi-Json file
-gouldi.max = 300
+gouldi.max = 308
gouldi.local = ../lib/GoUldI/data
# Third party files
diff --git a/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/gouldi/GoldStandardSerializationTests.java b/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/gouldi/GoldStandardSerializationTests.java
index 8e723775..f5f0122f 100644
--- a/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/gouldi/GoldStandardSerializationTests.java
+++ b/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/gouldi/GoldStandardSerializationTests.java
@@ -104,14 +104,14 @@ private void reloadAssertions( JsonGouldiBean bean ){
public void loadAndWriteTest(){
try {
JsonGouldiBean gold = GoldUtils.readGoldFile( folderPath.resolve("2.json") );
- gold.setMathTex("WRONG");
+ gold.setOriginalTex("WRONG");
boolean oldQIDCheck = gold.getCheck().isQid();
gold.getCheck().setQid( !oldQIDCheck );
Path tmpP = tmpOutput.resolve( "loadAndWriteTest.json" );
GoldUtils.writeGoldFile( tmpP, gold );
JsonGouldiBean gouldNew = GoldUtils.readGoldFile( tmpP );
assertEquals( !oldQIDCheck, gouldNew.getCheck().isQid() );
- assertEquals( "WRONG", gouldNew.getMathTex() );
+ assertEquals( "WRONG", gouldNew.getOriginalTex() );
} catch ( Exception e ){
fail("Exception during writing test.", e);
}
diff --git a/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/pom/GoldstandardAutomaticComparisonTest.java b/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/pom/GoldstandardAutomaticComparisonTest.java
index 2a50ce86..4e42506b 100644
--- a/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/pom/GoldstandardAutomaticComparisonTest.java
+++ b/pomlp/src/test/java/com/formulasearchengine/mathosphere/pomlp/pom/GoldstandardAutomaticComparisonTest.java
@@ -1,5 +1,13 @@
package com.formulasearchengine.mathosphere.pomlp.pom;
+import static org.junit.jupiter.api.Assertions.fail;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.stream.IntStream;
+
+import com.formulasearchengine.mathmltools.xmlhelper.XmlDocumentReader;
import com.formulasearchengine.mathosphere.pomlp.GoldStandardLoader;
import com.formulasearchengine.mathosphere.pomlp.comparison.CSVResultWriter;
import com.formulasearchengine.mathosphere.pomlp.comparison.ComparisonError;
@@ -10,24 +18,15 @@
import com.formulasearchengine.mathosphere.pomlp.gouldi.JsonGouldiBean;
import com.formulasearchengine.mathosphere.pomlp.util.config.ConfigLoader;
import com.formulasearchengine.mathosphere.pomlp.xml.MathMLDocumentReader;
-import com.formulasearchengine.mathosphere.pomlp.xml.XmlDocumentReader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.w3c.dom.Node;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.stream.IntStream;
-
-import static org.junit.jupiter.api.Assertions.fail;
-
/**
* This class should be excluded in the maven tests because
* it automatically runs tree comparisons over the entire data set.