Representing data structures in Prolog

From: Alfonso Esteban Gonzalez Sencion (sencion_at_alcatel.es)
Date: 02/16/04


Date: Mon, 16 Feb 2004 12:04:09 +0100

Hello all.

I am using SWI-Prolog for verifying the configuraiton of the informacion
of a traffic control system. I find Prolog very convenient because of
the ease of writing new rules with which to test the coherence of the
system. Unfortunatley I have some difficulties with the representation
of knowledge with Prolog.

My problem is the following. I have several facts of the form.

        one_fact(par1,par2,par3,par4,par5,par6,.....,parn).
        another_fact(par1,par3,par4,par5,par6,......,parn).

As you see each fact has a substantial number of parameters and some
of them may be optional.

When I want to match one of the facts to get some of parameters I
usually do the following.

        onefact(_,_,_,_,_,_,_,X,_,_,_,_N,....,_,_)

As you see I have to be careful with the number and positions of the '_'
and also with the variables postions. That I find it very error prone.
So far I have been geting around the problem using a limited number of
parameters but I would like to represent all the information.

So, the question is. Is there a better way of representing the
information in prolog? Something similar to a structure in C or an
object in object oriented languages. For example:

        object.fieldname(X).

Thanks in advance



Relevant Pages

  • Re: Representing data structures in Prolog
    ... > of a traffic control system. ... > of knowledge with Prolog. ... I have several facts of the form. ... > object in object oriented languages. ...
    (comp.lang.prolog)
  • Re: Representing data structures in Prolog
    ... > the representation of knowledge with Prolog. ... I have several facts of the form. ... > object in object oriented languages. ... And create rules with multiple arguments to express more succinctly ...
    (comp.lang.prolog)
  • Re: Representing data structures in Prolog
    ... >> informacion of a traffic control system. ... >> the representation of knowledge with Prolog. ... I have several facts of the form. ...
    (comp.lang.prolog)
  • Re: Representing data structures in Prolog
    ... > of a traffic control system. ... > of knowledge with Prolog. ... I have several facts of the form. ... of all the predicates that you intend to define before you define them. ...
    (comp.lang.prolog)
  • Re: Representing data structures in Prolog
    ... something already available in the Prolog language in order to ... Unfortunatley I have some difficulties with the representation ... I have several facts of the form. ... > object in object oriented languages. ...
    (comp.lang.prolog)