Package com.semedy.reasoner.rewriter
Class FullFolderRewriter
java.lang.Object
com.semedy.reasoner.rewriter.FullFolderRewriter
- All Implemented Interfaces:
Rewriter
folds rules. For instance given two rules: p(?X,?Y) :- q(?X),s(?X),r(?X,?Y). r(?U) :- q(?U),t(?U),r(?U,?Y).
They can be replaced by the following rules:
u(?X,?Y) :- q(?X),r(?X,?Y). // outfolded rule p(?X,?Y) :- u(?X,?Y),s(?X). r(?U) :- u(?U,?Y),t(?U).
The first set of rules needs 4 joins to be evaluated, the
second set of rules needs 3 joins only to be evaluated
They can be replaced by the following rules:
u(?X,?Y) :- q(?X),r(?X,?Y). // outfolded rule p(?X,?Y) :- u(?X,?Y),s(?X). r(?U) :- u(?U,?Y),t(?U).
The first set of rules needs 4 joins to be evaluated, the
second set of rules needs 3 joins only to be evaluated
- Author:
- angele
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionget a description for the rewritergetName()
get the name of a rewriterboolean
indicates whether rewriter has to read the symbol tablerewrite
(IntensionalDB idb, ExtensionalDB[] edbs, SymbolTable symbolTable, ExternalDataTypeProvider datatypes, Configuration config) applies the rewriter to a set of rulesvoid
setBuiltinProvider
(BuiltinProvider builtinProvider) sets the built-in provider for the rewritervoid
setProperties
(Properties prp) set propertiesvoid
setStatistics
(SystemMonitor statistics) adds a system monitor which has run time data about rules.boolean
indicates whether rewriter modifies the symbol table
-
Constructor Details
-
FullFolderRewriter
public FullFolderRewriter()
-
-
Method Details
-
getName
Description copied from interface:Rewriter
get the name of a rewriter -
getDescription
Description copied from interface:Rewriter
get a description for the rewriter- Specified by:
getDescription
in interfaceRewriter
- Returns:
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Rewriter
indicates whether rewriter has to read the symbol table- Specified by:
readsSymbolTable
in interfaceRewriter
- Returns:
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Rewriter
indicates whether rewriter modifies the symbol table- Specified by:
writesSymbolTable
in interfaceRewriter
- Returns:
-
setBuiltinProvider
Description copied from interface:Rewriter
sets the built-in provider for the rewriter- Specified by:
setBuiltinProvider
in interfaceRewriter
-
rewrite
public IntensionalDB rewrite(IntensionalDB idb, ExtensionalDB[] edbs, SymbolTable symbolTable, ExternalDataTypeProvider datatypes, Configuration config) throws InterruptedException, RewriterException, IOException Description copied from interface:Rewriter
applies the rewriter to a set of rules- Specified by:
rewrite
in interfaceRewriter
- Parameters:
idb
- , intensional databaseedbs
- , extensional databases, the last one is used for snapshot transaction datasymbolTable
- , symbol tabledatatypes
- , the external datatypesconfig
- , configuration- Returns:
- Throws:
InterruptedException
RewriterException
IOException
-
setStatistics
Description copied from interface:Rewriter
adds a system monitor which has run time data about rules.- Specified by:
setStatistics
in interfaceRewriter
-
setProperties
Description copied from interface:Rewriter
set properties- Specified by:
setProperties
in interfaceRewriter
-