Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.independent

Topic: PROLOG ENGINES ARE REALLLLLLY SLOW! ((SQL-UNIFY))
Replies: 5   Last Post: Nov 20, 2012 4:40 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Graham Cooper

Posts: 4,227
Registered: 5/20/10
Re: PROLOG ENGINES ARE REALLLLLLY SLOW! ((SQL-UNIFY))
Posted: Nov 20, 2012 4:40 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Nov 21, 7:07 am, Graham Cooper <grahamcoop...@gmail.com> wrote:
> > SQL-UNIFY
> > SELECT * FROM TTAILS, TPRO
> > WHERE TTAILS.REF = TPRO.REF
> > AND TTAILS.FIELD = TPRO.FIELD
> > ORDER BY TPRO.ID

>
> The result SQL Join will look like this.
>
> FACT
> vert( pnt(X,Y) (pnt(X,Z)).         //TPRO.ID = 21
>
> QUERY
> ?-  vert( pnt(1,2) (X,Y)).          //TTAIL.ID = 1   (2 vars
> substituted)
>
> T.ID T.REF T. FLD T.TYP P.ID P.REF P.FLD
> ========================================
> 1    1     vert   H     21   1     vert
> 1    2     pnt    P     21   2     vert
> 1    3     pnt    P     21   3     pnt



Actually you would only get 3 matches, to get 5 matches use this.

WHERE (TTAILS.REF=TPRO.REF) OR (TPRO.TYP='V')

---

I had some success with this query method on a different table design.

www.microPEOLOG.com

[vert [pnt 1 2] [pnt 1 4]]?

UNIFY:> SELECT * FROM TPROLOG WHERE typ='H'
AND ((p1='vert')) AND
((p2='pnt') OR v2) AND
((p3='pnt') OR v3)

TRACE:1 vert( pnt pnt ...

BOTH TERMS:2

vvvvvv SUBQUERY par2 578:286 vvvvv

UNIFY:> SELECT * FROM TPROLOG WHERE id=286 AND ((p1='pnt'))
AND ((p2='1') OR v2)
AND ((p3='2') OR v3)

...

That was an old method though.

Herc




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.