----------------------------------------------------------------------- | | | Amzi! News, Spring 1995 | | | ----------------------------------------------------------------------- Contents New Web Page New Subscription Plus Service Keeps You Up-to-Date Automagically NT Edition Available Now A Word from Development New Education Site Licenses and Pricing for Classroom Use Integrating Prolog and C++ Upgrade/Order Form New Web Page ------------ All of our product information, demos, sample code, news, articles and other information are available on the web at: http://world.std.com/~amzi/ New Subscription Plus Service Keeps You Up-to-Date Automagically ---------------------------------------------------------------- As Cogent Prolog is under active development, new features are being added all the time. We wanted a way to keep everyone up-to-date with the latest software; hence the new Subscription Plus service. Here's how it works... When you subscribe, you will receive the lastest update (currently April95). Then, for the next year, you will automatically receive updates as they are released. Each update will include all the new features, enhancements, maintenance updates and documentation. We anticipate sending out diskettes 3-4 times per year and a new manual once a year. We will also include you in any applicable beta test programs, so you can try out software under development. Subscription Plus costs $150 per year (and is in addition to our normal technical support services.) Try April95 If you already have Cogent Prolog 3.0 andwould like a sample of Subscription Plus you can get the April95 release for $19. Just contact us by May 31st and include a check, MasterCard or Visa number. Individual Updates Non-subscribers will still be able to get the latest features under this schedule based on how long you've owned Cogent Prolog: 0-3 months $50 4-6 months $90 7-9 months $120 10-12 months $150 13-24 months $175 25+ months $195 Of course these prices might change in the future, but this gives you the general idea. NT Edition Available Now ------------------------ We have a Win32s DLL and a 32-bit IDE ready to run under Windows NT. This lets you develop both NT and Win32s applications with Cogent Prolog. The NT Edition of Cogent Prolog includes everything in the current Windows and DOS Edition, plus the following new components: - An NT version of the Interactive Developer's Environment (IDE), which provides a full 32-bit address space for development. - A dynamic Win32s library (DLL) that can be used under Windows 3.x and NT. - A Microsoft Visual C++ 2.0 Static Library (LIB) The NT Edition is $448. You can upgrade from any other edition of Cogent Prolog for the difference in price. A Word from Development ----------------------- From the desk of Dennis Merritt... Cogent Prolog has come a long way over the last few years. From a pure 16-bit DOS-based system it has migrated to 32-bit DOS, 64-bit OSF/1, Windows, OpenVMS, and Windows NT. The fundamental architecture has been redesigned, allowing Prolog to easily become an embedded component in today's applications. As part of that effort, the Logic Server API simplified the interaction between host languages and Prolog by exploiting the similarity between Prolog and relational database. Call-in and call-out API functions make Cogent an extremely malleable component of any application. Library support was added for a number of C/C++ compilers, and a DLL version was released, allowing embeddability in almost any Windows application development tool. The final component of the 3.0 release was a Windows IDE, allowing the conveniences of a GUI environment for developing Prolog code. The IDE was a fully compliant Windows application, with a complete repetoir of compulsory GPFs. Since that final release of 3.0 in January, we've removed most of the GPFs in the IDE, improved the performance of the dynamic database, cleaned up some of the error handling, and added a variety of features making the Prolog more versatile and the IDE easier to use. We're excited by the number of users implementing real-world multi- language applications with Cogent 3.0 and look forward to continuing enhancements to the product. Vying for position at the top of our development list are a VBX control, database connections, predicates for implementing GUIs directly from Prolog, improved IDE friendliness especially in regards to error handling, debugging tools for embedded components, multiple engine support, and more Prolog samples and application templates. We invite you all to become subscribers of Cogent Prolog, so you automatically receive all of the latest updates to the software, and subscriber or not, we always want to hear your opinions on how we can make the product more suitable for your application development needs. New Education Site Licenses and Pricing for Classroom Use --------------------------------------------------------- Site Licenses We have a new package for education site licenses. Licenses start at only 5 PCs, and can be obtained for any edition of Cogent Prolog or the Computer Lab edition of the Active Prolog Tutor. The basic license includes 2 manuals and disk sets and 1 technical support contact. You can get as many manuals as you need (at any time), or you can make your own with our photocopy master. You can also include up to 3 years of automatic updates, which ensures you will receive the latest software as soon as it's ready. If you would like a detailed price quote, please contact us with your needs: Which product? For how many PCs? At how many sites? Needing how many manuals (or the photocopy master)? Including how many years of automatic updates? Classroom Use If you would like to designate Cogent Prolog or APT as materials for a course, let us know: What is the name of the course? Who is teaching it? When is it offered? How many students usually enroll? What is the best way to get the students the product (e.g. bookstore, group order)? Many of our products can be obtained at a substantial discount for use as course materials, and we provide a complimentary copy for you, the instructor. Research Use Any education institution that has a site license or uses Amzi! products as course materials qualifies for special pricing for instructors, graduate students, researchers and others working at the institituion. Integrating Prolog and C++ -------------------------- Encapsulating Prolog Services in C++ Objects A C++ GUI front-end on the classic Prolog example of family relationship rules illustrates the smooth integration of C++ objects and the Logic Server API. C++ code interacts with the user through the GUI and draws on the Logic Server for Prolog services. The Prolog services are neatly encapsulated in a C++ class. The Prolog Code The Prolog code provides four types of logic services to the host application. The first two are: 1) accessing and manipulating the attributes of a person, and 2) maintaining a collection of persons in a particular family tree. These are database-like services. The second two services draw on Prolog's strength for rule-based programming. They are: 1) answering queries about relationships in the data, and 2) providing semantic integrity checks on entered and updated data. The relationship rules are the classic ones defining "parent", "ancestor", "uncle", etc. The semantic integrity rules ensure the database makes sense. For example, in a genealogical tree database, a person should not be his or her own ancestor. Predicates illustrating these last two cases are: % Ancestor query ancestor(A,P) :- parent(A,P). ancestor(A,P) :- parent(X,P), ancestor(A,X). % Ancestor semantic integrity check ancestor_check(Name) :- ancestor(Name,Name), message($Person is their own ancestor$), !, fail. ancestor_check(_). The GUI, C++ and Prolog The GUI lets the user load and save family databases, use list-boxes to pose relationship queries, and use dialog boxes to update the family database. The screen shot shows the query dialog, in which the user picks a name from the first list box and a relationship from the second. The "Do Query" button then causes the system to populate the third list box with a list of names satisfying the relationship. C++ is well suited to GUI programming, as it allows for the natural encapsulation of the various objects that comprise the interface. In this example, there are objects that correspond to each of the dialogs the application has with the user. C++ is also well-suited for interfacing with Prolog, as it enables the application programmer to implement an object that encapsulates the Prolog services. In this way the C++ interface to the Prolog services is well defined, and the implementation can be maintained without impacting the rest of the application. For example, the query dialog is a C++ object. One of its member functions responds to the "Do Query" button. It gets the selected name and relationship from the first two list boxes and then passes these, as well as a pointer to the third list box, to a member function of the C++ object that encapsulates the Prolog services. void QueryDlg::OnDoQuery() { CListBox *lbAnswers; char *name, *relation; // extract name and relation from // list boxes ... // pass information to Prolog server proGene.Answers(lbAnswers, relation, name); ... } The Prolog services object builds the Prolog query and calls Prolog through the Logic Server API. It maps the answers back into the listbox. Here is the member function that provides the answers: BOOL ProGene::Answers(CListBox *lb, char * relation, char * name) { // build the query & call LSAPI sprintf(qbuf, "%s(X,'%s')", relation, name); tf = CallStr(&t, buf); // get the answers (in first argu // ment), add each to the list box, // and get next answer while (tf) { GetArg(t, 1, cSTR, abuf); lb->AddString(abuf); tf = Redo(); } return TRUE; } (If the relationship was "sibling", and the person "mary", then this code is similar to the pure Prolog query: "?- sibling(X, mary), write(X), nl, fail." , which finds all of mary's siblings.) All communication between the C++/GUI code and Prolog is in this same vein. The result is that the GUI portions of the code are completely shielded from the Prolog logic, and the Prolog code is completely shielded from the GUI. The communication between the two is neatly encapsulated in the C++ object that provides Prolog services. That Prolog object is easily defined by derivation from the C++ wrapper on the Logic Server API, as shown in the listing below. / C++ Class derived from the Cogent // Prolog engine class class ProGene : public CPEngine { public: // constructor initializes Prolog and // loads program ProGene(); // destructor cleans up Prolog // environment ~ProGene(); // Manipulate the family database BOOL Open(const char *); BOOL Save(); // Map Prolog generated information // to list-boxes BOOL Persons(CList-box *); BOOL Relationships(CList-box *); BOOL Answers(CList-box *, char * relation, char * name); // Provide update services BOOL PersonData(Person *); BOOL AddPerson(); BOOL DelPerson(char *); BOOL SaveValid(Person *); // Process Prolog errors private: void PrologError(char * s, RC rc = 0); } This article is an abridged version of an article from the upcoming May/June issue of PC AI magazine--available on newstands or by calling 602/971-1869. (The source code for both C++ and Visual Basic versions of this application is included with the Cogent Prolog samples.) Upgrade/Order Form ------------------ Instructions: In an attempt to make a fair and comprehensible upgrade, we have opted for a scheme which charges the full price for the new versions and then provides you with a credit for products you already own. (If you have multiple copies of Cogent, please contact us.) Also the packaging for version 3.0 has changed. The full Cogent Prolog system ($298) includes what was formerly called the Compiler & Interpreter and Linker & Runtime. Hence, the Linker & Runtime is no longer a separate product. As always you can upgrade from one product to the next. So, if you already upgraded to version 3.0 Cogent Prolog, you can add the NT Edition for the difference in price ($448-298=149). Name: Company: Full Mailing Address: Phone: Payment Method: __Check __MasterCard __Visa Card #: ___________________________ Exp Date: ____ Signature: _______________________________________ My Serial Numbers are (fill in all that apply if you have not registered): Cogent Prolog, v 3.0 _______________ Cogent Prolog Interpreter-Only _______________ Cogent Prolog Compiler/Interpreter _______________ Cogent Prolog Linker/Runtime _______________ If you did not purchase from us, and purchased after 5/15/94 please enclose a copy of your dated sales receipt. To order, call us: 508 / 897 - 7332 Or, mail form to: Amzi! inc. 40 Samuel Prescott Drive Stow, MA 01775 U.S.A. Or, FAX to: 508 / 897 - 2784 Or, E-Mail to: amzi@world.std.com on Internet [1] Check the product(s) you want and enter the price. __ Cogent Prolog for NT/Win/DOS, v 3.0 $ 448 _______ __ Cogent Prolog for Win/DOS, v 3.0 $ 298 _______ __ Interpreter-Only, v 3.0 $ 49 _______ __ Compiler/Interp-Only, v 3.0 $ 149 _______ __ Subscription Plus $ 150 _______ [2] Also, please send me (enter quantity and total price): __ Expert Systems in Prolog $ 87 _______ __ Active Prolog Tutor $ 75 _______ __ Programming in Prolog $ 34 _______ __ Adventure in Prolog $ 39 _______ [3] If you are upgrading from version 2.0, for each product you already own, you receive a credit. Use the left hand column if you purchased the product before 5/15/94 and the right hand column if purchased on 5/15/94 or later. Before After __ Interpreter-Only $ 30 $ 49 _______ __ Compiler & Interpreter $ 100 $ 149 _______ __ Linker & Runtime $ 65 $ 99 _______ Note: You cannot get credit for both the Interpreter-Only and the Compiler & Interpreter. [4] If you are upgrading from version 3.0, you get a credit for the Edition you already own. Enter $298 for the full system, $149 for the compiler and $49 for the Interp. _______ [5] Subtract line #3 or #4 from lines #1 and #2 _______ [6] Add shipping ($10 US/Canada/Mexico, $20 All Others) _______ [7] Add 5 and 6 (Payable in US$ Please) _______