Ontolingua to prolog translation

Adam Farquhar <Adam_Farquhar@HPP.Stanford.EDU>
Date: Mon, 17 Apr 1995 14:35:59 -0700 (PDT)
From: Adam Farquhar <Adam_Farquhar@HPP.Stanford.EDU>
Sender: Adam_Farquhar@HPP.Stanford.EDU
Reply-To: Adam_Farquhar@HPP.Stanford.EDU
Subject: Ontolingua to prolog translation
To: ontolingua@HPP.Stanford.EDU, mfu@aiai.edinburgh.ac.uk, chgoh@MIT.EDU
Message-id: <XLView.798154806.6185.axf@hpp-ss10-3>
MIME-Version: 1.0
						16 April 1995

We have recently provided Ontolingua and the Ontolingua ontology
editor with the ability to translate into Prolog syntax.  This will
enable Prolog users to import the contents of Ontolingua ontologies
into their Prolog-based representation systems.  This document
describes the translation and some of the design decisions that we
have made.

We have decided to translate Ontolingua ontologies into a Prolog
syntax that closely mirrors the syntax of KIF (Knowledge Interchange
Format); KIF is a prefix form of first order logic with set theory.
This means that the translated ontologies are not runnable Prolog
programs, but are clauses that can be used by a Prolog theorem prover.
An alternative would have been to translate the Horn subset of an
ontology into standard Prolog clauses.  We chose not to do this
because it only works for a subset of Ontolingua axioms and we would
have to provide a secondary method for axioms outside of this subset.

The translator output is designed to be readable by a Prolog system,
rather than by humans.  A typical user might select an ontology from
the Ontology Editor (http://www-ksl-svc.stanford.edu:5915/) library;
use the "Email translation" command on the "Ontology" menu to generate
a translation and email it to a selected address; write the
translation to a file; and finally load the file into a Prolog system.
If desired, we can also provide a network interface to the translation


We welcome your suggestions and feedback.  Does this approach to
translation into Prolog work for your application?  How could we make
it more useful?

Please send feedback to:



The translator uses the following mappings from KIF to Prolog:

 "string"	"string"
 AA-BB		aa_Bb
 AA.BB		'aa.Bb'
 AA::BB		'aa::bb'
 ?VAR		Var
 @VAR		'@var'	- see note about sequence variables

Logical Sentences:
 (not sentence)		-(sentence)
 (and s1 ... sn)	s1 & ... & sn
 (or s1 ... sn)         s1 v  ... v sn
 (=> s1 ... sn)		=>(s1,...,sn)
 (<= s1 ... sn)		<=(s1,...,sn)
 (<=> s1 s2)		<=>(s1, s2)
 (= t1 t2)		=(t1, t2)	- NOT unification
 (/= t1 t2)		/=(t1,t2)
Quantified Sentences:
 (forall (?var ...) sentence)	forall([?var, ...], sentence)
 (exists (?var ...) sentence)	exists([?var, ...) sentence)

When viewing the output of the translator, you may want to declare the
following operator precedences:

     :- op(400,fy,-),    % negation
	op(500,xfy,&),   % conjunction
	op(600,xfy,v),   % disjunction
	op(650,xfy,=>),  % implication
	op(650,xfy,<=),  % reverse implication
	op(700,xfy,<=>). % equivalence


Sequence Variables:

One difficulty with the current translation is its treatment of
sequence variables.  KIF and Ontolingua allow for a sequence variable
that can bind with a list of terms.  Sequence variables are written
with an '@' followed by a symbol.  For instance:
	(<=> (subrelation-of ?child-relation ?parent-relation)
	     (=> (holds ?child-relation @arguments)
		 (holds ?parent-relation @arguments)))

        (subrelation-of p q)
        (holds p 1 2 3))
        (holds q 1 2 3))

The sequence variable @arguments might bind to (1 2 3).  Prolog does
not have anything corresponding to a sequence variable on terms,
although it does have '|' for lists, and it is possible to bind a
variable to the remaining arguments to a term (e.g., (a,b,c) = (a,X)
binds X to (b,c)).

We have chose to translate sequence variables as Prolog atoms (e.g.,
@arguments translates at '@arguments').  This will allow a Prolog
system to treat them in whatever way is appropriate.  We are open to
suggestions for better ways of handling sequence variables.

Unification and Equality:

Note that '=' in KIF and in the translation is not the same as
unification in Prolog.  For instance, the KIF sentence
	(= (+ (age-of gregory) 3) (age-of sebastian))
will be translated as
	=(+(2,age_of(gregory)), age_of(sebastian))        
which clearly will not unify, even though the terms denote the same

Ontolingua Specific Relations:

There are currently several relations that are Ontolingua specific and
are not defined in any ontology.  The functor of these relations will
have the prefix 'ontolingua_internal::'.  Two that currently
appear are 'ontolingua_internal::other_axioms' and
'ontolingua_internal::definition'.  These relations associate a
functor with a quoted sentence or list of sentences.  The quoted
sentence(s) also appear unquoted elsewhere in the translation.  Thus,
these assertions are redundant -- the translator or a Prolog
application may remove them without danger.  We have chosen to leave
them in the translation because some applications may find them
useful.  The other_axioms is a list of the axioms that help to define
a relation, but do not fit into a frame/slot/facet view.  The
definition relation lists the sentences that provide necessary and
sufficient definitions for a relation.