javaDungAF.tests
Class TestWithAspartix

Object
  extended by TestWithAspartix

public class TestWithAspartix
extends Object

A class to test the semantics-related functionality of DungAF, using ASPARTIX (v.0.9).

This class allows the output of DungAF to be checked against the output of ASPARTIX. One or more semantics may be tested at a time, and the tests may involve any number of randomly-generated AFs of specified dimensions (involving up to 26 arguments). ASPARTIX implements all of the semantics implemented by DungAF, except the eager semantics and the preferred-sceptical semantics.

This class requires that the DLV system is installed, and should be executed via a script. That script must -

  1. run this class, in order (i) to generate AFs; (ii) to write those AFs to input-files for the DLV system; and (iii) to write DungAF's interpretation of those AFs to results-files;
  2. call the DLV system to obtain ASPARTIX's interpretations of those AFs, writing those interpretations to the results-files; and
  3. run this class again to compare the interpretations of DungAF and ASPARTIX.
A template bash-script is provided here. This script ensures that the results provided by ASPARTIX are written to results-files in a particular format. The functionality of this class depends on certain aspects of that format.

Any disagreement between DungAF and ASPARTIX is reported via the standard output stream, along with details of the AF and the semantics involved.


Field Summary
(package private) static String dlvDirectory
          The name of the directory for the input-files for the DLV system.
(package private) static HashSet<String> IMPLEM_SEMANTICS
          The semantics implemented by DungAF.
(package private) static int iterations
          The number of AFs to be used in testing.
(package private) static int maxArgs
          The greatest number of arguments each AF may contain.
(package private) static int maxAtts
          The greatest number of attacks each AF may contain.
(package private) static int minArgs
          The least number of arguments each AF must contain.
(package private) static int minAtts
          The least number of attacks each AF must contain.
(package private) static String resultsDirectory
          The name of the directory for the results-files.
(package private) static String[] semanticsToTest
          The semantics with respect to which tests are to be done.
(package private) static HashSet<String> UNIQUE_EXTENSION_SEMANTICS
          The unique-extension semantics implemented by DungAF.
 
Constructor Summary
TestWithAspartix()
           
 
Method Summary
private static boolean compareResults()
          Compares interpretations of AFs provided by DungAF against interpretations provided by ASPARTIX.
static void main(String[] args)
          Sets fields and calls writeFilesWithDungAF() or compareResults(), depending on the second item in args.
private static void writeFilesWithDungAF()
          Generates AFs, writes those AFs to results-files and to input-files for the DLV system, and writes DungAF's interpretations of those AFs to the results-files.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iterations

static int iterations
The number of AFs to be used in testing.


minArgs

static int minArgs
The least number of arguments each AF must contain.


maxArgs

static int maxArgs
The greatest number of arguments each AF may contain. Must be no greater than 26.


minAtts

static int minAtts
The least number of attacks each AF must contain.


maxAtts

static int maxAtts
The greatest number of attacks each AF may contain.


semanticsToTest

static String[] semanticsToTest
The semantics with respect to which tests are to be done.


UNIQUE_EXTENSION_SEMANTICS

static final HashSet<String> UNIQUE_EXTENSION_SEMANTICS
The unique-extension semantics implemented by DungAF.


IMPLEM_SEMANTICS

static final HashSet<String> IMPLEM_SEMANTICS
The semantics implemented by DungAF.


dlvDirectory

static String dlvDirectory
The name of the directory for the input-files for the DLV system.


resultsDirectory

static String resultsDirectory
The name of the directory for the results-files.

Constructor Detail

TestWithAspartix

public TestWithAspartix()
Method Detail

main

public static void main(String[] args)
                 throws IllegalArgumentException
Sets fields and calls writeFilesWithDungAF() or compareResults(), depending on the second item in args. In the latter case, the method also reports whether any discrepancies were found in the results, via the standard output stream.

Parameters:
args - several Strings. This class must be executed twice by a script, as described above. On the first occasion, at least 9 parameters are required, all but one of which correspond to fields of this class -

  1. the number of AFs to be used (i.e. the number of tests) (iterations);
  2. "write";
  3. the least number of arguments each AF must contain (minArgs must not exceed 26);
  4. the greatest number of arguments each AF may contain (maxArgs);
  5. the least number of attacks each AF must contain (minAtts);
  6. the greatest number of attacks each AF may contain (maxAtts);
  7. the name of the directory for the input-files for the DLV system (dlvDirectory);
  8. the name of the directory for the results-files (resultsDirectory);
  9. a member of IMPLEM_SEMANTICS (semanticsToTest);
  10. another member of IMPLEM_SEMANTICS (semanticsToTest);
  11. etc. (semanticsToTest).

On the second occasion, there must be only 3 parameters:

  1. the number of AFs to be used (as above);
  2. "check"; and
  3. the path to the directory for the results-files (as above).

Throws:
IllegalArgumentException - if the parameters are not as specified above.

writeFilesWithDungAF

private static void writeFilesWithDungAF()
                                  throws IllegalAccessException,
                                         NoSuchMethodException,
                                         InvocationTargetException,
                                         IOException
Generates AFs, writes those AFs to results-files and to input-files for the DLV system, and writes DungAF's interpretations of those AFs to the results-files.

The relevant fields determine the number and dimensions of the AFs which are generated.

Throws:
IllegalAccessException
NoSuchMethodException
InvocationTargetException
IOException

compareResults

private static boolean compareResults()
                               throws FileNotFoundException,
                                      IOException
Compares interpretations of AFs provided by DungAF against interpretations provided by ASPARTIX. Details of any discrepancies are reported via the standard output stream.

The interpretations are read from the results-files which have been generated by writeFilesWithDungAF() and by the DLV system.

This method also deletes the (redundant) input-files generated by writeFilesWithDungAF(), but does not delete the results-files.

Throws:
FileNotFoundException
IOException