|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmln.MarkovLogicNetwork
public class MarkovLogicNetwork
An MLN. Holds the symbol table.
Constructor Summary | |
---|---|
MarkovLogicNetwork()
Constructor of MLN. |
Method Summary | |
---|---|
void |
applyAllScopes()
Execute all scoping rules |
boolean |
cleanUp()
Clean up temporary data in DB and working dir, including 1) drop schema in PostgreSQL; 2) remove directory. |
void |
closeFiles()
Close all file handles used by each predicate in listPred . |
void |
createActTables()
Create database table related to active atoms. |
void |
destroyActTables()
Drop active tables created by createActTables() |
void |
dumpMapAnswer(java.lang.String fout)
Dump a MAP world produced by MAP inference. |
void |
dumpSoftEvidence(java.lang.String fout)
Write soft evidence to a file. |
void |
executeAllDatalogRules()
Execute all Datalog rules |
java.util.ArrayList<Clause> |
getAllNormalizedClauses()
Return all normalized clauses. |
java.util.HashSet<Predicate> |
getAllPred()
Return the set of all predicates. |
java.util.ArrayList<Predicate> |
getAllPredOrderByName()
|
java.util.ArrayList<Clause> |
getAllUnnormalizedClauses()
Return all unnormalized clauses as read from the input file. |
Clause |
getClauseById(int id)
Get clause object by integer ID. |
Function |
getFunctionByName(java.lang.String name)
Get a function by its name; can be built-in. |
int |
getNumPredicates()
Returns the total count of predicates in this MLN. |
Type |
getOrCreateTypeByName(java.lang.String name)
Return the type of a given name; create if this type does not exist. |
Predicate |
getPredByName(java.lang.String name)
Return the predicate of the given name; null if such predicate does not exist. |
Predicate |
getPredicateByAtomID(int aid)
Decodes the predicate from an atom id. |
RDB |
getRDB()
Returns the RDB used by this MLN. |
java.util.HashSet<Clause> |
getRelevantClauses()
Returns the set of relevant clauses. |
int |
getSymbolID(java.lang.String symbol,
Type type)
Return assigned ID of a constant symbol. |
static void |
initStatic()
|
boolean |
isScoped(Predicate p)
Test whether a predicate is scoped |
void |
loadEvidences(java.lang.String[] evidFiles)
Parse multiple MLN evidence files. |
void |
loadPrograms(java.lang.String[] progFiles)
Parse multiple MLN program files. |
void |
loadQueries(java.lang.String[] queryFiles)
Parse multiple MLN query files. |
void |
materializeTables()
Stores constants and evidence into database table. |
void |
normalizeClauses()
Normalize all clauses. |
void |
parseQueryCommaList(java.lang.String queryAtoms)
Read in the query atoms provided by the command line. |
void |
prepareDB(RDB adb)
Prepare the database for each predicate and clause. |
void |
registerClause(Clause c)
Registers a new, unnormalized clause. |
void |
registerDatalogRule(ConjunctiveQuery cq)
Add a datalog rule |
void |
registerPred(Predicate p)
Register a new predicate. |
void |
registerScopingRule(ConjunctiveQuery cq)
Add a scoping rule |
void |
setClauseAsRelevant(Clause c)
Marks a clause as relevant. |
void |
storeAllEvidence()
Store all evidences into the database by flushing the "buffers". |
void |
storeAllQueries()
Ground and store all query atoms. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MarkovLogicNetwork()
parser
will be
constructed here.
Method Detail |
---|
public void applyAllScopes()
public boolean cleanUp()
public void closeFiles()
listPred
.
public void createActTables()
Predicate.getRelAct()
.
The schema of this table is like
public void destroyActTables()
createActTables()
public void dumpMapAnswer(java.lang.String fout)
fout
- path of output filepublic void dumpSoftEvidence(java.lang.String fout)
fout
- public void executeAllDatalogRules()
public java.util.ArrayList<Clause> getAllNormalizedClauses()
public java.util.HashSet<Predicate> getAllPred()
public java.util.ArrayList<Predicate> getAllPredOrderByName()
public java.util.ArrayList<Clause> getAllUnnormalizedClauses()
public Clause getClauseById(int id)
id
- ID of wanted clause.public Function getFunctionByName(java.lang.String name)
name
- public int getNumPredicates()
public Type getOrCreateTypeByName(java.lang.String name)
public Predicate getPredByName(java.lang.String name)
public Predicate getPredicateByAtomID(int aid)
aid
- the atom id
Predicate.setID(int)
public RDB getRDB()
public java.util.HashSet<Clause> getRelevantClauses()
public int getSymbolID(java.lang.String symbol, Type type)
public static void initStatic()
public boolean isScoped(Predicate p)
public void loadEvidences(java.lang.String[] evidFiles)
GZIPInputStream.GZIPInputStream(InputStream)
).
evidFiles
- list of MLN evidence files (in Alchemy format)public void loadPrograms(java.lang.String[] progFiles)
progFiles
- list of MLN program files (in Alchemy format)public void loadQueries(java.lang.String[] queryFiles)
queryFiles
- list of MLN query files (in Alchemy format)public void materializeTables()
materializeAllTypes(RDB)
,
storeAllEvidence()
,
RDB.createConstantTable(Hashtable)
public void normalizeClauses()
listClauses
,
then Clause.absorb(Clause)
this new clause. If not
absorbed, this new clause is set an ID sequentially and a name
Clause$id. Predicates in this clause is registered
by Predicate.addRelatedClause(Clause)
.
Clause.normalize()
,
Clause.absorb(Clause)
public void parseQueryCommaList(java.lang.String queryAtoms)
public void prepareDB(RDB adb)
Predicate.prepareDB(RDB)
,
finalizeClauseDefinitions(RDB)
public void registerClause(Clause c)
c
- the clause to be registeredpublic void registerDatalogRule(ConjunctiveQuery cq)
cq
- public void registerPred(Predicate p)
listPred
; 3)
building the map from predicate name to this predicate.
public void registerScopingRule(ConjunctiveQuery cq)
cq
- public void setClauseAsRelevant(Clause c)
KBMC.run()
public void storeAllEvidence()
Predicate.getRelName()
in the database.
public void storeAllQueries()
Predicate.addQuery(Atom)
,
Predicate.groundAndStoreAtom(Atom)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |