|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlp.trans.Grounder<DynamicLogicProgram>
lp.trans.DlpGrounder
public class DlpGrounder
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.
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 |
---|
private int programCount
parseOutput(String)
which doesn't have access to
the input program. Therefore, it is set in
printProgram(DynamicLogicProgram, Writer)
.
private final DlpGrounder.DlpTagger<Writer> printer
private final DlpGrounder.DlpDetagger parser
Constructor Detail |
---|
public DlpGrounder()
DlpGrounder
that creates its own
LparseWrapper
instance using its default constructors.
public DlpGrounder(LparseWrapper wrapper)
DlpGrounder
that uses the given object
to invoke lparse and process its output.
wrapper
- the object used to execute lparse, parse its warnings
and/or errors and create corresponding LparseMessage objectsMethod Detail |
---|
protected void printProgram(DynamicLogicProgram inputProgram, Writer writer)
inputProgram
in a form that is groundable by lparse (as
long as the programmer didn't break the constraints imposed by lparse).
printProgram
in class Grounder<DynamicLogicProgram>
inputProgram
- the (ungrounded) input programwriter
- a Writer
to write toprotected GrounderMessage makeGrounderMessage(LparseMessage message, DynamicLogicProgram inputProgram)
lparseMessage
from lparse and
the input program.
makeGrounderMessage
in class Grounder<DynamicLogicProgram>
message
- the error or warning message issued by lparseinputProgram
- the input program
protected DynamicLogicProgram parseOutput(String program)
parseOutput
in class Grounder<DynamicLogicProgram>
program
- the lparse output
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |