Interface ModelAPI
public interface ModelAPI
Unified interface for InteGraal's internal model API.
Gives access to main Integraal services: environment management, creation/management/import/export of main Integraal primitives and primitive collections, evaluation/chasing/rewriting operations and some additional functionalities as compilation and rule set analysis.
An instance is available via InternalServices.model().
The static facades InternalAPI and ReasoningAPI remain for
backward compatibility and delegate to the same implementation.
-
Method Summary
Modifier and TypeMethodDescriptionCopies a fact base.Copies a rule base.copy(UnionFOQuery query) Copies a query.Copies a rule.copy(Collection<UnionFOQuery> queries) Copies a collection of queries.copyFBC(Collection<FactBase> factbases) Copies a fact base collection.coreChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWcoreChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies coreChase to the supplied readable source and writable target.createAnalyser(RuleBase rulebase) Creates an analyser for a rule base.createCompilation(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation compilation) Creates a compilation for a rule base.createCompilation(RuleBase ruleBase, String compilationType) Creates a compilation for a rule base using a compilation type.Creates a new environment.createFactBase(IntegraalEnvironment env, InputStream dlgpe) Creates a fact base from DLGPE content read from a stream.createFactBase(IntegraalEnvironment env, String dlgpe) Creates a fact base from DLGPE content.createFactBaseCollection(IntegraalEnvironment env, String dlgpe) Creates a collection of fact bases from DLGPE content.createJoinedFactBase(IntegraalEnvironment env, String dlgpe) Creates a joined fact base from DLGPE content.createQuery(IntegraalEnvironment env, String dlgpe) Creates a query from DLGPE content.createQueryCollection(IntegraalEnvironment env, String dlgpe) Creates a query collection from DLGPE content.createRule(IntegraalEnvironment env, String dlgpe) Creates a rule from DLGPE content.createRuleBase(IntegraalEnvironment env, String dlgpe) Creates a rule base from DLGPE content.createRuleBaseFromRules(Collection<FORule> rules) Creates a rule base from a collection of rules.customChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWcustomChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies customChase to the supplied readable source and writable target.Decomposes a rule base.defaultChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) default <RW extends MaterializedData & Writable>
RWdefaultChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies the standard chase to the supplied readable source and writable target.delegatedDatalogChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWdelegatedDatalogChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies delegatedDatalogChase to the supplied readable source and writable target.evaluate(IntegraalEnvironment env, QueryableData data, Query query, IGParameter<InteGraalKeywords, ?>... params) Evaluates a query on the supplied data combined with the environment views.evaluate(IntegraalEnvironment env, QueryableData data, Query query, Substitution preHom, IGParameter<InteGraalKeywords, ?>... params) Evaluates a query on the supplied data combined with the environment views with a pre-homomorphism.evaluateRew(FactBase fb, Query query, RuleBase rb, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilationType, ExternalHaltingCondition... conds) Evaluates a query after rewriting it with a rule base.evaluateSat(FactBase fb, Query query, RuleBase rb, IAlgorithmParameters algoParam) Evaluates a query after saturating the fact base with a rule base.exportPrintable(fr.inria.rules.dlgpemodel.api.sentences.IPrintable printable) Exports a printable object.exportPrintable(IntegraalEnvironment env, fr.inria.rules.dlgpemodel.api.sentences.IPrintable printable) Exports a printable object using the given environment.voidexportPrintable(IntegraalEnvironment env, fr.inria.rules.dlgpemodel.api.sentences.IPrintable printable, Appendable out) Exports a printable object to an appendable output.extractCompilableRules(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Extracts the compilable rules from a rule base.extractNonCompilableRules(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Extracts the non-compilable rules from a rule base.formatSubstitutions(IntegraalEnvironment environment, Collection<Substitution> substitutions) Formats substitutions into string maps.static ModelAPIget()Returns the singleton model API instance.inMemoryDatalogChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWinMemoryDatalogChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies inMemoryDatalogChase to the supplied readable source and writable target.isDecidable(RuleBase ruleBase) Checks whether a rule base is decidable.Checks whether a rule base is FES.Checks whether a rule base is FUS.Checks whether two rule bases form a hybrid rule base.isHybridable(RuleBase ruleBase) Checks whether a rule base is hybridable.linearRuleChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWlinearRuleChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies linearRuleChase to the supplied readable source and writable target.default FactBaselinearRulesChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Deprecated, for removal: This API element is subject to removal in a future version.default <RW extends MaterializedData & Writable>
RWlinearRulesChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Deprecated, for removal: This API element is subject to removal in a future version.loadAll(IntegraalEnvironment env, String dlgpe) Loads all supported objects from DLGPE content.loadAllFromFile(IntegraalEnvironment env, String path) Loads all supported objects from a file.loadFactBase(IntegraalEnvironment env, String filePath, IGParameter<InteGraalKeywords, ?>... storageParams) Loads a fact base from the specified path with given configuration parameters.loadFactBase(IntegraalEnvironment env, Collection<String> filePaths, IGParameter<InteGraalKeywords, ?>... storageParams) Loads facts from multiple files into the specified or default storage component.loadFromDLGPE(IntegraalEnvironment env, InputStream stream, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) Loads and parses DLGPE content from an input stream.loadFromDLGPEFile(IntegraalEnvironment env, String dlgpefile, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) Loads and parses DLGPE content from a file.loadFromDLGPEString(IntegraalEnvironment env, String dlgpeString, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) Loads and parses DLGPE content from a string.loadFromDLGPString(String dlgp, boolean getFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) Loads and parses DLGP content from a string.loadKnowledgeBase(IntegraalEnvironment env, String kbPath, IGParameter<InteGraalKeywords, ?>... params) Loads a knowledge base (rules and facts) from the specified path with given configuration parameters.loadKnowledgeBase(IntegraalEnvironment env, String rulesPath, String factBasePath, IGParameter<InteGraalKeywords, ?>... params) Loads a knowledge base by reading rules and facts from separate files.loadKnowledgeBase(IntegraalEnvironment env, Collection<String> kbPaths, IGParameter<InteGraalKeywords, ?>... params) Loads a Knowledge Base from a collection of paths containing rules and facts.loadRuleBase(IntegraalEnvironment env, String path, IGParameter<InteGraalKeywords, ?>... params) Loads a rule base from the specified path with given configuration parameters.loadRuleBase(IntegraalEnvironment env, Collection<String> paths, IGParameter<InteGraalKeywords, ?>... params) Return a Rule Base containing the rules loaded from a collection of paths.voidmergeInPlace(IntegraalEnvironment env, FactBase fb, FactBase other) Merges a fact base into another one in place.mergeInPlace(IntegraalEnvironment env, FactBase fb, FactBase other, Substitution subst, boolean freeze) Merges a fact base into another one in place with substitution and freezing options.nextAnswers(Iterator<Substitution> subIt, IGParameter<InteGraalKeywords, ?>... params) Retrieves the next answers from an iterator of substitutions.obliviousChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWobliviousChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies the oblivious chase to the supplied readable source and writable target.parseCompilationType(String compilationType) Parses a compilation type string.List<fr.inria.rules.dlgpemodel.api.sentences.ISentence> parseDLGPE(IntegraalEnvironment env, String dlgpe) Parses a DLGPE string in the given environment.parseSubstitution(IntegraalEnvironment environment, String json) Parses a substitution from its JSON representation.booleanregisterViewDefinitions(IntegraalEnvironment env, String vdFilePath) Registers datasource and view definitions from the supplied VD file in the environment, preserving previously registered definitions.booleanregisterViewDefinitions(IntegraalEnvironment env, Collection<String> vdFilePaths) Registers datasource and view definitions from the supplied VD files in the environment, preserving previously registered definitions.removeInPlace(IntegraalEnvironment env, FactBase fb, FactBase other, Substitution subst) Removes facts from a fact base in place.rewrite(RuleBase rb, Query query, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilationType) Rewrites a query with respect to a rule base and a compilation strategy.rewrite(Query query, CompilationResult compiled) Rewrites a query using a precomputed compilation.saturate(FactBase fb, RuleBase rb, IAlgorithmParameters algoParam) Deprecated.semiObliviousChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWsemiObliviousChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies the semi-oblivious chase to the supplied readable source and writable target.standardChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) <RW extends MaterializedData & Writable>
RWstandardChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Applies the standard chase and returns the supplied writing target.stratifiedChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Runs the pseudo-minimal stratified chase using the environment's registered views.<RW extends MaterializedData & Writable>
RWstratifiedChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) Runs a stratified chase using pseudo-minimal stratification.unfold(RuleBase ruleBase, Collection<Query> queries, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Unfolds queries with respect to a rule base.
-
Method Details
-
get
-
createEnvironment
IntegraalEnvironment createEnvironment()Creates a new environment.- Returns:
- the created environment.
-
registerViewDefinitions
boolean registerViewDefinitions(IntegraalEnvironment env, String vdFilePath) throws ViewBuilder.ViewBuilderException Registers datasource and view definitions from the supplied VD file in the environment, preserving previously registered definitions.- Parameters:
env- the environment to enrichvdFilePath- the VD file to register- Returns:
- true if the file was registered successfully
- Throws:
ViewBuilder.ViewBuilderException- if the file cannot be registered
-
registerViewDefinitions
boolean registerViewDefinitions(IntegraalEnvironment env, Collection<String> vdFilePaths) throws ViewBuilder.ViewBuilderException Registers datasource and view definitions from the supplied VD files in the environment, preserving previously registered definitions.Files are registered sequentially. If registration fails, definitions registered before the failure remain in the environment.
- Parameters:
env- the environment to enrichvdFilePaths- the VD files to register- Returns:
- true if all supplied files were registered successfully
- Throws:
ViewBuilder.ViewBuilderException- if a file cannot be registered
-
loadFactBase
FactBase loadFactBase(IntegraalEnvironment env, String filePath, IGParameter<InteGraalKeywords, ?>... storageParams) throws ParseException, IGParameterException Loads a fact base from the specified path with given configuration parameters.- Parameters:
env- the environment used for parsingfilePath- the file path to loadstorageParams- configuration parameters for the fact base- Returns:
- the loaded fact base
- Throws:
ParseException- if parsing failsIGParameterException- if parameter handling fails
-
loadFactBase
FactBase loadFactBase(IntegraalEnvironment env, Collection<String> filePaths, IGParameter<InteGraalKeywords, ?>... storageParams) throws ParseException, IGParameterException Loads facts from multiple files into the specified or default storage component.- Throws:
ParseExceptionIGParameterException
-
loadRuleBase
RuleBase loadRuleBase(IntegraalEnvironment env, String path, IGParameter<InteGraalKeywords, ?>... params) throws ParseException, IGParameterException Loads a rule base from the specified path with given configuration parameters.- Parameters:
env- the environment used for parsingpath- the file path to loadparams- configuration parameters for the rule base- Returns:
- the loaded rule base
- Throws:
ParseException- if parsing failsIGParameterException- if parameter handling fails
-
loadRuleBase
RuleBase loadRuleBase(IntegraalEnvironment env, Collection<String> paths, IGParameter<InteGraalKeywords, ?>... params) throws ParseException, IGParameterException Return a Rule Base containing the rules loaded from a collection of paths. The loaded rules are converted to FO rules using the default translator if applicable.- Throws:
ParseExceptionIGParameterException
-
loadKnowledgeBase
KnowledgeBase loadKnowledgeBase(IntegraalEnvironment env, String kbPath, IGParameter<InteGraalKeywords, ?>... params) throws ParseException, IGParameterException Loads a knowledge base (rules and facts) from the specified path with given configuration parameters. This method assumes both rules and facts are present in the same file.- Parameters:
env- the environment used for parsingkbPath- the file path to load containing both rules and factsparams- configuration parameters for the knowledge base- Returns:
- the loaded knowledge base
- Throws:
ParseException- if parsing failsIGParameterException- if parameter handling fails
-
loadKnowledgeBase
KnowledgeBase loadKnowledgeBase(IntegraalEnvironment env, Collection<String> kbPaths, IGParameter<InteGraalKeywords, ?>... params) throws ParseException, IGParameterException Loads a Knowledge Base from a collection of paths containing rules and facts.- Throws:
ParseExceptionIGParameterException
-
loadKnowledgeBase
KnowledgeBase loadKnowledgeBase(IntegraalEnvironment env, String rulesPath, String factBasePath, IGParameter<InteGraalKeywords, ?>... params) throws ParseException, IGParameterException Loads a knowledge base by reading rules and facts from separate files.- Parameters:
env- the environment used for parsingrulesPath- the file path to load rules fromfactBasePath- the file path to load facts fromparams- configuration parameters for the knowledge base- Returns:
- the loaded knowledge base
- Throws:
ParseException- if parsing failsIGParameterException- if parameter handling fails
-
createFactBase
Creates a fact base from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created fact base.
- Throws:
Exception- if parsing fails.
-
createFactBase
Creates a fact base from DLGPE content read from a stream.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE input stream.- Returns:
- the created fact base.
- Throws:
Exception- if parsing fails.
-
createJoinedFactBase
Creates a joined fact base from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created joined fact base.
- Throws:
Exception- if parsing fails.
-
createFactBaseCollection
Collection<FactBase> createFactBaseCollection(IntegraalEnvironment env, String dlgpe) throws Exception Creates a collection of fact bases from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created fact base collection.
- Throws:
Exception- if parsing fails.
-
createRuleBase
Creates a rule base from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created rule base.
- Throws:
Exception- if parsing fails.
-
createQueryCollection
Collection<UnionFOQuery> createQueryCollection(IntegraalEnvironment env, String dlgpe) throws Exception Creates a query collection from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created query collection.
- Throws:
Exception- if parsing fails.
-
createQuery
Creates a query from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created query.
- Throws:
Exception- if parsing fails.
-
createRule
Creates a rule from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the created rule.
- Throws:
Exception- if parsing fails.
-
loadAll
Loads all supported objects from DLGPE content.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content.- Returns:
- the parsing result.
- Throws:
Exception- if parsing fails.
-
loadAllFromFile
Loads all supported objects from a file.- Parameters:
env- the environment used for parsing.path- the file path.- Returns:
- the parsing result.
- Throws:
Exception- if parsing fails.
-
parseDLGPE
List<fr.inria.rules.dlgpemodel.api.sentences.ISentence> parseDLGPE(IntegraalEnvironment env, String dlgpe) throws Exception Parses a DLGPE string in the given environment.- Parameters:
env- the environment used for parsing.dlgpe- the DLGPE content to parse.- Returns:
- the parsed sentences.
- Throws:
Exception- if parsing fails.
-
loadFromDLGPEFile
ParsingResult loadFromDLGPEFile(IntegraalEnvironment env, String dlgpefile, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) throws Exception Loads and parses DLGPE content from a file.- Parameters:
env- the environment used for parsing.dlgpefile- the path to the DLGPE file.joinFacts- whether parsed fact bases should be joined.minFacts- the minimum number of fact bases expected.maxFacts- the maximum number of fact bases expected.minRules- the minimum number of rules expected.maxRules- the maximum number of rules expected.minQueries- the minimum number of queries expected.maxQueries- the maximum number of queries expected.forgiving- whether parsing should be forgiving.- Returns:
- the parsing result.
- Throws:
Exception- if parsing fails.
-
loadFromDLGPEString
ParsingResult loadFromDLGPEString(IntegraalEnvironment env, String dlgpeString, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) throws Exception Loads and parses DLGPE content from a string.- Parameters:
env- the environment used for parsing.dlgpeString- the DLGPE content.joinFacts- whether parsed fact bases should be joined.minFacts- the minimum number of fact bases expected.maxFacts- the maximum number of fact bases expected.minRules- the minimum number of rules expected.maxRules- the maximum number of rules expected.minQueries- the minimum number of queries expected.maxQueries- the maximum number of queries expected.forgiving- whether parsing should be forgiving.- Returns:
- the parsing result.
- Throws:
Exception- if parsing fails.
-
loadFromDLGPE
ParsingResult loadFromDLGPE(IntegraalEnvironment env, InputStream stream, boolean joinFacts, int minFacts, int maxFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) throws Exception Loads and parses DLGPE content from an input stream.- Parameters:
env- the environment used for parsing.stream- the DLGPE input stream.joinFacts- whether parsed fact bases should be joined.minFacts- the minimum number of fact bases expected.maxFacts- the maximum number of fact bases expected.minRules- the minimum number of rules expected.maxRules- the maximum number of rules expected.minQueries- the minimum number of queries expected.maxQueries- the maximum number of queries expected.forgiving- whether parsing should be forgiving.- Returns:
- the parsing result.
- Throws:
Exception- if parsing fails.
-
loadFromDLGPString
ParsingResult loadFromDLGPString(String dlgp, boolean getFacts, int minRules, int maxRules, int minQueries, int maxQueries, boolean forgiving) throws ParseException Loads and parses DLGP content from a string.- Parameters:
dlgp- the DLGP content.getFacts- whether facts should be parsed.minRules- the minimum number of rules expected.maxRules- the maximum number of rules expected.minQueries- the minimum number of queries expected.maxQueries- the maximum number of queries expected.forgiving- whether parsing should be forgiving.- Returns:
- the parsing result.
- Throws:
ParseException- if parsing fails.
-
exportPrintable
Exports a printable object.- Parameters:
printable- the object to export.- Returns:
- the serialized representation.
-
exportPrintable
String exportPrintable(IntegraalEnvironment env, fr.inria.rules.dlgpemodel.api.sentences.IPrintable printable) Exports a printable object using the given environment.- Parameters:
env- the environment used for exporting.printable- the object to export.- Returns:
- the serialized representation.
-
exportPrintable
void exportPrintable(IntegraalEnvironment env, fr.inria.rules.dlgpemodel.api.sentences.IPrintable printable, Appendable out) throws IOException Exports a printable object to an appendable output.- Parameters:
env- the environment used for exporting.printable- the object to export.out- the destination appendable.- Throws:
IOException- if writing fails.
-
mergeInPlace
Merges a fact base into another one in place.- Parameters:
env- the environment used for the merge.fb- the target fact base.other- the source fact base.
-
mergeInPlace
FactBase mergeInPlace(IntegraalEnvironment env, FactBase fb, FactBase other, Substitution subst, boolean freeze) Merges a fact base into another one in place with substitution and freezing options.- Parameters:
env- the environment used for the merge.fb- the target fact base.other- the source fact base.subst- the substitution to apply.freeze- whether merged terms should be frozen.- Returns:
- the modified target fact base.
-
removeInPlace
FactBase removeInPlace(IntegraalEnvironment env, FactBase fb, FactBase other, Substitution subst) throws EvaluationException Removes facts from a fact base in place.- Parameters:
env- the environment used for the removal.fb- the target fact base.other- the facts to remove.subst- the substitution to apply.- Returns:
- the modified target fact base.
- Throws:
EvaluationException- if evaluation fails during removal.
-
copy
-
copy
-
copy
-
copy
Copies a query.- Parameters:
query- the query to copy.- Returns:
- the copied query.
-
copy
Copies a collection of queries.- Parameters:
queries- the queries to copy.- Returns:
- the copied queries.
-
copyFBC
Copies a fact base collection.- Parameters:
factbases- the fact bases to copy.- Returns:
- the copied fact base collection.
-
evaluate
Iterator<Substitution> evaluate(IntegraalEnvironment env, QueryableData data, Query query, IGParameter<InteGraalKeywords, ?>... params) throws IllegalArgumentException, IGParameterException, EvaluationException, ViewBuilder.ViewBuilderException Evaluates a query on the supplied data combined with the environment views.- Parameters:
env- the environment providing registered read-only views.data- the queryable data (for instance aFactBase) to combine with those views.query- the query to evaluate.params- the evaluation parameters among the followingIGParameters:- IMAGES with an
InteGraalKeywords.Algorithms.Imagesvalue (CONSTANT, ALL) which selects only constant tuples or any term tuples. - ANSWERS with an
InteGraalKeywords.Algorithms.Answersvalue (LIST, SET) which selects only constant tuples or any term tuples.
- IMAGES with an
- Returns:
- an iterator over matching
Substitutions. - Throws:
IllegalArgumentException- if an argument is invalid.IGParameterException- if a parameter is invalid.ViewBuilder.ViewBuilderException- if building the environment views fails.IllegalStateException- if different sources expose the same predicate.EvaluationException- if evaluation fails.
-
evaluate
Iterator<Substitution> evaluate(IntegraalEnvironment env, QueryableData data, Query query, Substitution preHom, IGParameter<InteGraalKeywords, ?>... params) throws IllegalArgumentException, IGParameterException, EvaluationException, ViewBuilder.ViewBuilderException Evaluates a query on the supplied data combined with the environment views with a pre-homomorphism.- Parameters:
env- the environment providing registered read-only views.data- the queryable data (for instance aFactBase) to combine with those views.query- the query to evaluate.preHom- the pre-homomorphism to apply.params- the evaluation parameters among the followingIGParameters:- IMAGES with an
InteGraalKeywords.Algorithms.Imagesvalue (CONSTANT, ALL) which selects only constant tuples or any term tuples. - ANSWERS with an
InteGraalKeywords.Algorithms.Answersvalue (LIST, SET) which selects only constant tuples or any term tuples.
- IMAGES with an
- Returns:
- an iterator over matching substitutions.
- Throws:
IllegalArgumentException- if an argument is invalid.IGParameterException- if a parameter is invalid.ViewBuilder.ViewBuilderException- if building the environment views fails.IllegalStateException- if different sources expose the same predicate.EvaluationException- if evaluation fails.
-
nextAnswers
Collection<Substitution> nextAnswers(Iterator<Substitution> subIt, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Retrieves the next answers from an iterator of substitutions.- Parameters:
subIt- the substitution iterator.params- the retrieval parameters among the followingIGParameters:- MAX with a positive integer (0 means all remaining answers) which bounds the maximal number of answers returned.
- Returns:
- the next substitutions.
- Throws:
IGParameterException- if a parameter is invalid.
-
saturate
Deprecated.Saturates a fact base with a rule base using the given algorithm parameters.- Parameters:
fb- the fact base to saturaterb- the rule base to applyalgoParam- the algorithm parameters- Returns:
- the saturated fact base
-
defaultChase
FactBase defaultChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a chase on the givenFactBasewithRuleBase.
The performed default chase is the standard chase, so called the restricted chase. One can parametrize the chase by giving some specificIGParameters.- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
-
defaultChase
default <RW extends MaterializedData & Writable> RW defaultChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies the standard chase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to applyparams- supplementary chase parameters- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
stratifiedChase
<RW extends MaterializedData & Writable> RW stratifiedChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Runs a stratified chase using pseudo-minimal stratification.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the readable source and writable targetrb- the stratifiable rule baseparams- supplementary chase parameters (applied within each stratum)- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a parameter is invalid or unsupportedIllegalArgumentException- if the rule base is not stratifiable
-
stratifiedChase
FactBase stratifiedChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Runs the pseudo-minimal stratified chase using the environment's registered views.- Parameters:
env- the environment providing datasource and view definitionsfb- the writable fact base to saturaterb- the stratifiable rule baseparams- supplementary chase parameters- Returns:
- the same writable fact base, updated by the chase
- Throws:
ViewBuilder.ViewBuilderException- if building the view data sources failsIGParameterException- if a chase parameter is invalid
-
obliviousChase
FactBase obliviousChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs an oblivious chase on the givenFactBasewithRuleBase.
Oblivious chase is the literal version of the chase algorithm. Every time a rule's body is satisfied by a set of facts, the rule is applied. New "nulls" are created for the existential variables, regardless of whether similar facts already exist in the database. It rarely terminates because it creates massive amounts of redundant data.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE_COMPUTER, Transformer=ALL, Evaluator=GENERIC, Applier=BREADTH_FIRST, Checker=OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
obliviousChase
<RW extends MaterializedData & Writable> RW obliviousChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies the oblivious chase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to applyparams- supplementary chase parameters- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
semiObliviousChase
FactBase semiObliviousChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a semi-oblivious chase on the givenFactBasewithRuleBase.
Semi-oblivious chase avoids adding the same atoms multiple times (same in the sense of identical except for renaming the variables). When a rule's body is satisfied by a set of facts, the rule is only applied if it has not already been applied to the same images of the boundary variables.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE_COMPUTER, Transformer=FRONTIER, Evaluator=GENERIC, Applier=PARALLEL, Checker=SEMI_OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
semiObliviousChase
<RW extends MaterializedData & Writable> RW semiObliviousChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies the semi-oblivious chase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to applyparams- supplementary chase parameters- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
standardChase
FactBase standardChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a standard chase, so-called restricted chase, on the givenFactBasewithRuleBase.
Standard chase is the most common version used in practical logic engines. When a rule's body is satisfied by a set of facts, the rule is only applied if the rule isn't already satisfied. It significantly reduces the number of facts generated, but checking for satisfaction at every step is computationally more expensive.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE_COMPUTER, Transformer=FRONTIER, Evaluator=GENERIC, Applier=PARALLEL, Checker=SO_RESTRICTED, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
standardChase
<RW extends MaterializedData & Writable> RW standardChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies the standard chase and returns the supplied writing target.- Throws:
IGParameterException
-
coreChase
FactBase coreChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a core chase on the givenFactBasewithRuleBase.
Core chase is the most "powerful" but computationally intensive variant. After each step, the algorithm computes the core of the resulting fact base, i.e., the smallest possible subset that is homomorphically equivalent to the current factbase. It is the "gold standard" for termination; if any version of the Chase can terminate on a specific instance, the Core Chase will.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE_COMPUTER, Transformer=FRONTIER, Evaluator=GENERIC, Applier=PARALLEL, Checker=SEMI_OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, InterstepTreatment=CORE.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
coreChase
<RW extends MaterializedData & Writable> RW coreChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies coreChase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to apply, subject to this chase's rule restrictionsparams- chase parameters, subject to this chase's parameter restrictions- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
linearRuleChase
FactBase linearRuleChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a semi-oblivious chase optimized for linear rules on the givenFactBasewithRuleBase.
Linear rules are rules with one single atom in its body. The calculation of triggers can then be restricted to the atoms inferred in the previous step rather than to the entire basis. This makes it easy to implement a semi-naive evaluation.
The internal InteGraal chase configuration for this chase is : Computer=SEMI_NAIVE, Transformer=FRONTIER, Evaluator=GENERIC, Applier=PARALLEL, Checker=SEMI_OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
linearRuleChase
<RW extends MaterializedData & Writable> RW linearRuleChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies linearRuleChase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to apply, subject to this chase's rule restrictionsparams- chase parameters, subject to this chase's parameter restrictions- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
linearRulesChase
@Deprecated(forRemoval=true) default FactBase linearRulesChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Deprecated, for removal: This API element is subject to removal in a future version. -
linearRulesChase
@Deprecated(forRemoval=true) default <RW extends MaterializedData & Writable> RW linearRulesChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
IGParameterException
-
inMemoryDatalogChase
FactBase inMemoryDatalogChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a standard chase optimized for datalog rules on the givenFactBasewithRuleBasethat must be Datalog Rules.
Datalog rules are rules with one single atom in their head and no existential variable. With this rule, a standard chase is simply obtained with an oblivious condition, less time-consuming than a restricted condition.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE, Transformer=FRONTIER, Evaluator=GENERIC, Applier=PARALLEL, Checker=OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
inMemoryDatalogChase
<RW extends MaterializedData & Writable> RW inMemoryDatalogChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies inMemoryDatalogChase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to apply, subject to this chase's rule restrictionsparams- chase parameters, subject to this chase's parameter restrictions- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
delegatedDatalogChase
FactBase delegatedDatalogChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a chase based on database queries on the givenFactBasethat must be in a DBMS withRuleBasethat must be range restricted rules.
This chase relies on the use of SQL SELECT and INSERT queries. The FactBase has to be managed by a RDBMS. The rules must be range restricted rules, rules without any existential variable.
The internal InteGraal chase configuration for this chase is : Computer=NAIVE, Transformer=FRONTIER, Evaluator=SMART, Applier=SOURCE_DELEGATED_DATALOG, Checker=SEMI_OBLIVIOUS, Namer=FRESH, Scheduler=GRD, ChaseHalter=NO_NEW_FACTS+NO_RULES_TO_APPLY, and no InterstepTreatment.
Recall that an InteGraal chase configuration consists in:- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
- a TRANSFORMER: how to transform the rule body into a query (frontier, body...) and
- an EVALUATOR: which homomorphism computing algorithm to consider (generic, smart...).
- an APPLIER: a trigger application strategy (bf, parallel, delegated...) completed by:
- a CHECKER: the trigger application condition (oblivious, so, restricted, equivalent...) and
- a NAMER: the method for naming the new existential variables (fresh, body, frontier...).
- a SCHEDULER: a method for selecting the next rules to consider (naïf, by_predicate, GRD...).
- at least one CHASEHALTER (no_new_fact, no_rules_to_apply, rank, timeout, interrupt).
- some optional INTERSTEPTREATMENTs (core, local_core, debug, report).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- Some optional IGParameters for additional chase adjustments. These parameters are cumulative, meaning we can add several of them together (including multiple times the same with or without the same value). The allowedIGParameters are:- RANK with a strictly positive long integer-convertible value which bounds the maximal number of steps performed by the chase.
- TIMEOUT with a non-zero duration-convertible value which prevents proceeding to the next step of chase if the total execution time is greater than this value.
- INTERRUPT with an AtomicBoolean which allows the chase to be interrupted at the next end of the stage if this boolean is set to true.
- INTERSTEPTREATMENT with an
InteGraalKeywords.Algorithms.Parameters.Chase.InterStepTreatmentvalue (DEBUG, REPORT) which allows to perform a specific treatment between each chase step.- REPORT treatment displays the step number, the size of the fact base, the number of atoms added in this step, the duration in ms of the step, and the number of rules applied in this step.
- DEBUG treatment displays the configuration of the current chase before the first step. Therefore, it is not really an interstep treatment since it is only executed once before executing the first step.
- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (naive, semi-naive, two steps...) completed by:
-
delegatedDatalogChase
<RW extends MaterializedData & Writable> RW delegatedDatalogChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies delegatedDatalogChase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to apply, subject to this chase's rule restrictionsparams- chase parameters, subject to this chase's parameter restrictions- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
customChase
FactBase customChase(IntegraalEnvironment env, FactBase fb, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException, ViewBuilder.ViewBuilderException Performs a chase user-customized on the givenFactBasewithRuleBase.
This chase allows user to fix its own chase configuration which consists in a sequence of following parameters: Computer, Transformer, Evaluator, Applier, Checker, Namer, Scheduler, ChaseHalter, Rank, Timeout, Interrupt, Intersteptreatment. The first seven parameters are mutually exclusive; if one of them is given more than once in the sequence, only the last value is retained. The last five parameters are cumulative; all the given values (including multiple times the same with or without the same value) are kept.
The first seven parameters are mandatory to define a chase but if some are missing, a default value will be given. Furthermore, at least a parameter has to be given among ChaseHalter, Rank, Timeout or Interrupt; if that's not the case a default chasehalter value will be added.
The chase configuration consists in (see alsoInteGraalKeywords):- a COMPUTER: a trigger calculation strategy (values: NAIVE_COMPUTER, SEMI_NAIVE, TWO_STEP, RESTRICTED)
completed by:
- a TRANSFORMER: how to transform the rule body into a query (values: ALL, FRONTIER) and
- an EVALUATOR: which homomorphism computing algorithm to consider (values: GENERIC, SMART).
- an APPLIER: a trigger application strategy (values: BREADTH_FIRST, PARALLEL, SOURCE_DELEGATED_DATALOG,
MULTI_THREAD_PARALLEL) completed by:
- a CHECKER: the trigger application condition (values: OBLIVIOUS, SEMI_OBLIVIOUS, RESTRICTED, EQUIVALENT, SO_RESTRICTED) and
- a NAMER: the method for naming the new existential variables (values: FRESH, BODY, FRONTIER, FRONTIER_PIECE).
- a SCHEDULER: a method for selecting the next rules to consider (values: NAIVE_SCHEDULER, GRD, BY_PREDICATE).
- at least one CHASEHALTER (values: NO_NEW_FACTS, NO_RULES_TO_APPLY) or TIMEOUT (with a non-zero duration-convertible value) or (RANK with a strictly positive long integer-convertible value) or INTERRUPT (with an AtomicBoolean value)
- some optional INTERSTEPTREATMENTs (values: CORE, LOCAL_CORE, DEBUG, REPORT).
- Parameters:
env- the environment providing registered read-only views.fb- The FactBase to chase. This parameter will be modified during the execution and will remain modified at the end of the execution.rb- The RuleBase to use for chasing.params- the user configuration of chase- Returns:
- the modified given
FactBaseon which the chase has been applied. - Throws:
ViewBuilder.ViewBuilderException- if building the environment views fails.IGParameterException- If a parameter name is unknown for this service, or its value format is incorrect or uncheckable.
- a COMPUTER: a trigger calculation strategy (values: NAIVE_COMPUTER, SEMI_NAIVE, TWO_STEP, RESTRICTED)
completed by:
-
customChase
<RW extends MaterializedData & Writable> RW customChase(ChasableData<RW> data, RuleBase rb, IGParameter<InteGraalKeywords, ?>... params) throws IGParameterException Applies customChase to the supplied readable source and writable target.- Type Parameters:
RW- the writable materialized data type- Parameters:
data- the chasable data to saturaterb- the rules to apply, subject to this chase's rule restrictionsparams- chase parameters, subject to this chase's parameter restrictions- Returns:
- the same writable target, updated by the chase
- Throws:
IGParameterException- if a supplied parameter is invalid
-
rewrite
UnionFOQuery rewrite(RuleBase rb, Query query, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilationType) throws IllegalArgumentException Rewrites a query with respect to a rule base and a compilation strategy.- Parameters:
rb- the rule base used for rewriting.query- the query to rewrite.ruleCompilationType- the compilation strategy.- Returns:
- the rewritten query.
- Throws:
IllegalArgumentException- if an argument is invalid.
-
rewrite
Rewrites a query using a precomputed compilation.- Parameters:
query- the query to rewrite.compiled- the precomputed compilation.- Returns:
- the rewritten query.
- Throws:
IllegalArgumentException- if the compilation is invalid.
-
evaluateSat
Iterator<Substitution> evaluateSat(FactBase fb, Query query, RuleBase rb, IAlgorithmParameters algoParam) throws IllegalArgumentException, IGParameterException, EvaluationException Evaluates a query after saturating the fact base with a rule base.- Parameters:
fb- the fact base to query.query- the query to evaluate.rb- the rule base used for saturation.algoParam- the saturation algorithm parameters.- Returns:
- an iterator over matching substitutions.
- Throws:
IllegalArgumentException- if an argument is invalid.IGParameterException- if a parameter is invalid.EvaluationException- if evaluation fails.
-
evaluateRew
Iterator<Substitution> evaluateRew(FactBase fb, Query query, RuleBase rb, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilationType, ExternalHaltingCondition... conds) throws IllegalArgumentException, IGParameterException, EvaluationException Evaluates a query after rewriting it with a rule base.- Parameters:
fb- the fact base to query.query- the query to evaluate.rb- the rule base used for rewriting.ruleCompilationType- the compilation strategy.conds- the external halting conditions.- Returns:
- an iterator over matching substitutions.
- Throws:
IllegalArgumentException- if an argument is invalid.IGParameterException- if a parameter is invalid.EvaluationException- if evaluation fails.
-
createCompilation
CompilationResult createCompilation(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation compilation) Creates a compilation for a rule base.- Parameters:
ruleBase- the rule base to compile.compilation- the compilation strategy.- Returns:
- the compilation result.
-
createCompilation
Creates a compilation for a rule base using a compilation type.- Parameters:
ruleBase- the rule base to compile.compilationType- the compilation type.- Returns:
- the compilation result.
-
parseCompilationType
Parses a compilation type string.- Parameters:
compilationType- the compilation type.- Returns:
- the parsed compilation value.
-
extractCompilableRules
RuleBase extractCompilableRules(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Extracts the compilable rules from a rule base.- Parameters:
ruleBase- the source rule base.ruleCompilation- the compilation strategy.conds- the external halting conditions.- Returns:
- the compilable rules.
-
extractNonCompilableRules
RuleBase extractNonCompilableRules(RuleBase ruleBase, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Extracts the non-compilable rules from a rule base.- Parameters:
ruleBase- the source rule base.ruleCompilation- the compilation strategy.conds- the external halting conditions.- Returns:
- the non-compilable rules.
-
unfold
Collection<Query> unfold(RuleBase ruleBase, Collection<Query> queries, InteGraalKeywords.Algorithms.Parameters.Compilation ruleCompilation, ExternalHaltingCondition... conds) Unfolds queries with respect to a rule base.- Parameters:
ruleBase- the rule base used for unfolding.queries- the queries to unfold.ruleCompilation- the compilation strategy.conds- the external halting conditions.- Returns:
- the unfolded queries.
-
decompose
-
createRuleBaseFromRules
Creates a rule base from a collection of rules.- Parameters:
rules- the rules to include.- Returns:
- the created rule base.
-
parseSubstitution
Substitution parseSubstitution(IntegraalEnvironment environment, String json) throws NoSuchMethodException, ParseException Parses a substitution from its JSON representation.- Parameters:
environment- the environment used for parsing.json- the JSON representation.- Returns:
- the parsed substitution.
- Throws:
NoSuchMethodException- if a required method cannot be found.ParseException- if parsing fails.
-
formatSubstitutions
List<Map<String,Object>> formatSubstitutions(IntegraalEnvironment environment, Collection<Substitution> substitutions) throws IOException Formats substitutions into string maps.- Parameters:
environment- the environment used for formatting.substitutions- the substitutions to format.- Returns:
- the formatted substitutions.
- Throws:
IOException- if formatting fails.
-
createAnalyser
-
isFes
-
isFus
-
isDecidable
-
isHybridable
-
isHybrid
Checks whether two rule bases form a hybrid rule base.- Parameters:
ruleBaseToSaturate- the rule base intended for saturation.ruleBaseToRewrite- the rule base intended for rewriting.- Returns:
trueif the rule bases form a hybrid rule base, otherwisefalse.
-
linearRuleChase(IntegraalEnvironment, FactBase, RuleBase, IGParameter[])instead.