g.infer - An rule-based expert system shell based on CLIPS.
general, expert system, inference, CLIPS, rule engine, rete
g.inferv [-bflmrsvx] [raster=Raster layers] [raster3d=Volume layers] [vector=Vector layers] [facts=Fact file] [payload=Rule base] [columns=Output attributes] [output=Output layer] [strategy=Inference strategy] [salience=Salience evaluation] [module=Rule module(s) for inference focus] [limit=Upper limit for inference runs] [--verbose] [--quiet]
- Activate CLIPS dribble mode. Content will be written to file: outputlayer.dribble
- Don't use raster layer labels
- Stop execution before inference run
- Traceback of CLIPS error messages
- Don't delete intermediate vector layer for raster output
- Verbose module output
- Quiet module output
- raster=Raster Layer(s)
- GRASS raster layers to convert into CLIPS facts
- raster3d=Raster3d Layer(s)
- GRASS raster3d layers to convert into CLIPS facts
- vector=Vector Layer(s)
- GRASS vector layers to convert into CLIPS facts
- output=Layer Name
- Name of output layer (a layer used for input ot new layer)
- facts=Facts File
- Filename for upload of CLIPS facts
- rules=Rule Base File
- File containing rules for upload (batchstar) into CLIPS facts.
Allows the user to input rules to g.infer from
an ASCII file. This rulesfile must exist in the user's current working
directory or be given by its full pathname. File rules
statements take the same form as those given on the CLIPS command
- GRASS attributes for new output layer
- strategy=Inference Strategy
- Name of the inference strategy to be used
- Options: depth,breadth,lex,mea,complexity,simplicity,random
- Default: depth
- salience=Salience Evaluation
- Name of the salience evaluation approach used for the rulebase
- Options: when_defined,when_activated,every_cycle
- Default: when_defined
- module=Rule Module Name(s)
- Name of one or more module which will be put on the focus stack before the inference run
- limit=Layer Name
- Upper limit of inference runs
- save=CLIPS entities
- Selection of CLIP entities to be written to disk - add binary to override ASCII output
- Options: constructs,facts,instances,binary
- Default: ASCII files
- watch=CLIPS entities
- Selection of CLIP entities to be watched during inference run
- Options: activations,compilations,facts,functions,genericfunctions,globals,methods,messagehandlers,messages,rules,slots,statistics,all
- Default: none
- print=CLIPS entities
- Selection of CLIP entities to be printed out before the inference run
- Options: agenda,breakpoints,classes,deffacts,definstances,facts,functions,generics,globals,instances,rules,subclassinstances,templates
- Default: none
- config=CLIPS Configuration
- Configuration options for CLIPS engine
- Options: autofloatdividend,dynamicconstraintchecking,factduplication,incrementalreset,resetglobals,sequenceoperatorrecognition,staticconstraintchecking
- Default: none
- classdefault=CLIPS Default Setting
- Class default of CLIPS engine
- Options: convenience,conservation
- Default: convenience
The module g.infer provides an expert system shell for the GRASS GIS environment
based on the C Language Integrated Production System (CLIPS).
GRASS raster-, raster3d- and vector- layers and GRASS session metadata are transformed
into logical facts to be acted on by CLIPS.
The behaviour of the CLIPS inference engine is controlled
by a set of user-defined production rules will be applied by the CLIPS inference engine.
The production rules are
typed into a file by the user using a system editor like
vi, and then input to g.infer as the rules-file named on the command line.
The inferred results are used to update one of the
input layers or to create a new vector layer. In the latetr case the attribute structure is defined by the columns-option).
Besides the mandatory rulebase, additional CLIPS-constructs (facts, procedural code, CLIPS Object Oriented Language (COOL) objects)
can be provided prior to the inference run via the rules-file or the facts-option.
All CLIPS constructs can be printed (print-option) or saved to file (save-option)
and the inference run can be logged (dribble-option) to file.
The results are used to generate a new raster map layer named
infer in the user's current mapset.
If run without arguments, g.infer starts with a GUI or the command line interface.
Currently no CLIPS command line prompt for interactive use is provided.
The program will be run non-interactively if the user
specifies the name of a rules file and any desired flags on
the command line, using the form (simple raster processing):
where rulebase is the name of an ASCII file containing valid production
rules to g.infer, and the (optional) flags
-l and -t have the meanings described in the PARAMETERS section.
g.infer [-lt] raster=rasterlayer rules=rulebase output=rasterlayer
Alternately, the user can simply type g.infer on the
command line, without program arguments. In this case, the
user will be prompted for the needed parameter value and
flag settings using the standard GRASS
The current version of g.infer lacks a spatial index of all facts derived from the GRASS input layers.
Rule constructs making searches or changes to large numbers of facts can become quickly computation intensive.
Documentation for CLIPS and pyCLIPS is recommended for in depth srtudy on how to formulate rules in CLIPS or how to use COOL (CLIPS Object Oriented Language) instances.
Interfacing with othe rule-based systems such as Protege2000 can be achieved by using the -x flag to create output files containing the facts,
rules and instances known to CLIPS before the actual inference run. This is also a good starting point for debugging.
It is not recommended to use g.infer as a substitute for r.mapcalc, which provides far superior computation performance.
If such tasks nevertheless must be achieved in g.infer, it is advised to use declarative programming (see CLIPS manual FIIFAAFOOO) instead of inference rules.
tbd: Only point vector support is provided
tbd: rule-driven issuing of GRASS commands
tbd: g.infer functions to turn GIS spatial layers into CLIPS-facts.
CLIPS Documentation (DRAFT)
The usage of CLIPS is beyond the scope of this module description.
Detailed information about the usage and programming of CLIPS is available here.
A recommended starting point is the CLIPS users guide.
A introduction book about expert systems with an emphasis on CLIPS is Expert Systems by Giaratano and Riley.
See also r.infer
Peter Löwe, GISIX.com
Special recognition goes to:
James Westervelt, U.S.Army Construction Engineering
Mr. Westervelt released the original GRASS inference module, r.infer, which was maintained until versions GRASS 5.x.
Robert Inder, Interactive Information Limited
Mr. Inder developed Clips And Perl with Extensions (CAPE), available here,
which was used instead of pyclips to implement a successor module GRASSCAPE .
For documentation effort and maintenance of CLIPS. Mr. Riley develops and maintains the CLIPS module
Mr. Garosi develops and maintains the pyCLIPS module, which fully embeds the CLIPS engine, with COOL (Clips Object Oriented Language) and environments support.
Last changed: $Date: 2012-02-10 19:00:00 +0100 (Fri, 10. Feb 2012) $
Main index - general index - Full index
© 2012 GRASS Development Team