|
From: Murat K. <mur...@st...> - 2008-10-19 15:35:57
|
Hi all,
once more, I have come up with some questions. Currently, I am looking
at the magic set implementation, so the questions mostly concern it.
1. Conjunctive queries
The following rules give different adorned predicates, since the order
of predicates in this case determines the adornments. In the following
example, the first rule (with the given query) produces four, while the
second rule produces just two adorned predicates of anc/2.
anc(?x,?z) :- anc(?x,?y), par(?y,?z). // 1.
anc(?x,?z) :- par(?x,?y), anc(?y,?z). // 2.
?-anc(?x, 'l3-1'), anc(?x, 'l3-2').
The difference between rule 1 and 2 in respect to the query ought to be
nullified by the SIP, which resides over the order of evaluation, right?
2. AdornedProgram.createAdornedRules(Collection, IQuery)
The method assumes there to be exactly one literal:
final ILiteral head_literal = rule.getHead().get(0);
// ...
adorned_rule = adorned_rule.replaceHeadLiteral(head_literal,
adorned_predicate);
Why is this? replaceHeadLiteral() could easily support more.
Additionally, this generates a java.lang.IllegalArgumentException:
anc(?x,?y),blub(?y) :- anc(?y,?x).
?-anc('l1-1', ?z).
3. AdornedProgram.createAdornedRules(Collection,IQuery)
Just a small coding question. With
final Set<AdornedPredicate> predicatesToProcess = new
HashSet<AdornedPredicate>();
you simulate a queue. Why not just use one?
4. Bug in OptimisedProgramStrategyAdaptor.evaluateQuery(IQuery, List) ?
While applying optimizations, you iterate through the configured
optimizers. In my understanding, each optimizer gets the results of the
previous optimizations, i.e. rules and the query for which the rules are
being optimized, as in the case of magic sets. But in the crucial line,
you always fall back to the original rules (mRules) - though using the
possibly previously optimized query.
IProgramOptimisation.Result result =
optimisation.optimise( mRules, query );
Is this as intended?
As far as I understand this, it probably never posed a problem, as there
is but one optimization available, the magic sets.
5. You often impose the limitation of rules having at most one head
literal. While queries with more predicates are simply conjunctively
connected (as they are a rule without head), are rules with multiple
disjunctively connected?
Thanks and hoping to hear from you soon.
All the best,
Murat
|