PSOATransRun Development Agenda
This agenda complements the projects in PSOATransRun Development Tutorial, especially Projects 1 and 4.
- 1 Documentation
- 2 Java/ANTLR
- 2.1 Display Instantiation and Version
- 2.2 Refine TPTP Instantiation
- 2.3 Enable Multi-Line Query Input
- 2.4 Make KB Input via Command Line as Expressive as via Import Statement
- 2.5 Display Blank-Separated Bindings in Interaction Loop
- 2.6 omitNegMem as a Possible Default Option
- 2.7 Refine Functional Expressions
- 2.8 Allow Tracing
- 2.9 Refine Error Messages
- 2.10 Revisit Encodings and Reserved Names
- 2.11 Alternative to External
- 3 Utility Programs
- 4 RuleML/Assert
- 5 Test Cases
- 6 Technology-Stack Maintenance
1.1 PSOATransRunComponents README
Consider quick setup hints.
1.2 Best Practices Page
- Within new batch test directories <testDir> (for java -jar target\PSOATransRunLocal.jar --test -i <testDir>), in files of the form *-answerJ.psoa (do not use @@@test@@@'s yes/no but) use Capitalized Yes/No (as displayed in the interaction loop)
2.1 Display Instantiation and Version
- [Started] On startup, unconditionally display (command-line) instantiation variety and (released) version number of PSOATransRun such as PSOATransRun1.3[PSOA2Prolog,XSBProlog] (vs. PSOATransRun1.3[PSOA2TPTP,VampirePrime]) followed by PSOATransRun1.4[PSOA2Prolog,XSBProlog] (vs., e.g., PSOATransRun1.4[PSOA2Prolog,SWIProlog] and PSOATransRun1.4[PSOA2TPTP,VampirePrime])) and then in smaller increments like PSOATransRun1.4.1[...,...]
- Also see:
- println("PSOATransRun 1.3"); // TODO: Define method in PSOATransRun class, called here to return version
- Also see:
- Instead of hard-coding version into a print statement, use global variable(s) or constant(s), which later could also again be printed in interactive sessions (cf. Project 2)
2.2 Refine TPTP Instantiation
- Explore running on Linux (very easy, currently via VirtualBox), macOS (very probable), Windows (very unlikely, since VampirePrime-needed C library is missing)
- Expand the --test option examples that can be run using --targetLang tptp rather than --targetLang prolog (already all except [External-wrapped] built-ins)
- Consider reactivating Web Hosting on Openshift
2.3 Enable Multi-Line Query Input
[Indefinitely postponed] Currently, multi-line interactive query input is not allowed because the first end-of-line (via the ENTER key or the clipboard) immediately starts parsing. Since consoles cannot distinguish end-of-line from ENTER, a clean solution needs to bypass the console and directly handle keyboard events from end users in Java, like GUI-based programs such as Skype do, which can distinguish ENTER from SHIFT-ENTER and allows clipboard pasting of multi-line input, where 'inner ENTERs' are passivated.
2.4 Make KB Input via Command Line as Expressive as via Import Statement
Currently, command-line input (-i,--input) refers to a KB in a local file but cannot refer to a KB in a global URL. An Import statement can be employed within an empty-KB ("include"-style) document to refer to a URL. But it would be better to refer to that URL directly from the command line.
2.5 Display Blank-Separated Bindings in Interaction Loop
In the interaction loop, consider displaying a substitution (a binding for each query variable) not in a ","-separated but in a (more light-weight) " "-separated manner, e.g. for query
display the substitution
?what=_XMLBible ?situation=_oidcons(_own _Mary _XMLBible)
which is also the format for *-answerJ.psoa files. Besides interaction/batch uniformity, this permits copy&paste from the interaction loop to a corresponding *-answerJ.psoa file.
2.6 omitNegMem as a Possible Default Option
Consider making memterm omission the default, thus changing this (in LP, "negative literals" refer to atoms in rule conditions and in queries):
-z,--omitNegMem Omit memterm in the slotribution of negative occurrences of psoa atoms with at least one dependent descriptor
However, for target engines such as Prolog that process conjunctions (as resulting from slotribution) left-to-right, it might be better for efficiency to keep (ground) memterms, in left-most positions, causing (type/class/predicate) failures as early as possible rather than spending unnecessary computation before encountering such failures further into conjunctions. Hence the current default, with possible "semantic query optimization" in the form of conjunction reordering, could be kept.
2.7 Refine Functional Expressions
- As usual, n-ary lists (RuleML/XML: slotless plexes, PSOA RuleML: single-tuple psoa expressions) can be realized as ('passive') binary cons (Relfun: cns) expressions, which ultimately could be given an n-ary surface syntax, also allowing rest parameters (RuleML/XML: repo, Prolog/Relfun: "|")
- Flattening of ('passive' and 'active') expressions could be modeled on, and possibly combined with, existing unnesting of atoms
- (First-order) Functional Programming (with higher-order syntactic sugar) would then be possible as in Hilog/Relfun
2.8 Allow Tracing
While the --echoInput (-e) option shows the translated KB and query, it would sometimes be helpful to see a computation trace on the same level. For the Prolog instantiation, this could just be a Prolog trace under the PSOATransRun system (a trace can already be viewed by invoking a separate (traced) XSB Prolog engine with translation results). For the TPTP instantiation, this would likely be more involved because of the complete search performed by TPTP engines (such as VampirePrime).
2.9 Refine Error Messages
Make errors (and warnings) display more uniformly, perhaps all using the same prefix, e.g. "Error: " (and "Warning: "). Consider possible connection to option --denseErrorMsgs. Some msgs can be easily refined. Others (from multiple thrown exceptions received by a single catch) are not so easy.
2.10 Revisit Encodings and Reserved Names
Addition to Project 4 on fixing issue with (<- Interprolog <- XSB Prolog) back-translation of constant encodings by single-quote surroundings (for '_'-prefixed PSOA constants and '"'-surrounded PSOA strings in XSB Prolog).
2.11 Alternative to External
[Postponed] Consider realizing a PSOA RuleML 1.0 change, replacing External with a more concise syntax or making External optional. Study consequences for http://wiki.ruleml.org/index.php/PSOA_RuleML#Monolithic_Syntax, http://wiki.ruleml.org/index.php/PSOA_RuleML#Semantics, and http://wiki.ruleml.org/index.php/PSOA_RuleML#Test_Cases. Optionality would allow omission of External wrappers by not only shortcutting external built-in pred calls like
> External(pred:numeric-equal(42 42)) Answer(s): Yes
> pred:numeric-equal(42 42) Answer(s): Yes
but also external built-in func calls like in
> 42 = External(func:numeric-add(26 16)) Answer(s): Yes
> 42 = func:numeric-add(26 16) Answer(s): Yes
[instead of current
> ?res = func:numeric-add(26 16) Answer(s): ?res=+(26 16)
Like in Prolog's "is" and unlike in External-using PSOA or "(...)"-vs.-"[...]"-using Relfun, 'active' funcs would not be 'applied differently' from 'passive' funcs but would need to be recognized from being in the context of a "=" rhs or an arg or slot-filler position.
For funcs, External thus currently not only marks a built-in but also indicates an 'active' call. Relying on pred/func prefixes as a replacement for External would burden prefixes with this extra meaning in contrast to the more simple ('user-package') meaning of other prefixes.
3 Utility Programs
3.1 Refine Unit Test Program
Consider refining the (Java) program that runs X_Y_Z[I]-queryJ.psoa with expected X_Y_Z[I]-answerJ.psoa for X_Y_Z[I]-KB.psoa in subdirectory X_Y_Z[I] of the directory @@@test@@@, comparing each actual answer with the expected answerJ. Possibly generalize the program such that it can be used for structured directories like, for Specification of Deliberation RuleML 1.03#Testing_of_Relax_NG_Schemas, the 'test cases' in rnc-test-suites (also see the 'show cases' in exa), where the current functionality is applied to the innermost directories (of the above form), whose existing (e.g., *.ruleml, *.pl, and *.grailog) files, i.e. files other than *-queryJ.psoa, *-answerJ.psoa, and *-KB.psoa are ignored. This will help creating and maintaining #Test_Cases.
- Also see:
- File testCases = dir.listFiles(); // TODO: listFiles could be generalized to structured directories.
3.2 Refine Benchmark Test Program
Consider refining the (Python) program, for chain and its variants, that (1) creates an enumeration of PSOA KBs of increasing size for a single query with an obvious answer and (2) provides the execution environment for probing PSOATransRun response times over them.
4.1 Official ISO Prolog Prefix
Once URL replacement is committed from Eclipse: http://wiki.ruleml.org/index.php/PSOA_RuleML#Built-ins (2 times), ...:
Prefix(isopl: <http://www.deransart.fr/prolog/bips.html#>) --> Prefix(isopl: <https://www.iso.org/standard/21413.html#>)
4.2 RuleML/Assert Use
Document/Group --> RuleML/Assert
4.3 Empty KB Allowance
Because some users don't want any Import and some may want to work off-line (rather than connecting to http://psoa.ruleml.org), the following should not be the default but the file EmptyKB.psoa should be provided in the PSOATransRun distribution for manual command-line use.
Consider to allow starting without a KB option/parameter, to be automatically initialized as the empty KB (omitted Assert), EmptyKB.psoa (instead of error
C:\Users\...>java -jar PSOATransRunLocal.jar No input KB specified
RuleML ( % Empty KB but allowing built-ins and libraries Prefix(pred: <http://www.w3.org/2007/rif-builtin-predicate#>) Prefix(func: <http://www.w3.org/2007/rif-builtin-function#>) Prefix(math: <http://psoa.ruleml.org/lib/math#>) Prefix(phys: <http://psoa.ruleml.org/lib/phys#>) Import(<http://psoa.ruleml.org/lib/math.psoa>) Import(<http://psoa.ruleml.org/lib/phys.psoa>) )
5 Test Cases
5.1 Unit Tests
Add unit tests, feature by feature (small bits of functionality at a time), corner cases, etc., possibly uncovering issues.
5.2 Benchmark Tests
Consider expanding on the (Zou 2018) benchmarks (including nat and chain).
5.3 Deliberation/PSOA RuleML Intersection Tests
Create tests, in PSOA Presentation Syntax, where PSOA RuleML/PS already semantically intersects with Deliberation RuleML/XML (later: PS generated from XML with PSOA RuleML API):
- (Purely) Relational KBs (e.g. for Project 3's case study "A Rule-Based Approach for Air Traffic Control ...")
- Cases where engines (e.g., PSOATransRun) for PSOA RuleML's slotribution produce answers equivalent to those of engines (e.g., OO jDREW) for Deliberation RuleML's slotted unification
5.4 Deliberation/PSOA RuleML Union Tests
[Postponed] Similarly, add tests preparing (semantically) the union of Deliberation and PSOA features, e.g. multiple tuples with positional rests. Maybe use Prolog lists with "|" for PSOA argument sequences, but this would degrade performance.