|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.umbc.cs.daml4jess.DjkToD4j
The main function is to convert the ordered-fact based DAMLJessKB rules/axioms into unordered-fact (template) based rules/axioms. E.g., from (PropertyValue daml#subClassOf my#SUV my#Car) to: (D4jRdfStatement (subject SUV) (predicate subClassOf) (object Car)) Efforts have been given to make the result rules readable and to keep the comments in place, but they may not look as good as desired. Note that if your rules file has tabs in it, it's recommended that you change them to spaces (e.g, using unix "pr" command). This converter does not attempt to retain tab related formating mainly because people may use different tab settings with their editor. Also Note that the template is not defined in the resulting file. A backup version of the old file will be saved, with an extension as configured (or default). A real parser could have been used to do the job more neatly but thought a simple piece of code might be sufficient - unfortunately it didn't quite turn out that way. This class is intended to be used as a utility, not quite designed to work with other classes.
Nested Class Summary | |
protected static class |
DjkToD4j.StatementInfo
Internal class for statement information: old statement (before conversion) information and the new statement after conversion. |
Field Summary | |
protected java.lang.String |
backupExt_
|
protected java.lang.String |
commentSym_
|
protected int |
indentStep_
|
protected java.lang.String |
newLine_
|
protected java.lang.String |
object_
|
protected java.lang.String |
oldHead_
|
protected java.lang.String |
predicate_
|
protected java.lang.String |
subject_
|
protected java.lang.String |
tmplName_
|
Constructor Summary | |
DjkToD4j(java.util.Properties properties)
Constructor, using the given configurations. |
Method Summary | |
protected void |
convert(java.lang.String fileName)
Convert the jess rules in the given file into slot-based jess rules. |
static void |
main(java.lang.String[] args)
Main function. |
protected DjkToD4j.StatementInfo |
nextStatement(java.lang.String data,
int startIndex)
Locate the next statement to convert, convert it, and return the statement information. |
protected int |
nextStatementStart(java.lang.String data,
int startIndex)
Find the start index of next POSSIBLE statement. |
protected java.lang.String |
templatize(java.lang.String rulesData)
Convert the jess rules in the given string into slot-based jess rules. |
protected java.lang.String |
templatizeStatment(java.lang.String oldStmt,
int initIndent)
This is where an old statement is converted to a new statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String newLine_
protected java.lang.String oldHead_
protected java.lang.String tmplName_
protected java.lang.String subject_
protected java.lang.String predicate_
protected java.lang.String object_
protected int indentStep_
protected java.lang.String backupExt_
protected java.lang.String commentSym_
Constructor Detail |
public DjkToD4j(java.util.Properties properties)
Method Detail |
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
protected void convert(java.lang.String fileName) throws java.io.IOException
java.io.IOException
protected java.lang.String templatize(java.lang.String rulesData)
protected DjkToD4j.StatementInfo nextStatement(java.lang.String data, int startIndex)
protected int nextStatementStart(java.lang.String data, int startIndex)
protected java.lang.String templatizeStatment(java.lang.String oldStmt, int initIndent)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |