Questions tagged [clipspy]

For questions related to the embedding of the CLIPS engine in Python.

CLIPSPy is a FFI based binding module to embed the CLIPS expert system engine in Python.

35 questions
3
votes
1 answer

How to route I/O to console AND logfile using clipspy

I am using clipspy v1.0.0 and Python 3.10 on Ubuntu 22.0.4 LTS. I am trying to get commands from CLIPS rules (e.g. print t 'WARN: Listen up, maggots...') to print to the console by calling my registered function, which will then parse the message…
Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341
3
votes
2 answers

CLIPS Python3 CLIPSError

I've run into a bit of an issue with some CLIPSpy code. I've narrowed down the issue to either the encode method of CLIPS_CONSTRUCTS.encode() or the environment.load(constructs_file.name). The goal I'm trying to capture is to fire a rule when the…
Jay Py
  • 141
  • 9
2
votes
1 answer

CLIPS Error: Illegal use of the module specifier in clipspy

I'm using clipspy. I want to define some module-rules to assert module-facts. The rule is based on facts from multiple modules. I get a CLIPS Error: Illegal use of the module specifier import clips env =…
dokgom
  • 35
  • 4
2
votes
1 answer

How to get a fact value in clipspy and store it in a python variable

Say I have inserted a rule : (defrule matching (fever ?fever) (headache ?headache) (disease (fever ?fever) (disname ?disname1) (headache ?headache)) => (assert (dis ?disname1))) Now I want to fetch the value of ?disname1 into a…
2
votes
1 answer

How to programmatically define a rule in clipspy?

Just installed clipspy on Fedora 26. I can assert simple facts like so: >>> from clips import Environment >>> env = Environment() >>> env.assert_string('(a)') ImpliedFact: f-1 (a) How do I programmatically define a rule please? I can't find any…
2
votes
1 answer

loading clips construct with clipspy

Just installed clipspy on a windows-10 64bit; and testing in a Jupyter notebook I have; from clips import Environment, Symbol import os env = Environment env.load('D:\\Documents\\Clips\\clipspy\\Tree_Solve_Learn.clp') And get this…
drmatrix
  • 23
  • 5
1
vote
1 answer

In clipspy, how can I get asserted fact from a python class or def function?

I want to create an expert system program to do risk analysis in occupational safety. I code this program in CLIPS. To create GUI and to add new attribute it, I want to recode in Python with clipspy and tkinter libraries. In this program, according…
1
vote
1 answer

Clips empty error in ClipsPy when using make_instance

I am new to CLIPS and to clipsPy. I am trying to create a instance of a CLIPS class This is the class I have defined and correctly build in my python environment (clipsPy) ENTITIES_CLASS = """ (defclass ENTITY-CLASS (is-a INITIAL-OBJECT) (slot…
Angel
  • 1,959
  • 18
  • 37
1
vote
1 answer

Communicating with Clips rules engine in Python

I would like to communicate several times with Clips rule engine in Python 3.8.3. For example, I would like to have the following communication Launch Clips C:\Users\username\Clips>"C:\Program Files\CLIPS 6.31\CLIPSDOS64.exe" …
Heikki
  • 2,214
  • 19
  • 34
1
vote
1 answer

how to retract a fact using clipspy

How to retract a fact in CLIPS from a python fucntion using clipspy. I tried using build() but the fact is still there. ;;--KB.clp--;; (defrule main-intent (initial-fact) => (assert (fact one)) (assert (fact…
greenlantern
  • 374
  • 1
  • 3
  • 15
1
vote
1 answer

clipspy: How to get slot dictionary of instance

The documentation contains this example code: ... klass = env.find_class('MyClass') instance = klass.new_instance('instance-name') instance['One'] = 1 instance['Two'] = 2 Is there a built-in feature that gives me a dictionary of the slots and their…
langlauf.io
  • 3,009
  • 2
  • 28
  • 45
1
vote
1 answer

clipspy pendant for pyclips clips.ErrorStream.Read()

Is it possible to read the ErrorStream from clips using clipspy? With pyclips, it worked this way: clips.ErrorStream.Read(). Does it even make sense to do it with clipspy, or are all errors thrown as exceptions and can be caught with…
langlauf.io
  • 3,009
  • 2
  • 28
  • 45
0
votes
1 answer

CLIPS/Clipspy codes run rule multiple times

I have written codes to create an expert system in risk analyses and create GUI. I use clipspy library in python. at the beginning, in a page I get my answers and then assert facts. in each page I saved facts in ".fct" file. In a different page, I…
0
votes
1 answer

I get a syntax error when executing the code using clipspy

I don't see the bug in the syntax of the program, the error I get is this: Reglas.CLP, Line 6: Syntax Error: Check appropriate syntax for defrule. ERROR: (defrule MAIN::DormitorioIluminación_Encender ?d <- (Dormitorio (Presencia Si)…
0
votes
2 answers

Why does this error occur when creating an expert system in Python using clipspy?

When I run the code I get this error: clips.common.CLIPSError: [CSTRNCHK1] test.CLP, Line 7: A literal restriction value found in CE #1 does not match the allowed types for slot 'Presencia'. ERROR: (defrule MAIN::r1 ?d <- (dormitorio (Presencia…
1
2 3