6.2 Structures, relationships and terms
A structure is a way of expressing a relationship among entities. For example:
What is a structure?
A structure has the following syntax:
The "terms" in the comma-separaed list between the parentheses can be any of the following:
Thus "term" is the name we give to any kind of data in Prolog+CG.
When writing CGs, you most often use structures to contain graphs. For example:
// Type hierarchy Entity > Animal, Act. Animal > Wolf, Lamb. // Catalog of instances Act = Hunt, Graze. // Graph facts gr(graph1, [Wolf]<-AGNT-[Act: Hunt]). gr(graph2, [Lamb]<-AGNT-[Act: Graze]).
Here, the structure "gr" is used twice to write graphs and associate them with an atom ("graph1" or "graph2").
Thus structures can be used to represent arbitrary relationships between terms. This is done by means of specific syntax, including an identifier, an opening parenthesis, a comma-separated list of terms, and a closing parenthesis. The comma-separated list of terms can be any length, including 1.
"Term" is the name we give to any kind of data in Prolog+CG. This includes all of the kinds listed above.
PrevLite: 6.1 Atoms, Strings, and Numbers
NextLite: 6.3 Variables
Prev: 6.1 Atoms, Strings, and Numbers
Up: 6 Prolog for CG users
Next: 6.3 Variables