|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umbc.cs.daml4jess.D4jRdf2Jess
This class is basically a rewrite of the DAMLJessFactCollector class. Loads an RDF resource using ARP parser and turn RDF statements into unordered Jess facts (templated). Basically each rdf statement is translated into a Jess fact. For anonymous nodes, an anonymous fact will be inserted (if flag is on) for each anonymous node. If an object (in an RDF statement) is a literal and the predicate is not "rdf:value", three more facts will be inserted: (1) give the literal a name and insert an anonymous fact (using the name). (2) the literal (referred using the name) has the type rdf:type, and (3) the literal (referred using the name) has the value of its string value.
Field Summary | |
protected com.hp.hpl.jena.rdf.arp.ARP |
arp_
The ARP RDF parser. |
protected java.lang.String |
defaultRdfXmlBase_
Default RDF resource xml base. |
protected java.util.List |
facts_
The list facts translated from RDF statements. |
protected java.util.List |
imports_
The list of imported resources (if any) in the document. |
protected boolean |
insertAnonymous_
|
protected D4jLogger |
logger_
|
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 | |
D4jRdf2Jess()
Constructor. |
Method Summary | |
java.util.List |
getImports()
Get the list of imported resources (by this document). |
protected java.lang.String |
getUniqueId(java.lang.String prefix)
Generate a unique id with the default xml base (of the current resource being loaded), and the given prefix. |
java.util.List |
loadFromInputStream(java.io.InputStream istream,
java.lang.String xmlBase)
Load rdf resource from the given input stream. |
java.util.List |
loadFromReader(java.io.Reader reader,
java.lang.String xmlBase)
Load rdf resource from the given reader. |
java.util.List |
loadFromUri(java.lang.String rdfUrl)
Load RDF data and convert it into Jess facts string. |
void |
log(java.lang.String msg,
int level)
Log the given message at the given level. |
void |
log(java.lang.String msg,
java.lang.Throwable t,
int level)
Log the given message at the given level. |
static void |
main(java.lang.String[] args)
A simple test program which outputs RDF data as Jess facts. |
void |
setInsertAnonymous(boolean insertAnonymous)
Set the flag of whether to insert (include) anonymous predicates (from the anonymous node). |
void |
setLogger(D4jLogger logger)
Set the logger, which will be used for logging information. |
void |
statement(com.hp.hpl.jena.rdf.arp.AResource subj,
com.hp.hpl.jena.rdf.arp.AResource pred,
com.hp.hpl.jena.rdf.arp.ALiteral lit)
Handling a RDF statement. |
void |
statement(com.hp.hpl.jena.rdf.arp.AResource subj,
com.hp.hpl.jena.rdf.arp.AResource pred,
com.hp.hpl.jena.rdf.arp.AResource obj)
Handling a RDF statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected com.hp.hpl.jena.rdf.arp.ARP arp_
protected java.util.List facts_
protected java.util.List imports_
protected java.lang.String defaultRdfXmlBase_
protected boolean insertAnonymous_
protected D4jLogger logger_
Constructor Detail |
public D4jRdf2Jess()
Method Detail |
public void setInsertAnonymous(boolean insertAnonymous)
public void setLogger(D4jLogger logger)
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.for more details.
public void log(java.lang.String msg, java.lang.Throwable t, int level)
log
in interface D4jLogger
msg
- the message to be logged.level
- the log level of this message.t
- a the throwable to be logged, can be null.for more details.
public java.util.List loadFromUri(java.lang.String rdfUrl) throws D4jException
rdfUrl
- Location to read RDF from. May be a filename or URL.
D4jException
- if anything goes wrong.public java.util.List loadFromInputStream(java.io.InputStream istream, java.lang.String xmlBase) throws D4jException
xmlBase
- the default xml base (if not specified in document).istream
- the input stream from which to load the document.
D4jException
- if anything goes wrong.public java.util.List loadFromReader(java.io.Reader reader, java.lang.String xmlBase) throws D4jException
xmlBase
- the default xml base (if not specified in data).
Note that it will be canonicalized (if not yet).
D4jException
- if anything goes wrong.public java.util.List getImports()
public void statement(com.hp.hpl.jena.rdf.arp.AResource subj, com.hp.hpl.jena.rdf.arp.AResource pred, com.hp.hpl.jena.rdf.arp.AResource obj)
statement
in interface com.hp.hpl.jena.rdf.arp.StatementHandler
public void statement(com.hp.hpl.jena.rdf.arp.AResource subj, com.hp.hpl.jena.rdf.arp.AResource pred, com.hp.hpl.jena.rdf.arp.ALiteral lit)
statement
in interface com.hp.hpl.jena.rdf.arp.StatementHandler
protected java.lang.String getUniqueId(java.lang.String prefix)
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 |