Assert a variable

Help
Sudlon
2011-06-07
2012-11-23
  • Sudlon

    Sudlon - 2011-06-07

    I would like to assert a variable, like so:

    (bind temp (create$ this isA test))
    (assert (?temp))

    but when doing this it gives me a syntax error. When I change it into the following:

    (bind temp (create$ this isA test))
    (assert (bla ?temp))

    it does work. Is it possible to assert only the variable and not something else along with it?

    The final goal is to read in an RDF file, convert the RDF triples and assert them as triple facts in CLIPS. The thing I'm trying above is a test.

     
  • Sudlon

    Sudlon - 2011-06-07

    I just noticed I forgot the question mark in front of "temp" in the bind function (I do have it in my CLISP code). The problem lies with the assert function, that is not able (or seems to be) to assert the variable on its own.

     
  • Sudlon

    Sudlon - 2011-06-07

    Ok I still can't assert a bounded variable, BUT I have been able to read a fact file like this:

    (deffunction loadKB (?KBfile)
    (open ?KBfile KB)
    (while (bind ?line (readline KB))
    (if (eq ?line EOF) then
    (break)
    )
    (assert-string ?line) ; stupid triple part..
    )
    (close KB)
    )

    I still wonder how to assert a bounded variable though.

     
  • Gary Riley

    Gary Riley - 2011-06-07

    The first field of an assert must be a symbol. The remaining values can be variables. Use assert-string to bypass this restrictions. Alternately, if you have a file containing facts, just use the load-facts function to assert all the facts in the file.

     
  • Sudlon

    Sudlon - 2011-06-07

    Thanks for your quick reply! I know about the load-facts function, the thing is I need to rearrange the contents of the file since they are not stored as facts, but in RDF format.
    I've got the basics working, so now I can focus on getting the translation part working!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks