Re: Keeping PowerLoom around as a daemon?

Rich Morin <[email protected]> Fri, 20 Jun 2008 18:26:02 -0700
Newsgroups gmane.comp.ai.powerloom
Message-ID <p06230949c48200b17dbb@[192.168.1.205]>
To clarify my intent, I'm after the ability to manipulate data
structures in Ruby, before and/or after they have been sent to
PowerLoom.  My take is that KIF is simply a way of expressing
"lists of lists".  So, I should be able to use Ruby syntax to
express the same structures.


At the risk of exposing my utter ignorance, here's a straw man:

To get from KIF to Ruby:

  Turn parentheses into brackets.
  Separate terms by commas.
  Precede each word by a colon.
  Leave numbers alone.
  Wrap other terms in quotes.


So, the KIF statement:

  ( retrieve
    10
    ( ?x    Person )
    ( happy ?x )
  )

would become the Ruby structure (list of lists):

  [ :retrieve,
    10,
    [ "?x",   :Person ],
    [ :happy, "?x" ]
  ]


Using irb (interactive Ruby), I can now manipulate this:

  >> k = [:retrieve, 10, ["?x", :Person], [:happy, "?x"]]

  >> puts k[2].inspect
  ["?x", :Person]

  >> puts k[3][0].inspect
  :happy


So, what am I missing, on the syntax front?

-r


P.S.

I used these references:

  http://suo.ieee.org/SUO/KIF/suo-kif.html
  http://www.isi.edu/isd/LOOM/PowerLoom-work/documentation/manual_body.html

The Ruby syntax :xyz defines a "symbol", which is an
immutable, unique string.


-- 
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     [email protected]
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Technical editing and writing, programming, and web development