|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrevisionlogic.SentenceParser
SentenceParser is a converter between strings and ISent instances.
Field Summary | |
static java.util.regex.Matcher |
m
The string pattern matcher for reading the KB caption from the KB input files. |
Constructor Summary | |
SentenceParser()
Creates a new default SentenceParser. |
Method Summary | |
static void |
containsIllegalLiterals(ISent s)
Checks all the literals in the sentence s to see if any contains logical or reserved symbols. |
static java.util.Vector |
getCBICsFromFile(java.lang.String sFilename)
Creates and returns a vector of consistency-based integrity constraints (CB IC) read from the text file sFilename . |
static ISent |
getConjunctionFromFile(java.lang.String sFilename,
java.lang.String fileType)
Creates and returns a conjunction of revision sentences or a conjunction of entailment-based integrity constraints (EB IC) in the text file sFilename . |
static java.util.Vector |
getContractionsFromFile(java.lang.String sFilename)
Creates and returns a vector of contraction sentences read from the text file sFilename . |
(package private) static ISent |
getContractResult(ISent AllKB,
java.util.Vector CA,
java.util.Vector EQLit)
Returns and creates from AllKB an ISent sentence in which the renaming of literals based on
the common atoms CA and the equivalence set literals EQLit is applied according to the
renaming algorithm following contractions. |
static java.util.Vector |
getKBsFromFile(java.lang.String sFilename)
Creates and returns a vector of knowledge bases consisting of sentences in the text file sFilename . |
(package private) static ISent |
parsePrimeString(java.lang.String s,
java.util.Collection v,
int n)
Parses the string s and returns an ISent sentence in which the literals also appearing in the
Vector v are either numbered if n is a positive integer or primed otherwise. |
static ISent |
parseString(java.lang.String s)
Parses the string s and returns the corresonponding ISent sentence. |
(package private) static ISent |
parseUnNumberString(java.lang.String s,
java.util.Vector EqLit)
Parses the string s and returns an ISent sentence in which the numbered literals also appearing in
the Vector EqLit are primed, and the numbered literals not in EqLit are negated and primed. |
(package private) static ISent |
parseUnprimeString(java.lang.String s,
java.util.Vector EqLit,
java.util.Vector CA)
Parses the string s and returns an ISent sentence in which for each primed literal, it is either
negated and unprimed if it appears in Vector CA and not in Vector EqLit , or simply
unprimed otherwise. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static java.util.regex.Matcher m
Constructor Detail |
public SentenceParser()
Method Detail |
public static ISent getConjunctionFromFile(java.lang.String sFilename, java.lang.String fileType) throws InconsistencyException, SyntaxErrException
sFilename
.Each sentence is on a new line and is interpreted as a conjunct.
sFilename
- the absolute path of the text file containing conjuncts one on each line.fileType
- the string indicating whether sFilename
is for "revision" or for "EB IC".
sFilename
.
InconsistencyException
- if any conjunct is inconsistent or if any conjunct is mutually
inconsistent with any other conjunct(s).
SyntaxErrException
- if any conjunct is syntactically malformed.public static java.util.Vector getKBsFromFile(java.lang.String sFilename) throws SyntaxErrException
sFilename
.Each new knowledge base begins with a caption matching "\\s*KB.*:.*"; further, each sentence for a knowledge base is interpreted as a conjunct as each knowledge base is returned as a conjunction.
sFilename
- the absolute path of the text file containing sentences one on each line.
sFilename
.
SyntaxErrException
- if any sentence is syntactically malformed.public static java.util.Vector getContractionsFromFile(java.lang.String sFilename) throws InconsistencyException, SyntaxErrException
sFilename
.
Each sentence is on a new line and is interpreted as a sentence for contraction.
sFilename
- the absolute path of the text file containing sentences one on each line.
InconsistencyException
- if any contraction sentence is a tautology.
SyntaxErrException
- if any sentence is syntactically malformed.public static java.util.Vector getCBICsFromFile(java.lang.String sFilename) throws SyntaxErrException
sFilename
.
Each sentence is on a new line and is interpreted as a consistency-based integrity constraint.
sFilename
- the absolute path of the text file containing sentences one on each line.
SyntaxErrException
- if any sentence is syntactically malformed.public static void containsIllegalLiterals(ISent s) throws SyntaxErrException
s
to see if any contains logical or reserved symbols.
s
- a reference to the ISent sentence whose literals are to be checked.
SyntaxErrException
- if any literal of s
contains any logical or reserved symbols.public static ISent parseString(java.lang.String s) throws SyntaxErrException
s
and returns the corresonponding ISent sentence.
s
- the string to be parsed as an ISent sentence.
s
.
SyntaxErrException
- if s
is syntactically malformed.static ISent parsePrimeString(java.lang.String s, java.util.Collection v, int n)
s
and returns an ISent sentence in which the literals also appearing in the
Vector v
are either numbered if n
is a positive integer or primed otherwise.
s
- the string to be parsed as an ISent sentence.v
- the Vector of literals to be checked against the literals of s
.n
- an int specifying whether the common literals of s
and v
are to be
numbered (if n
> 0) or primed (if n
<= 0).
s
.static ISent parseUnNumberString(java.lang.String s, java.util.Vector EqLit)
s
and returns an ISent sentence in which the numbered literals also appearing in
the Vector EqLit
are primed, and the numbered literals not in EqLit
are negated and primed.
s
- the string to be parsed as an ISent sentence.EqLit
- the Vector of literals to be checked against the numbered literals of s
.
s
.static ISent parseUnprimeString(java.lang.String s, java.util.Vector EqLit, java.util.Vector CA)
s
and returns an ISent sentence in which for each primed literal, it is either
negated and unprimed if it appears in Vector CA
and not in Vector EqLit
, or simply
unprimed otherwise.
s
- the string to be parsed as an ISent sentence.EqLit
- the Vector of literals to be checked against the primed literals of s
.CA
- the Vector of literals to be checked against the primed literals of s
.
s
.static ISent getContractResult(ISent AllKB, java.util.Vector CA, java.util.Vector EQLit)
AllKB
an ISent sentence in which the renaming of literals based on
the common atoms CA
and the equivalence set literals EQLit
is applied according to the
renaming algorithm following contractions.
AllKB
must be the ISent returned by parseUnprimeString( AllKB.getLabel(), equivalence set literals,
common atoms, literals in contraction sentences).
AllKB
- a reference to the resultant ISent knowledge base before it is conjoined with the revision.CA
- the Vector of common atoms to be checked against the literals of AllKB
.EQLit
- the Vector of equivalence set literals to be checked against the literals of AllKB
.
AllKB
after the renaming.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |