Skip to content
EdmonL edited this page Nov 14, 2014 · 41 revisions

Welcome to the RuleML2TPTP FAQ! This page also serves as the supporting and flexible documentation characterized by brisk questions and answers. We think that this form is better for this project than a lengthy formal document. See the project main page for other reference links.

About XSLT

Why are there two XSLT files in the source code for the translation?

One is to normalize the source RuleML file, and the other is for the real translation. RuleML allows abbreviated encoding (skipped edge tags and default attribute values) and some freedom in the ordering of elements. It would be much easier to do translation on normalized RuleML than the original (un-normalized) source. Moreover, RuleML has provided normalizers in XSLT that we can utilize. The normalizer we use in this project is actually the one for a super set of Datalog+, however it goes well along with this project.

Why do I get warnings about <Data>?

<Data> represents a "any-type" data model as an alternative to literal character strings. However in the TPTP language, there is no support for any-type data. Thus we just ignore <Data> but give warnings about its occurrence in the source file.

Which subset of RuleML is supported by the translation in this project?

The supported input source should be valid against this Datalog+ Deliberation RuleML 1.01 schema. <Retract> is ignored and <Data> is unsupported.

About Java Source Code

Why is there only one Java source code file in this project?

Because it is enough. The only Java class (the main class) is to parse the command line arguments and translate the input as to the parsed options by invoking JAXP calls.

Why do you bother with Java code? Why not just call Saxon directly since it is executable, or use shell scripts to shorten the commands?

Our translation has a normalization step as pre-processing. Calling Saxon directly is full of typing and memorizing. We tried shell scripts but it is platform- (or shell-) dependent. Then we found we preferred more to a platform-independent solution, so that we can avoid maintaining multiple sets of scripts for different platforms.

Is there any documentation for the Java source code?

No. The Java code is quite straightforward. The comments in it should be enough for reading it.

About Program Options

How can I remember how to use the program?

Try "java -jar ruleml2tptp.tar -h" at first.

What does option -r do?

With this option, CRLF will be used to mark new lines in the output translation (like on Windows OS) instead of the default LF only.

How can I get a look at the normalized RuleML?

Use option -nt, which suppresses the real translation, so only the result of normalization is written to the output. If the result of normalization is saved, for example, in a file, it can later be used as the source of the translation with option -nn, so that the normalization will not be bypassed.

How can I retain comments in the source file to the output?

Use option -c. If a pattern in regular expression follows it, only comments which content matches the pattern will be carried, and converted into proper commenting syntax, into the output.

How can I keep only part of a comment?

Write that comment into two parts. Use -c to distinguish them.

What kind of regular expression does this program use?

The regular expression will be used directly with XPath functions. See XPath functions specification for the syntax.

What can the flags be with option -g?

See XPath functions specification for the flags. Basically "i" means case-insensitive mode, "s" means that dot can match the newline character, and "m" means multi-line mode where "^" and "$" match the start and end of a line instead of the entire input string. "v" is specific to this program, meaning not to select the comments that match the pattern, but to select those that do not match. It is like "grep -v" on UNIX/Linux.

Why do I get warnings about variables and constants?

It is because the variables, constants and functors in the source file do not conform to the TPTP language syntax, so they will be invalid in the output. RuleML2TPTP can convert alphabetic case of the first letter, or single quote constants and functors in RuleML to make them valid in the TPTP language. However, they can still be invalid after the conversion by, for example, including characters other than letters, numbers and "_" (underscores). That is when the warnings are issued.

Why don't I get the warnings when invalid variables exist in the output?

The warnings are directed to the standard error. When, for example, the output and the standard error are both to print on the screen, warnings will be suppressed to avoid messing up the output. Redirecting and separating them will bring up the warnings.

How are the comments converted into the TPTP syntax?

Generally speaking, "%" followed by a space will be inserted at the beginning of each line after the line has been trimmed clear of leading and trailing whitespaces. A trimmed comment line starting with "%" will not have a "%" and a space inserted again. Here is an example comment:

<!--         An example comment:
            %    Indent
    % A percent sign starts a comment line.

    % %100 keep this
    -->

It will be converted into the following:

% An example comment:
%    Indent
% A percent sign starts a comment line.

% %100 keep this
Why can't I keep the comments in <Atom>?

Because it usually is not a good idea to break a TPTP formula with comments. Only comments outside a TPTP formula, that is, at most as deep as the child nodes of <Assert> and <Query>, can be retained.

About Saxon

Can I use other JAXP implementation instead of Saxon?

Yes. The java library file saxon.jar can be removed, and then the local implementation will be used. Alternatively, option -t can be used to specify a third party transformer factory class. Remember to put that factory class under the class path. Whichever implementation is about to use, make sure that the implementation supports XSLT 2.0 because this project uses a normalizer and a translator both in XSLT 2.0

How can I tell which implementation I am using and whether it supports XSLT 2.0?

See through the help printed by option -h.

Clone this wiki locally