Hello,

today I tried to verify if using a database instead of Pilog facts would
speed up my processing. While trying this, I stumbled over the
following. Suppose:

  (pool test)

  (class +Test +Entity)
  (rel id (+Ref +String))
  (rel src (+Ref +String))
  (rel tgt (+Ref +String))

  (new '(+Test) 'id "1"  'src A  'tgt B)     
  (new '(+Test) 'id "11"  'src B  'tgt "C")    
  (new '(+Test) 'id "111"  'src C  'tgt "D")    

  (commit)                                    

  (? (db id +Test 1 @E) (show @E))

The last Pilog query will successively return three answers where I
thought to get only one. I understand, why 'db' will deliver three
results. But the question comes up, how I could formulate the query
using only exact matches!

Without this, the 'db' query would return similar matches that I have to
explicitely guarding against with e.g. 'equal' like this:

  (? (db id +Test "1" @E) (val @Id @E id) (equal @Id "1") (show @E))

But this would defeat the reason, why I tried to use a DB at all. I
hoped that accessing an Edge via an index would be faster than asking
Pilog to match against all its facts until it found a corresponding it
could unify against.

So could this be the reason that my DB solution of traversing all ways
thru a graph is a lot slower than using Pilog facts? Both are trying to
iterate over the same graph built by 362 edges. Whereas the Pilog facts
will allow for finding ca. 1000 ways per 1-2 seconds, the database
solution was canceled after some time, as it did not reach the first
1000 solutions before I lost my patience ;-)

Or is there any way to improve the performance of the DB? For instance
by only matching exactly in the db query for a certain edge?


Thanks and Ciao,
cle.

-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to