Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 Graham Cooper Posts: 4,495 Registered: 5/20/10
Re: PROLOG ENGINES ARE REALLLLLLY SLOW! ((SQL-UNIFY))
Posted: Nov 20, 2012 4:40 PM

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

Date Subject Author
11/20/12 Graham Cooper
11/20/12 Jan Burse
11/20/12 Ulrich Neumerkel
11/20/12 Graham Cooper
11/20/12 Graham Cooper
11/20/12 Graham Cooper