Skip to content

Commit

Permalink
[Operators] Fix dig-team#43 - Improved exploit max length for danglin…
Browse files Browse the repository at this point in the history
…g operator
  • Loading branch information
falcaopetri committed Sep 14, 2020
1 parent a2beeca commit 8e05d30
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,13 @@ public void getDanglingAtoms(Rule query, double minCardinality, Collection<Rule>
// Pruning by maximum length for the \mathcal{O}_D operator.
if(query.getRealLength() == this.maxDepth - 1) {
if (this.exploitMaxLengthOption) {
if(!query.getOpenVariables().isEmpty()
&& !this.allowConstants
&& !this.enforceConstants) {
if (query.getOpenVariables().size() > 1) {
// There will be more than 2 open variables and we will not be able to close all of them.
return;
}

if (!canAddInstantiatedAtoms()) {
// We can't count on instantiation operator to close the new dangling variable.
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,13 @@ public void getDanglingAtoms(Rule rule, double minSupportThreshold, Collection<R

if (exploitMaxLengthOption) {
if(rule.getRealLength() == maxDepth - 1){
if(!rule.getOpenVariables().isEmpty() && !allowConstants){
if (rule.getOpenVariables().size() > 1) {
// There will be more than 2 open variables and we will not be able to close all of them.
return;
}

if (!canAddInstantiatedAtoms()) {
// We can't count on instantiation operator to close the new dangling variable.
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,13 @@ public void getDanglingAtoms(Rule query, double minCardinality, Collection<Rule>
//General case
if(query.getLength() == maxDepth - 1) {
if (this.exploitMaxLengthOption) {
if(!openVariables.isEmpty()
&& !this.allowConstants
&& !this.enforceConstants) {
if (query.getOpenVariables().size() > 1) {
// There will be more than 2 open variables and we will not be able to close all of them.
return;
}

if (!canAddInstantiatedAtoms()) {
// We can't count on instantiation operator to close the new dangling variable.
return;
}
}
Expand Down

0 comments on commit 8e05d30

Please sign in to comment.