Please describe me a starting point

Help
2008-10-29
2013-04-25
  • Tolga Cavdar
    Tolga Cavdar
    2008-10-29

    Hi,

    I am very interested in using CLIPS .NET but I have some big troubles.

    For example, what is wrong with the code below? (Visual Basic 2008):

    *************************************
    Imports CLIPSNet

    Module Module1

        Sub Main()

            Dim klips As New CLIPSNet.Environment

            klips.Load("blahblah.clp")
            klips.EnvReset()

            Fact.AssertString(klips, "kjk")      <-- That doesn't work!!!

        End Sub
    End Module
    *************************************

    Visual Studio doesn't acceot " Fact.AssertString " and says that I can't use the "Fact" because "Fact is not accessible in this context because it is friend"

    Can you pleeeeeeeeeeeaaaaaaaaaaaaaaase write a very basic code? I just want to make a starting point. For example just load a defrule, assert a fact and write the output to the console. That's all.

    Thank you very much and looking forward the replies.

     
    • Izya K
      Izya K
      2008-10-29

    • Tolga Cavdar
      Tolga Cavdar
      2008-10-29

      Thank you so much for your urgent reply. That's very kind of you.

      I went to the address you gave and currently trying to understand the examples. But may I kindly request a "simplest" example please?

      I am trying to load a clp file and assert a fact but I can't run even this!

      ***********************************
      VB version:

      Dim klips As New CLIPSNet.Environment
      klips.Load("blahblah.clp")
      klips.EnvReset()
      Fact.AssertString(klips, "(so and so)")
      klips.EnvRun()

      ***********************************

      C# version:
      CLIPSNet.Environment klips = new CLIPSNet.Environment();
      klips.Load("blahblah.clp");
      Fact.AssertString(klips, "(so and so)");
      klips.EnvRun();
      ***********************************

      Visual C# doesn't have a problem with "Fact" and ultimately prints the result.

      Visual Basic doesn't accept to use "Fact" because it is "Firend".

      BUT...

      Both VB and C# complain in a console window:

      [CSTRCPSR1] Expected the beginning of a construct

      VB says that and that's all, it halts.
      C# first says that but somehow shows the result in a second line.

      Now:

      1. Isn't is possible to use CLIPS .NET dll with VB?
      2. What is this "[CSTRCPSR1] Expected the beginning of a construct"?
      3. If C# "expected" something and seemingly could not find, how can it run anyway?

      I am still crawling, please help me walking :-)

      Thanks.

       
    • Tolga Cavdar
      Tolga Cavdar
      2008-10-30

      Okay, okay, I solved the problem and I'd like to share my solution just for helping other novices.

      Problem 1. "Fact" cannot be used because it's "friend": Obviously, that issue was related with VB .NET, not with CLIPS .NET.

      Solution: I added this

      Imports CLIPSNet.Fact

      (C# didn't require this extra "Imports" or "using" in C# syntax)

      Problem 2. "[CSTRCPSR1] Expected the beginning of a construct" error: That was also not directly related to CLIPS .NET dll.

      Solution: I created my rule directly in CLIPS environment, not in a text editor. I wrote the rule and save it. Then I opened it in a text browser to see whether it was different with my older rule file.

      And bingo!

      (defrule blahblah
           (so and so)
           =>
           (printout t "blahblah" crlf))

      didn't worked because I excluded the "MAIN::" !!!

      So, I re-wrote the rule as:

      (defrule MAIN::blahblah
           (so and so)
           =>
           (printout t "blahblah" crlf))

      That's all...

       
  • hola

     
  • HI

     
  • I´M USING CLIPSNET LIBRARIES AND THEY´RE WORKING VERY WELL ON C# IN CONSOLE APPLICATIONS, BUT NOW I WANT TO DO A GRAPHICAL INTERFACE USING C#. COULD SOMEBODY HELP ME?
    THANKS A LOT