User Activity

  • Posted a comment on discussion Help on CLIPS Rule Based Programming Language

    Thanks.

  • Posted a comment on discussion Help on CLIPS Rule Based Programming Language

    Hi, a rule can easily act on instance creation. Can a rule act on deletion of each instance of particular class? (there is an option to use delete handlers, but is it possible to do with rules). Here is my test: (watch instances) (watch slots) (watch activations) (defclass A (is-a USER) (slot foo) (slot bar)) (defrule match-A-s (not (object (is-a A) (foo ?f))) => (printout t "=== Removed!" crlf )) (make-instance a of A (foo 200)) (make-instance a1 of A (foo 200)) (run) (unmake-instance [a]) (unmake-instance...

  • Modified a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    Something wrong with types: from clips import Environment env = Environment() superclass = env.find_class('USER') print type(superclass) Prints: <type 'instance'> Root cause: "class Instance:" should be "class Instance(object):" for Python 2.7. It's a good idea to inherit from "object" for the rest of the classes, too.

  • Modified a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    Something wrong with types: from clips import Environment env = Environment() superclass = env.find_class('USER') print type(superclass) Prints: <type 'instance'> Root cause: "class Instance:" should be "class Instance(object):" for Python 2.7. It's a good idea to inherit fro "object" for the rest of the classes, too.

  • Posted a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    Something wrong with types: from clips import Environment env = Environment() superclass = env.find_class('USER') print type(superclass) Prints: <type 'instance'>

  • Posted a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    What is correct way of working with INSTANCE-ADDRESS? import clips env = clips.Environment() class_string = """ (defclass MyClass (is-a USER) (slot One) (slot Two (type INSTANCE-ADDRESS))) """ env.build(class_string) klass = env.find_class('MyClass') instance = klass.new_instance('instance-name') instance['One'] = 1 instance1 = klass.new_instance('instance-name1') instance1['Two'] = instance Result: $ python test5.py Traceback (most recent call last): File "test5.py", line 17, in <module> instance1['Two']...

  • Modified a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    Here is another test: import clips env = clips.Environment() class_string = """ (defclass MyClass1 (is-a USER) (slot One (type INTEGER)) (slot Two)) """ env.build(class_string) class_string = """ (defclass MyClass (is-a MyClass1)) """ env.build(class_string) klass = env.find_class('MyClass') instance = klass.new_instance('instance-name') instance['One'] = 1 instance['Two'] = 2 print instance.instance_class.slots print "=== Iterate through slots ===" for s in instance.instance_class.slots(): print...

  • Posted a comment on discussion Open Discussion on CLIPS Rule Based Programming Language

    Here is another test: import clips env = clips.Environment() class_string = """ (defclass MyClass1 (is-a USER) (slot One (type INTEGER)) (slot Two)) """ env.build(class_string) class_string = """ (defclass MyClass (is-a MyClass1)) """ env.build(class_string) klass = env.find_class('MyClass') instance = klass.new_instance('instance-name') instance['One'] = 1 instance['Two'] = 2 print instance.instance_class.slots print "=== Iterate through slots ===" for s in instance.instance_class.slots(): print...

View All

Personal Data

Username:
slozovsk
Joined:
2004-03-18 18:39:52
Location:
United States / PDT
Gender:
Male

Projects

This is a list of open source software projects that Serge Lozovsky is associated with:

Personal Tools

MongoDB Logo MongoDB