Package com.semedy.reasoner.rewriter
Class QueryRuleRewriter
java.lang.Object
com.semedy.reasoner.rewriter.QueryRuleRewriter
- All Implemented Interfaces:
Rewriter
This rewriter creates a rule and a simplified query out of a complex query.
E.g. given a query ?- ?X:Offer, ?X[location: ?L], ?L[address: ?A], ?A[city: ?C], oneOf(?C,"Herxheim","Kandel"). This rewriter then generates a query:
?- query(?X,?L,?A,?C).
and a rule:
query(?X,?L,?A,?C) :- ?X:Offer, ?X[location: ?L], ?L[address: ?A], ?A[city: ?C], oneOf(?C,"Herxheim","Kandel").
E.g. given a query ?- ?X:Offer, ?X[location: ?L], ?L[address: ?A], ?A[city: ?C], oneOf(?C,"Herxheim","Kandel"). This rewriter then generates a query:
?- query(?X,?L,?A,?C).
and a rule:
query(?X,?L,?A,?C) :- ?X:Offer, ?X[location: ?L], ?L[address: ?A], ?A[city: ?C], oneOf(?C,"Herxheim","Kandel").
- Author:
- angele
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget a description for the rewritergetName()get the name of a rewriterbooleanindicates whether rewriter has to read the symbol tablerewrite(IntensionalDB idb, ExtensionalDB[] edbs, SymbolTable symbols, ExternalDataTypeProvider datatypes, Configuration config) applies the rewriter to a set of rulesvoidsetBuiltinProvider(BuiltinProvider builtinProvider) sets the built-in provider for the rewritervoidsetProperties(Properties prp) set propertiesvoidsetStatistics(SystemMonitor _statistics) adds a system monitor which has run time data about rules.booleanindicates whether rewriter modifies the symbol table
-
Constructor Details
-
QueryRuleRewriter
public QueryRuleRewriter()
-
-
Method Details
-
getName
Description copied from interface:Rewriterget the name of a rewriter -
getDescription
Description copied from interface:Rewriterget a description for the rewriter- Specified by:
getDescriptionin interfaceRewriter- Returns:
-
readsSymbolTable
public boolean readsSymbolTable()Description copied from interface:Rewriterindicates whether rewriter has to read the symbol table- Specified by:
readsSymbolTablein interfaceRewriter- Returns:
-
writesSymbolTable
public boolean writesSymbolTable()Description copied from interface:Rewriterindicates whether rewriter modifies the symbol table- Specified by:
writesSymbolTablein interfaceRewriter- Returns:
-
setBuiltinProvider
Description copied from interface:Rewritersets the built-in provider for the rewriter- Specified by:
setBuiltinProviderin interfaceRewriter
-
rewrite
public IntensionalDB rewrite(IntensionalDB idb, ExtensionalDB[] edbs, SymbolTable symbols, ExternalDataTypeProvider datatypes, Configuration config) throws IOException, SemReasonerException Description copied from interface:Rewriterapplies the rewriter to a set of rules- Specified by:
rewritein interfaceRewriter- Parameters:
idb- , intensional databaseedbs- , extensional databases, the last one is used for snapshot transaction datasymbols- , symbol tabledatatypes- , the external datatypesconfig- , configuration- Returns:
- Throws:
IOExceptionRewriterExceptionSemReasonerException
-
setStatistics
Description copied from interface:Rewriteradds a system monitor which has run time data about rules.- Specified by:
setStatisticsin interfaceRewriter
-
setProperties
Description copied from interface:Rewriterset properties- Specified by:
setPropertiesin interfaceRewriter
-