Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

A Transcription from SQL to FOL (First Order Logic)

  1. Jun 3, 2017 #1

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Hi All,
    When a query is made in SQL , it is transcribed into FOL in the back end , and, if the transcription is a wff , the models, if any, are returned as the answer to the query. I have an idea of how the transcription works for basic statements, but, does anyone know the actual " transcription map" for more complicated queries, such as, e.g., joins? Do we use product models in this case, or do we union the models to form new ones?
     
  2. jcsd
  3. Jun 5, 2017 #2

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I'll have a go at this, since nobody else has.

    If a table in the database is represented by an atomic wff, and we have tables ##p,q## represented by the a ##m##-ary predicate ##P## and a ##n##-ary predicate ##Q## respectively, then I think the Inner Join of the two tables on the first ##r## arguments to both tables, in the same order, will be represented by the following wff with ##m+n-r## free variables:
    $$P(x_1,...,x_m)\wedge Q(x_1,..x_r,x_{m+1},...,x_{m+n-r})$$
     
  4. Jun 5, 2017 #3

    WWGD

    User Avatar
    Science Advisor
    Gold Member

    Thanks, Andrew, how would the model of the union then be defined, as just a set union of the two models ( the models of the two wffs)?
     
  5. Jun 5, 2017 #4

    andrewkirk

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    I think I'd try the following for
    Code (Text):
     select x1,x2,....,xr from p UNION select x1,x2,....,xr from q
    $$\exists x_{r+1},x_{r+2},....,x_{m+n-r}:\ P(x_1,...,x_m)\vee Q(x_1,...,x_r,x_{m+1},...,x_{m+n-r})$$
    This wff has ##r## free variables, corresponding to the ##r## columns in the tables ##p## and ##q## that match.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Transcription from SQL to FOL (First Order Logic)
  1. First order Logic (Replies: 6)

  2. First order logic (Replies: 0)

Loading...