|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umbc.cs.daml4jess.Daml4Jess
Coming soon - out-of-dated stuff deleted.
Field Summary | |
static java.lang.String |
ANONYMOUS_PREDICATE
The relation used to denote anonymous objects. |
protected org.w3c.dom.Element |
configRoot_
The root element of the xml-based configuration document. |
protected java.lang.String |
currentDependencyId_
An id that the asserted facts depend on. |
protected int |
d4jLogLevel_
Controls the level of daml4jess (not Jess) log output. |
protected java.io.BufferedWriter |
d4jLogWriter_
Daml4Jess log writer. |
static java.lang.String |
DEPENDENCY_PREDICATE
Predicate name used to build dependency facts on which other facts depend (in the sense of the logical CE in Jess). |
static java.lang.String |
DEPENDENCY_PREFIX
A prefix string used to construct dependency (with logical CEs) rules. |
protected boolean |
insertAnonymous_
Indicator of whether to insert anonymous predicates to Jess (from the RDF data). |
static java.lang.String |
RDF_OBJ_SLOT
Jess template slot name for the "object" in an RDF statement. |
static java.lang.String |
RDF_PRED_SLOT
Jess template slot name for the "predicate" in an RDF statement. |
static java.lang.String |
RDF_SUBJ_SLOT
Jess template slot name for the "subject" in an RDF statement. |
static java.lang.String |
RDF_TEMPLATE
Jess template name for RDF statements. |
protected D4jRdf2Jess |
rdf2Facts_
Used to load RDF files and to break RDF statements into Jess facts or whatever format daml4jess can take. |
protected boolean |
recursiveImports_
Indicator of whether to load resources imported by the resource being loaded. |
protected jess.Rete |
rete_
The core Jess data structure, responsible for inference. |
protected boolean |
runJessAfterLoad_
Indicator of whether to do Rete.run() after loading a DAML resource. |
Fields inherited from interface edu.umbc.cs.daml4jess.D4jLogger |
LOG_LEVEL_BRIEF, LOG_LEVEL_ERR, LOG_LEVEL_INFO, LOG_LEVEL_VERBOSE, LOG_LEVEL_WARN, STDERR, STDIN, STDOUT |
Constructor Summary | |
Daml4Jess(java.io.InputStream configInputStream)
Constructor. |
Method Summary | |
void |
applyDAMLSemantics()
Applies DAML semantics such as error checking as well as calling Rete.run() to apply basic semantics rules of the language. |
void |
assertWithDependency(java.lang.String facts,
java.lang.String depId)
Assert the given facts with the given dependency id, such that these facts can be retracted via the dependency id. |
protected java.util.List |
getImports4Uri(java.lang.String uri)
Get the list of resoruces (no matter loaded or not) imported by the given resource (@ uri). |
jess.Rete |
getRete()
Returns the rete being used by the Daml4Jess object. |
protected java.io.Writer |
getWriterForName(java.lang.String fileName)
Get the writer for the given file name. |
void |
inputJessFile(java.lang.String filename)
Load Jess code from a file, using Jess batch command. |
protected boolean |
isResourceLoaded(java.lang.String uri)
check if the given resource has been loaded. |
void |
loadDAMLResource(java.io.InputStream istream,
java.lang.String xmlBase,
boolean useAssert)
Load daml resource from the given input stream. |
protected void |
loadDAMLResource(java.io.InputStream istream,
java.lang.String xmlBase,
boolean useAssert,
int nestLevel)
Load daml resource from the given input stream. |
void |
loadDAMLResource(java.lang.String uri)
Load daml resource from the given URI. |
void |
loadDAMLResource(java.lang.String uri,
boolean useAssert)
Load daml resource from the given URI. |
protected void |
loadDAMLResource(java.lang.String uri,
boolean useAssert,
int nestLevel)
Load daml resource from the given URI. |
void |
loadJessResourceWithClassLoader(java.lang.ClassLoader cl,
java.lang.String res)
Load Jess program (file) using the given class loader. |
void |
loadRDFResource(java.io.InputStream istream,
java.lang.String xmlBase,
boolean useAssert)
Load the RDF resource from the given input stream. |
void |
loadRDFResource(java.lang.String uri)
Load the RDF resource at the given URI. |
void |
loadRDFResource(java.lang.String uri,
boolean useAssert)
Load the RDF resource at the given URI. |
void |
log(java.lang.String msg,
int level)
Log the given message. |
void |
log(java.lang.String msg,
java.lang.Throwable t,
int level)
Log the given message and the exception. |
static void |
main(java.lang.String[] args)
Test program. |
boolean |
objectIsType(java.lang.String object,
java.lang.String type)
Query if the given object has the given type. |
java.util.Iterator |
query(java.lang.String queryName,
java.lang.String[] args)
Run the given (Jess) query with the given arguments and return the iterator of the results. |
java.util.List |
queryRdfSlot(java.lang.String queryName,
java.lang.String[] args,
java.lang.String slot)
Run a Jess query and return the list of values for the given RDF slot name of the first facts in each matching pattern. |
void |
setD4jLogLevel(int level)
Set daml4jess output level. |
java.io.Writer |
setD4jLogWriter(java.io.Writer w)
Set the log output writer. |
void |
setDependencyId(java.lang.String id)
Set the dependency id of the resources to be loaded. |
java.io.Reader |
setJessInputRouter(java.lang.String routerId,
java.io.Reader reader)
Set Jess input router. |
java.io.Writer |
setJessOutputRouter(java.lang.String routerId,
java.io.Writer w)
Set Jess output router. |
protected void |
sureLoadDAML(java.io.InputStream istream,
java.lang.String xmlBase,
boolean useAssert,
int nestLevel)
Load daml resource from the given input stream. |
protected void |
sureLoadRDF(java.io.InputStream istream,
java.lang.String xmlBase,
boolean useAssert)
Load the RDF resource from the given input stream. |
void |
typeCheck()
Checks to make sure all resources present in the KB have been given a type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String RDF_TEMPLATE
public static final java.lang.String RDF_SUBJ_SLOT
public static final java.lang.String RDF_PRED_SLOT
public static final java.lang.String RDF_OBJ_SLOT
public static final java.lang.String DEPENDENCY_PREDICATE
public static final java.lang.String DEPENDENCY_PREFIX
public static final java.lang.String ANONYMOUS_PREDICATE
protected boolean insertAnonymous_
protected boolean runJessAfterLoad_
protected boolean recursiveImports_
protected int d4jLogLevel_
protected org.w3c.dom.Element configRoot_
protected java.lang.String currentDependencyId_
protected jess.Rete rete_
protected D4jRdf2Jess rdf2Facts_
protected java.io.BufferedWriter d4jLogWriter_
Constructor Detail |
public Daml4Jess(java.io.InputStream configInputStream) throws D4jException
configInputStream
- the XML configuration input stream.
D4jException
- if anything goes wrong.Method Detail |
public jess.Rete getRete()
public void setD4jLogLevel(int level)
level
- daml4jess output level.public java.io.Writer setD4jLogWriter(java.io.Writer w)
w
- the output stream writer.
public void log(java.lang.String msg, int level)
log
in interface D4jLogger
msg
- the message to be logged.level
- the log level of this message.public void log(java.lang.String msg, java.lang.Throwable t, int level)
log
in interface D4jLogger
msg
- the message to be logged, can be null.t
- a the throwable to be logged, can be null.level
- the log level of this message.public java.io.Reader setJessInputRouter(java.lang.String routerId, java.io.Reader reader)
routerId
- the name of the router.reader
- the reader for the input router.
public java.io.Writer setJessOutputRouter(java.lang.String routerId, java.io.Writer w)
routerId
- the name of the router.w
- the writer for the output router.
public java.util.Iterator query(java.lang.String queryName, java.lang.String[] args) throws D4jException
queryName
- name of the Jess query to be executed.args
- the argument list for the query.
D4jException
- if anything goes wrong.public java.util.List queryRdfSlot(java.lang.String queryName, java.lang.String[] args, java.lang.String slot) throws D4jException
queryName
- name of the Jess query (defined by defquery).args
- the arguments to Jess query.
D4jException
- if anything goes wrong.public void loadJessResourceWithClassLoader(java.lang.ClassLoader cl, java.lang.String res) throws D4jException
cl
- the class loader with which to load the given Jess resource.res
- The name of the resource to be loaded.
D4jException
- if anything goes wrong.public void inputJessFile(java.lang.String filename) throws D4jException
filename
- the filename from which to load Jess code.
D4jException
- if anything goes wrong.public void loadRDFResource(java.lang.String uri) throws D4jException
uri
- The location from which to load the RDF data.
D4jException
- if anything goes wrong.public void loadRDFResource(java.lang.String uri, boolean useAssert) throws D4jException
uri
- The location from which to load the RDF data.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.
D4jException
- if anything goes wrong.public void loadRDFResource(java.io.InputStream istream, java.lang.String xmlBase, boolean useAssert) throws D4jException
istream
- the input stream from which to load the document.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.xmlBase
- the default xmlBase (uri) of the document. It should be
the same as the xml:base in the document (if specified) in
order for the system to work properly.
D4jException
- if anything goes wrong.protected void sureLoadRDF(java.io.InputStream istream, java.lang.String xmlBase, boolean useAssert) throws D4jException
istream
- the input stream from which to load the document.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.xmlBase
- the default xmlBase (uri) of the document. It should be
the same as the xml:base in the document (if specified) in
order for the system to work properly.
D4jException
- if anything goes wrong.public void assertWithDependency(java.lang.String facts, java.lang.String depId) throws D4jException
facts
- the facts to be asserted (with dependency).depId
- an id (if non null/empty) upon which the facts depend.
D4jException
- if anything goes wrong.public void loadDAMLResource(java.lang.String uri) throws D4jException
uri
- the uri from which to load the daml resource.
D4jException
- if anything goes wrong.public void loadDAMLResource(java.lang.String uri, boolean useAssert) throws D4jException
uri
- the uri from which to load the daml resource.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.
D4jException
- if anything goes wrong.public void loadDAMLResource(java.io.InputStream istream, java.lang.String xmlBase, boolean useAssert) throws D4jException
istream
- the input stream from which to load the daml resource.xmlBase
- the default xml base of the document. It should be
consistent with the xml:base in the document, if specified.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.
D4jException
- if anything goes wrong.public void setDependencyId(java.lang.String id)
public void applyDAMLSemantics() throws D4jException
D4jException
- if anything goes wrong.public void typeCheck()
public boolean objectIsType(java.lang.String object, java.lang.String type) throws D4jException
object
- the object to be checked for whether has the given type.type
- the type for the type check of the given object.
D4jException
- if anything goes wrong.protected void loadDAMLResource(java.lang.String uri, boolean useAssert, int nestLevel) throws D4jException
uri
- the uri from which to load the daml resource.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.nestLevel
- the current nested-level - initial level is 0;
resources imported by current level is level + 1.
D4jException
- if anything goes wrong.protected void loadDAMLResource(java.io.InputStream istream, java.lang.String xmlBase, boolean useAssert, int nestLevel) throws D4jException
istream
- the input stream from which to load the daml resource.xmlBase
- the default xml base of the document. It should be
consistent with the xml:base in the document, if specified.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.nestLevel
- the current nested-level - initial level is 0;
resources imported by current level is level + 1.
D4jException
- if anything goes wrong.protected void sureLoadDAML(java.io.InputStream istream, java.lang.String xmlBase, boolean useAssert, int nestLevel) throws D4jException
istream
- the input stream from which to load the daml resource.xmlBase
- the default xml base of the document. It should be
consistent with the xml:base in the document, if specified.useAssert
- if true, facts will be asserted to Jess;
if false, facts will be added via deffacts.nestLevel
- the current nested-level - initial level is 0;
resources imported by current level is level + 1.
D4jException
- if anything goes wrong.protected java.util.List getImports4Uri(java.lang.String uri) throws D4jException
uri
- uri of the resource whose imports list is to be retrieved.
D4jException
- if anything goes wrong.protected boolean isResourceLoaded(java.lang.String uri) throws D4jException
uri
- uri of the resource to be checked.
D4jException
- if anything goes wrong.protected java.io.Writer getWriterForName(java.lang.String fileName) throws D4jException
fileName
- name of the file whose writer will be retrieved.
Note that stdin, stdout, and stderr are used to refer standard
input, standard output, and standard err output, respectively.
D4jException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |