ontopia / ontopia

The open source tools for building, maintaining and deploying Topic Maps-based applications.
https://ontopia.net
Apache License 2.0
54 stars 12 forks source link

swaping predicates in the tolog OR clause affects results #335

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Changing predicate order in the OR clause, for example from {a | b } to { b | a 
} with the rest of the query left intact affects the number of returned rows.

What steps will reproduce the problem?

1. Swapping the two predicates in

{d:bederivedfrom($DBACONS : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)|
d:bederivedfrom($DBAANT : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)}

to

{d:bederivedfrom($DBAANT : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)
|
d:bederivedfrom($DBACONS : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)
}
in the following query changes the number of results from 88 rows to 0 rows (88 
being the correct number):

using d for i"http://keg.vse.cz/dmo/" 
using p for i"http://www.dmg.org/PMML-4_0#"

getTopicInstanceForString($String,$TopicType, $Topic):- value 
($Object,$String),topic-name($Topic, $Object), instance-of( $Topic, 
$TopicType). 

GetBBAContainingCategoryAsString($RuleCategoryAsString, $DerivedFieldAsString, 
$BBA) :- 
getTopicInstanceForString($DerivedFieldAsString, p:DerivedField, $DerivedField),
getTopicInstanceForString($RuleCategoryAsString, d:derivedfieldcontent, 
$RuleCategory), d:havebin($DerivedField :p:DerivedField ,$RuleCategory : 
d:derivedfieldcontent), d:havecoefficient($BBA : d:basicbooleanattribute, 
$RuleCategory: d:coefficient).

getRules($RuleAsString) :- 
d:haveantecedent($DBAANT : p:antecedent, $RULE: 
p:associationrule),d:haveconsequent($DBACONS : p:consequent, $RULE: 
p:associationrule),

{d:bederivedfrom($DBACONS : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)|
d:bederivedfrom($DBAANT : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40936: d:booleanattribute)}

,GetBBAContainingCategoryAsString("good","Quality",$BBABBA_FTLiteralI_40936),d:b
ederivedfrom($LiteralDBA_FTLiteralI_Sign_40936 : d:derivedbooleanattribute, 
$BBABBA_FTLiteralI_40936: d:booleanattribute)
,d:bederivedfrom($DBAANT : d:derivedbooleanattribute, 
$LiteralDBA_FTLiteralI_Sign_40937: d:booleanattribute)
,GetBBAContainingCategoryAsString("M","Sex",
$BBABBA_FTLiteralI_40937),d:bederivedfrom($LiteralDBA_FTLiteralI_Sign_40937 : 
d:derivedbooleanattribute, $BBABBA_FTLiteralI_40937: d:booleanattribute), 
topic-name($RULE, $ObjectR), value ($ObjectR,$RuleAsString).

  getRules($RuleAsString)?

The topic map is available at 
http://nlp.vse.cz/download/s1-ClientAAILoanIMPLIEDCONDYear31-71.xtm

The topic map has 91.2 MB so it may take a while to download and load.

Tested using Ontopia 5.1.2 and 5.1.0

The first query with correct results executes in 150 ms, the second query with 
zero results in 1ms.

The complete queries and the trace logs are attached.

Original issue reported on code.google.com by kli...@gmail.com on 2 Dec 2010 at 4:32

Attachments:

GoogleCodeExporter commented 9 years ago
I tried on another topic map and it seems that the tolog interpreter processes 
correctly only the first branch  in the or clause (the predicate before the 
first |). 
The remaining predicates seem only to increase the search time.

Original comment by kli...@gmail.com on 7 Dec 2010 at 9:28

GoogleCodeExporter commented 9 years ago

Original comment by qsieb...@gmail.com on 13 Mar 2014 at 4:22