SPARCL Help

Copyright © 2002 Lindsey Spratt. All rights reserved.



Related topics:
Programming Environment,
How Programs Work,
Release Notes,
Interaction Log,
Comments about SPARCL


Introduction
SPARCL is a visual logic programming language based on sets with partitioning constraints by Lindsey Spratt. The name derives from "Sets PARtitioning Constraints and Logic". This is implemented as part of the PhD research by Lindsey Spratt. This implementation is incomplete in many respects - it is only a demonstration of the basic ideas of the research project, not a full realization. The semantics of SPARCL are similar in many ways to Prolog.
Comments about SPARCL may be recorded via "Record Comment about SPARCL..." in a file in the folder with the SPARCL application.


Related topics:
Release 2.E.1
Release 2.E.0
Release 2.D.6
Release 2.D.5
Release 2.D.4
Release 2.D.2
Release 2.D.1
Release 2.D.0
Release 2.C.2
Release 2.C.1
Release 2.B.1


Release Notes This is release 2.E.2; the previous release was 2.E.1. The current release includes:
  • Added 'Record Script Steps' option to 'File ' menu.
  • Fixed the tutorial to run--scripting (that runs the tutorial) had a "wired in" 'Macintosh HD:Script Record' pathname for script step recording, this pathname failed if there wasn't a 'Macintosh HD' volume and caused the tutorial to not run.




Release 2.E.1
Release 2.E.1 includes:
  • Removed yellow link color.
  • Fixed clause/1 to work for '*DELAY*'/2 clauses.
  • Fixed ntuple "flattening" (wasn't recursing on first element)
  • Fixed setof/multisetof to determine all "local" (existential) vars, particularly including those vars in the constraints and persistent term table that are not in the setof body literals.
  • Fixed linear transform to not generate a useless unify/2 when the term being transformed is a var--the transform of this term is (also) a var and is now simply bound at "transform time" to the "reference" term for the display var.
  • Fixed unification to not "oversimplify" (in certain circumstances it was incorrectly removing empty set members from sets).




Release 2.E.0
Release 2.E.0 includes:
  • Extensively reorganized the modularization of the implementation.
  • Fixed model generation for POV-Ray.
  • Improved model generation for QD3D.
  • Added automatic launching of model viewer (controlled by preference).
  • 'Launch Model Viewer' preference.
  • Changed POV models to also generate the foo.pov file (as well as the foo.inc file). The pov file is generated based on the 'SPARCL POV Template.PL' file.
  • Changed QD3D model generation to get the textures from an external file, 'SPARCL QD3D Textures.PL'.
  • Removed "Send files to developer..." option.




Release 2.D.6
Release 2.D.6 includes:
  • Changed the script control window layout.
  • Added "interrupt" handling for running scripts. This allows the user to let a script "run" toward its end, then interrupt the "run". The script mechanism then switches back to "step" mode at the step at which the interrupt was received.
  • Fixed sparcl_metapredicate/3 to define if/3 and ordered_disjunction/2 as metapredicates. Also changed sparcl_metapredicate/3 to "return" a list of metapredicate arguments instead of a single metapredicate argument. These changes supported fixing Program Overview Graph correctly recognizing predicate "uses" through if/3 and ordered_disjunction/2.




Release 2.D.5
Release 2.D.5 includes:
  • Bug fix in getting name/arity from user.
  • Improved "How" message when creating a clause.




Release 2.D.4
This is release 2.D.4; the previous release was 2.D.3. (there is no separate info for release 2.D.3) The current release includes:
  • Various bug fixes in the interpreter and program overview graph.
  • Added the predicates write/1, grounded_write/1, ordered_disjunction/2, and if/3.
  • Moved some options to a new menu, "Tools ", from the "File " menu.
  • Added "Trace Modes..." for setting Skip/Spy goal patterns for use during verbose queries.
  • Added a splash screen.
  • Added simple sound handling for associating sounds with "keyed" events in SPARCL, currently, the only keyed event is the startup sound.




Release 2.D.2
Release 2.D.2 includes:
  • Improved highlight focusing in the scripting facility: the drawing pane is now moved only as much as necessary to include the focus region.
  • Demonstration popup menus in the scripting facility.
  • Animated demonstration cursor in the scripting factility.
  • New builtins in the interpreter: *TERM*/1--a "dummy" which succeeds for any term, useful for introducing partitioning constraints into a clause. ordered_disjunction/2--this allows the programmer to specify the order in which disjunctive alternatives are attempted. write/1--writes a linear form of the given term to the *Output* window. grounded_write/1--same as write/1, but delays until its argument is ground.
  • selective use of the viewer on program windows. The viewer is now turned off when a program is being displayed for the first time. This is to speed up displaying the program. Also, the scripting facility runs with the viewer off.
  • Added the "Save Program as..." option to the "File " menu and the "Save as..." option to the "Term Set" submenu of the "File " menu.
  • Added the "Close All" option to the "Tutorial Scripts" submenu.
  • Changed the "Run the introduction" option to "Run the Tutorial" on the "Tutorial Scripts" submenu of the "File " menu.
  • Added the "Major Scripts" menu to the scripting control window. This menu allows the user to "go to" a chapter or section of the tutorial "directly". It also helps the user keep track of where they are within the tutorial, since it highlights the current "major script".




Release 2.D.1
Release 2.D.1 includes:
  • Improved highlighting in the scripting facility: the marker is a rounded box instead of a circle and thus is closer to the object being highlighted, the view pane is scrolled to show the objects being highlighted, there is a comment-with-highlight command in the scripting facility.
  • Extensive additions to the tutorial.




Release 2.D.0
Release 2.D.0 includes:
  • Added scripting facility for active tutorial help. This facility is accessed via the "Tutorial" button on the "about" dialog and from the "Run the introductory tutorial" option of the "Tutorial Scripts" submenu of the "File " menu. Some scripts have been created which begin the introduction to SPARCL.
  • Fixed bug in "Undo" facility: the 'contains' clause was incorrectly noted (just an unbound variable was recorded) causing one to get a "Control error" from either retractall/1 or assert/1 when trying to undo or redo, respectively.




Release 2.C.2
Release 2.C.2 includes:
  • Printing
  • Preferences for: recording interactions, additional query tracing info (ancestors and delays).
  • Bug fix: linking multiple terms works (and particularly linking together terms which are already in distinct coreference links, which now correctly creates a combined coreference link).
  • Fixed to support repositioning selections in TermSet windows.
  • Fixed to include "covered" references in copied images.
  • Fixed to not offer '*TERM*' as a possible literal or clause name (this is an internal clause name used for term-holding clauses).
  • Changed preference dialog for object display parameters with integer ranges to only popup if the range is => 25 (was 30).
  • Changed dop_translate_item_spec/9 for integer_range(_,_) to use dop_maximum_integer_range_popup_range/1.
  • Fixed to allow multiple uses of the same result output term set window.
  • Added 'Reset Programming Environment' option to 'File ' menu.
  • Fixed to report when the query fails. SPARCL used to create an output window with the unsolved clause head.




Release 2.C.1
Release 2.C.1 includes:
  • Program Overview graph.
  • Program Size Measurements.
  • Interaction logging.
  • Facility for recording comments about SPARCL.
  • User name handling, including new preference settings.
  • Text editing commands (cut/copy/paste/clear).
  • More "focused" enabling/disabling of menu items.




Release 2.B.1
Release 2.B.1 includes:
  • intensional sets
  • "display object parameters" settable as 'preferences'.


Related Topics:
Programs, Term Sets, and Projects,
Information Windows,
Programming Tools,
Preferences.


Programming Environment The major programming environment elements are evaluable programs, term sets, and projects. Additional information is presented in the *Output*, *Program Size Measurements*, *Program Overview*, *Trace Ancestors*, and *Trace Delays* windows. Tools to help with programming in SPARCL are the "Program Overview Graph", "Undefined Literal References...", and "Program Size Measurements" options of the "File " menu. Various aspects of the SPARCL environment may be tailored via the "Specify Preferences".
There is a multi-level undo/redo facility, available through the 'Edit ' menu.
Also on the 'Edit ' menu are the cut, copy, paste, and clear operations for either text or "objects". The objects are the "display objects" which are the components of programs and terms. The paste operation pastes INTO the selected object, rather than REPLACING the selected object. The 'Copy Image' option puts a quickdraw image of the selected object (and all of its subobjects) on the *clipboard*, this can then be pasted into other applications as a simple picture.
SPARCL records every user interaction in interaction logs (one per user per day), by default (this can be turned off). These provide data for studying how people use SPARCL (this is a research project, after all...).
Users can record comments via the 'Record Comment About SPARCL...' option of the 'File ' menu. These comments are date&time/user/version stamped and placed in a per-month system comment log.




Information Windows The information windows are *Output*, *Program Size Measurements*, *Program Overview*, *Trace Ancestors*, and *Trace Delays*. These are created by SPARCL as needed. Closing one of these windows (as with program windows) does not remove any information, it only "hides" the window. These windows are all listed on the 'Windows ' menu and can be made visible by selecting them from that menu .
*Output* is created by the 'Query:Verbose' or 'Query:Brief' options of the 'program' popup menu (in a program window). It is used to display basic trace and timing information for evaluating queries.
*Program Size Measurements* is created by the 'Program Size Measurements' option of the 'File ' menu. It is used to display metrics for the currently open SPARCL programs.
*Program Overview* is created by the 'Program Overview Graph' submenu of the 'File ' menu. It is used to display a graph showing which predicates "use" (or "call") which other predicates.
*Trace Ancestors* is created by 'Query:Verbose' when the 'Ancestors' secondary info mode is selected for Verbose display mode (which is set via the 'Execution Trace Mode...' option of the 'Specify Preferences' submenu of the 'File ' menu). It is used during evaluation of a query to show the "current" stack of goals being evaluated at each "step" of the evaluation process.
*Trace Delays* is created by 'Query:Verbose' when the 'Delays' secondary info mode is selected for Verbose display mode. It is used during evaluation of a query to show the "current" set of goals which have had their evaluation "delayed" at each "step" of the evaluation process.


Related Topics:
Program Overview Graph,
Undefined Literal References...,
Program Size Measurements.


Programming Tools
Tools for programming in SPARCL are invoked by the "Program Overview Graph", "Undefined Literal References...", and "Program Size Measurements" options of the "File " menu. The "Program Overview Graph" displays the relationships among SPARCL predicates. "Undefined Literal References..." presents a menu of predicates which still need to be defined. The "Program Size Measurements" are several measurements of how "big" is the currently loaded group of programs.




Program Overview Graph
The Program Overview Graph, or "call" graph, shows a graph of predicates (relations) where two predicates (relations) are connected if one of them "uses" the other in one (or more) of the bodies of its defining clauses. This graph can be generated with or without the SPARCL builtins.




Undefined Literal References...
"Undefined Literal References..." presents a menu of predicates are present in the body of some clause and for which there are no defining clauses.




Program Size Measurements
The "Program Size Measurements" are several measurements of how "big" is the currently loaded group of programs. These measurements are based on an analysis of the number of "tokens" used in representing the loaded programs. These tokens are divided into operators and operands. These counts of operators and operands are used in various combinations to create values for "vocabulary", "size", "volume (basic)", "program level", "language level (basic)". The "special" measurements rely on the special vocabulary measurement, which in turn is based on the basic token counts divided more finely than the operator and operand categorization.




Programs, Term Sets, and Projects
Evaluable programs, term sets, and projects are the major programming environment elements. A term set is sometimes considered to be a non-evaluable program (or a "term set program"). A program or a term set is associated with a window. A project is a collection of programs and term sets. Programs, term sets, and projects all have the basic commands of new, open, close, and save.


Related Topics:
'Execution Trace Mode...'
'Display Object Parameters...',
'Undo Limit...',
'Model Type...',
'Program Colors...',
'User Name...',
'User Name Refresh Mode...',
'Record Interaction'.

'Record Script Steps'.


Preferences
Many aspects of SPARCL are controlled by 'preferences'. These are specified via the 'Specify Preferences' submenu of the 'File ' menu. These preferences are saved by the 'Save Preferences' option of the 'File ' menu. Preferences are automatically loaded when SPARCL starts up. Preferences are NOT automatically saved, so the 'Save Preferences' option must be used to make changes to preferences be used in subsequent invocations of SPARCL. The preference options are:
  • 'Execution Trace Mode...'
  • 'Display Object Parameters...'
  • 'Undo Limit...'
  • 'Model Type...'
  • 'Program Colors...'
  • 'User Name...'
  • 'User Name Refresh Mode...'
  • 'Record Interaction'
  • 'Record Script Steps'




Execution Trace Mode...
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying which of the ancestors and delay traces to show when executing a verbose query.




Display Object Parameters...
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying various parameters which control the display program windows. The various elements displayed in program windows are referred to as "display objects". Each type of display object has its own set of parameters. Only a few of the display object types currently have user-settable parameters.




Undo Limit...
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying how many steps "back" the "undo" mechanism allows the user to "undo". The larger this limit is set, the more storage the mechanism must use to keep track of the undoable steps. A fairly low number is advisable (e.g. 5).




Model Type...
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying which kind of 3D model file is to be generated by the 'Write Model' option of the clause popup menu (in a program window). There are three kinds of files: QuickDraw3D metafile, SGI Open Inventor file, and POV-Ray file. None of these is completely implemented: all three formats are undefined for the Term Table and Fact Table display objects.




Program Colors...
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying the colors of the two parts of a program window: the "Drawing" paper (main viewing portion of the window) and the "Tools" paper (the small portion to the left of the window).




User Name..
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying the name of the person using SPARCL. This "user name" is used in recording interactions (there is an interaction log per-user-name per-day) and in recording system comments.




User Name Refresh Mode..
This option of the 'Specify Preferences' submenu of the 'File ' menu is for specifying whether SPARCL should always query for the user's name when starting up, or if it should only query if the user name hasn't been set.




Record Interaction
This option of the 'Specify Preferences' submenu of the 'File ' menu sets the "record interactions" mode. When it has a check mark, then all of the user's interactions with SPARCL are recorded in an interaction log. This log is stored in the 'User Documents.X' folder in the same folder as the SPARCL application file and is per-user-name per-day. If this option is not check marked, then the user's interactions are not recorded.




Record Script Steps
This option of the 'Specify Preferences' submenu of the 'File ' menu sets the "recording script steps" mode. When it has a check mark, then all of the user's steps in a script (e.g. in the tutorial) are recorded in an "script record". This file is stored in the 'User Documents.X' folder in the same folder as the SPARCL application file and is per-user-name per-day. If this option is not check marked, then the user's script steps are not recorded.


Related topics:
Parts of a Program


How Programs Work
SPARCL is a logic programming language based on Horn clauses. A program is all of the items in the same window (or file) in the editing environment. Informally, these items are rules and facts. One runs a program by picking a particular rule and telling the system to "run" that rule as a "query" - try to determine if there is a way in which that rule's antecedents can be shown to be true using all of the other rules and facts given by the defined programs. If there is such a way, the result is reported as a term in a "term set" window.


Related topics:
Theory,
Relation,
Clause,
Term.


Parts of a Program
The parts of a program are: theory, relation (relation name, relation arity), clause (clause head, clause argument, clause body), literal (literal name, literal argument), term (empty set, ur term, variable, partitioned set, ntuple, table, intensional set).




Theory
A *theory* is a set of relations (which are defined in a set of programs).




Clause
A *clause* has a head and a body.
A *clause head* is a positive literal.
A *clause argument* is any element of the *clause head* except the first one.
A *clause body* is a set of positive literals.




Literal
A (positive) *literal* is an ntuple that has a *literal name* as its first element and any number of *literal arguments* as its other elements.
A *literal name* is an ur element which is the first element of a *literal* ntuple.
A *literal argument* is any element other than the first one of a *literal* ntuple.




Relation
The set of all of the clauses that have clause heads with identical relation names and relation arities defines a *relation*, with that name and arity.
A *relation name* is the first element of a *clause head*.
The *relation arity* of a *clause* is the number of *clause arguments* for that *clause*.


Related topics:
Basic Terms
Alternative Set Representation Terms


Term
A *term* is a basic term (empty set, ur term, or variable, partitioned set) or an alternative set representation term (ntuple, table, or intensional set). The ntuple, table, and intensional set terms are alternative representations of sets. Thus, all terms in SPARCL are semantically built out of only empty set, ur, variable, and partitioned set terms.




Basic Terms
An *empty set* is a constant value used to represent an empty set.
An *ur term* is any constant value other than the empty set.
A *variable* is a term which can be "bound" to another term.
A *partitioned set* is a set of partitioning parts, where each part is a set of terms or is unoccupied. An unoccupied part of a partitioning is a variable which may be bound to a variable, partitioned set, or other partitioned part.




Alternative Set Representation Terms
An *ntuple* is a sequence of N elements. The ntuple is equivalent to the pair set {{a}, {a,b}}. An ntuple of more than two elements, equals <, an>.
A *term table* is a set of terms with particular properties. There are four kinds of term tables. Each row may be either an *ntuple* or a *function*. The rows may be either the elements of an ntuple or a set.
If a table has ntuple-type rows, then all of these row ntuples must have the same length. If a table has function-type rows, then all of these functions must have the same domain.
A *function* is a set of ordered pairs ('') where the set of first elements of these ordered pairs is the "domain" of the function and the set of second elements of these ordered pairs is the "range" of the function. No two ordered pairs in a function may have the same first elements (and different second elements).
An *intensional set* (or *intenSet*) is a definition of a set as the collection of terms which satisfy a property, i.e. the set of all X such that predicate(X).




Interaction Log
The Interaction Log is a text file formatted for easy "reading" from PROLOG. There is an interaction log per user name per day located in the same folder as the SPARCL application. The file is named '<UserName>, <CompactDate>.log', where the UserName is set via the 'Specify Preferences/User Name' option, the CompactDate is of the form <YYYYMMDD> (YYYY is the year, MM is the month, and DD is the day). There are log entries for nearly every interaction the user has with SPARCL. A log entry contains a time stamp, an action name, and the arguments for the action.




Comments about SPARCL
The comments about SPARCL are recorded is a text file formatted for easy "reading" from PROLOG. There is a comment log per month located in the same folder as the SPARCL application. The file is named '<YYYYMM>.syscom' (YYYY is the year, MM is the month).



This file was written by Lindsey Spratt. Last Modified on August 30, 2002.
This file's format is based on one created by Alex Nicolaou.