Skip to content

Commit 20d90ce

Browse files
authored
Merge pull request #527 from ontologyportal/Rose_5-26-26
Fixed a Hardcoded Predicate Arity Conditional in SUMOKBtoTFAKB
2 parents ec4001f + 60bcb8b commit 20d90ce

4 files changed

Lines changed: 14 additions & 23 deletions

File tree

src/java/com/articulate/sigma/tp/TheoremProverController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ portions copyright Teknowledge (c) 2003 and reused under the terms of the GNU li
2121
import com.articulate.sigma.tp.ATPQuery.RunSource;
2222
import com.articulate.sigma.tp.ATPQuery.TptpLanguage;
2323
import com.articulate.sigma.trans.TPTP3ProofProcessor;
24+
import com.articulate.sigma.trans.TPTPGenerationManager;
2425
import com.articulate.sigma.parsing.CLIMapParser;
2526

2627
import java.util.ArrayList;
@@ -38,7 +39,8 @@ public TheoremProverController () {}
3839
* @param query ATPQuery object used to determine which prover to ask with associated options.
3940
*/
4041
public ATPResult ask (ATPQuery query) {
41-
42+
43+
TPTPGenerationManager.waitForAllTPTP(600);
4244
switch (query.getProverType()) {
4345
case EPROVER:
4446
return this.askEProver(query);

src/java/com/articulate/sigma/tp/Vampire.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ portions copyright Teknowledge (c) 2003 and reused under the terms of the GNU li
2121
import com.articulate.sigma.trans.SessionTPTPManager;
2222
import com.articulate.sigma.trans.THFnew;
2323
import com.articulate.sigma.trans.TPTP3ProofProcessor;
24-
import com.articulate.sigma.trans.TPTPGenerationManager;
2524
import com.articulate.sigma.trans.TPTPutil;
2625
import com.articulate.sigma.utils.FileUtil;
2726
import com.articulate.sigma.utils.StringUtil;
@@ -182,13 +181,6 @@ else if ("tff".equalsIgnoreCase(requestedTptpLang)){
182181
this.timeout = timeout;
183182
this.maxAnswers = maxAnswers;
184183
this.inferenceFilePath = KBmanager.getMgr().getPref("kbDir") + File.separator + KBmanager.getMgr().getPref("sumokbname") + "." + this.inferenceFileExtension;
185-
if (!(new File(this.inferenceFilePath).exists()) || KBmanager.getMgr().infBaseFileOldIgnoringUserAssertions(this.inferenceFileExtension)) {
186-
System.out.println("INFO in KB.loadVampire(): this.inferenceFilePath=" + !(new File(this.inferenceFilePath).exists()));
187-
System.out.println("INFO in KB.loadVampire(): managerInfFileOld " + KBmanager.getMgr().infFileOld());
188-
synchronized (kb.baseGenLock) {
189-
TPTPGenerationManager.generateProperFile(kb, this.requestedTptpLanguage);
190-
}
191-
}
192184
}
193185

194186
/***************************************************************
@@ -379,18 +371,6 @@ public void askVampireHOL(String stmt, boolean useModals) {
379371
File thfAxioms = new File(kbThfPath);
380372
if (!thfAxioms.exists()) {
381373
System.out.println("Vampire.askVampireHOL(): no such file: " + kbThfPath + ". Waiting for background generation or creating it.");
382-
// Wait for background THF generation if in progress, otherwise generate synchronously
383-
if (useModals) {
384-
if (!TPTPGenerationManager.waitForTHFModal(600)) {
385-
System.out.println("Vampire.askVampireHOL(): Background generation not ready, generating THF Modal synchronously");
386-
THFnew.transModalTHF(this.kb);
387-
}
388-
} else {
389-
if (!TPTPGenerationManager.waitForTHFPlain(600)) {
390-
System.out.println("Vampire.askVampireHOL(): Background generation not ready, generating THF Plain synchronously");
391-
THFnew.transPlainTHF(this.kb);
392-
}
393-
}
394374
}
395375
// -------- 2. Prepare temp-stmt.thf and temp-comb.thf (mirrors FOF/TFF run() pattern) --------
396376
String stmtFile = dir + "temp-stmt." + this.inferenceFileExtension;

src/java/com/articulate/sigma/trans/SUMOKBtoTFAKB.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public void writeRelationSort(String t, PrintWriter pw) {
314314
int endIndex = sig.size();
315315
if (KButilities.isVariableArity(kb,SUMOtoTFAform.withoutSuffix(t)))
316316
endIndex = getVariableAritySuffix(t) + 1;
317-
if (endIndex > 9) {
317+
if (endIndex > Formula.MAX_PREDICATE_ARITY) {
318318
pw.println("% SUMOKBtoTFAKB.writeRelationSort(): size too large: " + t);
319319
return;
320320
}

src/java/com/articulate/sigma/trans/TPTPGenerationManager.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Manages background generation of TPTP translation files (FOF, TFF, THF).
1919
import java.io.*;
2020
import java.nio.charset.StandardCharsets;
2121
import java.nio.file.*;
22+
import java.util.Date;
2223
import java.util.HashMap;
2324
import java.util.concurrent.*;
2425
import java.util.concurrent.atomic.AtomicBoolean;
@@ -61,7 +62,6 @@ public static void setSkipBackgroundGeneration(boolean skip) {
6162
skipBackgroundGeneration.set(skip);
6263
}
6364

64-
6565
/*********************************************************************************
6666
* Start background generation of all TPTP formats for all KBs.
6767
* This should be called after KBmanager initialization is complete.
@@ -373,6 +373,15 @@ private static void generateTHFPlain(KB kb) {
373373
}
374374
}
375375

376+
/*********************************************************************************
377+
* Wait for all TPTP generation to complete.
378+
* @param timeoutSec Maximum time to wait in seconds
379+
* @return true if generation completed successfully, false if timed out
380+
*/
381+
public static boolean waitForAllTPTP(int timeoutSec) {
382+
return waitForFOF(timeoutSec) && waitForTFF(timeoutSec) && waitForTHFModal(timeoutSec) && waitForTHFPlain(timeoutSec);
383+
}
384+
376385
/*********************************************************************************
377386
* Wait for FOF generation to complete.
378387
* @param timeoutSec Maximum time to wait in seconds

0 commit comments

Comments
 (0)