Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lp.trans
Class DlpGrounder

    java.lang.Object
      lp.trans.Grounder<DynamicLogicProgram>
          lp.trans.DlpGrounder

    public class DlpGrounder

extends Grounder<DynamicLogicProgram>

Creates a grounded version of a `DynamicLogicProgram`. This means that the resulting DLP `output` has the same answer sets as the original DLP and `output.isGround()` returns `true`. The transformation is performed using `LparseWrapper` and can executed by calling the `Grounder.ground(Object)` method. Lparse warnings (see `LparseWrapper.getWarnings()`) issued during the grounding process are translated into `GrounderMessage`s and can be retrieved through the `Grounder.getWarnings()` method.

Version:
  1.0.0
Author:
  Martin Slota
See Also:
  `LparseWrapper`

Nested Class Summary
`private static class` | `DlpGrounder.DlpDetagger` A special parser for parsing the grounded and tagged program.
`private static class` | `DlpGrounder.DlpTagger<W extends Writer>` A special `LpStructureUnit` printer that: gets rid of negation in rule heads by prepending a "p_" or "n_" adds a tagging literal to body of every rule.

Field Summary
`private DlpGrounder.DlpDetagger` | `parser` Parses lparse's output and gets rid of the tagging literals again.
`private DlpGrounder.DlpTagger<Writer>` | `printer` This printer is used to dump rules in the original dynamic logic program into a single logic program.
`private int` | `programCount` Contains the length of the dynamic logic program that is being grounded.

Constructor Summary
`DlpGrounder()` Creates a new instance of `DlpGrounder` that creates its own `LparseWrapper` instance using its default constructors.
`DlpGrounder(LparseWrapper wrapper)` Creates a new instance of `DlpGrounder` that uses the given object to invoke lparse and process its output.

Method Summary
`protected GrounderMessage` | `makeGrounderMessage(LparseMessage message, DynamicLogicProgram inputProgram)` Creates an error message based on `lparseMessage` from lparse and the input program.
`protected DynamicLogicProgram` | `parseOutput(String program)` Parses the given lparse output and returns the grounded program.
`protected void` | `printProgram(DynamicLogicProgram inputProgram, Writer writer)` Prints `inputProgram` in a form that is groundable by lparse (as long as the programmer didn't break the constraints imposed by lparse).

Methods inherited from class lp.trans.Grounder
`getWarnings, ground, setLparsePath`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### programCount

    private int programCount

  Contains the length of the dynamic logic program that is being grounded. Is needed by `parseOutput(String)` which doesn't have access to the input program. Therefore, it is set in `printProgram(DynamicLogicProgram, Writer)`.

### printer

    private final DlpGrounder.DlpTagger<Writer> printer

  This printer is used to dump rules in the original dynamic logic program into a single logic program. A literal is added to the body of each rule in order to remember which level of the DLP the rule comes from.

### parser

    private final DlpGrounder.DlpDetagger parser

  Parses lparse's output and gets rid of the tagging literals again.

Constructor Detail

### DlpGrounder

    public DlpGrounder()

  Creates a new instance of `DlpGrounder` that creates its own `LparseWrapper` instance using its default constructors.

### DlpGrounder

    public DlpGrounder(LparseWrapper wrapper)

  Creates a new instance of `DlpGrounder` that uses the given object to invoke lparse and process its output.

  Parameters:
    `wrapper` - the object used to execute lparse, parse its warnings and/or errors and create corresponding LparseMessage objects

Method Detail

### printProgram

    protected void printProgram(DynamicLogicProgram inputProgram,
                                Writer writer)

  Prints `inputProgram` in a form that is groundable by lparse (as long as the programmer didn't break the constraints imposed by lparse).

  Specified by:
    `printProgram` in class `Grounder<DynamicLogicProgram>`
  Parameters:
    `inputProgram` - the (ungrounded) input program
    `writer` - a `Writer` to write to

### makeGrounderMessage

    protected GrounderMessage makeGrounderMessage(LparseMessage message,
                                                  DynamicLogicProgram inputProgram)

  Creates an error message based on `lparseMessage` from lparse and the input program.

  Specified by:
    `makeGrounderMessage` in class `Grounder<DynamicLogicProgram>`
  Parameters:
    `message` - the error or warning message issued by lparse
    `inputProgram` - the input program
  Returns:
    an enhanced message containing a reference to the problematic rule

### parseOutput

    protected DynamicLogicProgram parseOutput(String program)

  Parses the given lparse output and returns the grounded program.

  Specified by:
    `parseOutput` in class `Grounder<DynamicLogicProgram>`
  Parameters:
    `program` - the lparse output
  Returns:
    the grounded program

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD