Science
Copyright © 2024 Jiri Kriz, www.nosco.ch

9    An Information System

Solutions

Implement an information system with hyperlinks and history of visited objects (similar to Wikipedia). Test this system on the following knowledge area from physics:

Atom
is the smallest constituent unit of ordinary matter that has the properties of a chemical element. Every atom is composed of a nucleus and one or more electrons bound to the nucleus.
See also: [atomic nucleus, electron, nuclear power]
Atomic nucleus
is the very dense region consisting of protons and neutrons at the center of an atom. Protons are positively charged while neutrons have no electrical charge. Atoms that differ only in the number of neutrons are called isotopes.
See also: [proton, neutron, atom]
Electron
is a stable, negatively charged elementary particle ...
See also: [atom]
Proton
is a stable, positively charged elementary particle ...
See also: [atomic nucleus]
Neutron
is a stable elementary particle without electrical charge ...
See also: [atomic nucleus]
Nuclear power
is the use of nuclear reactors to release nuclear energy, and thereby generate electricity. Nuclear binding energy is the energy that would be required to disassemble the nucleus of an atom into its component parts.

The information system consists of terms (objects) that can be searched for. Explaining texts and references to other objects are attached to the objects. A possible representation would be:

object( 
ID, /* unique identifier, a nummer */
Name, /* display name */
Text, /* list of text lines */
References). /* List of references to other objects */

Example:

object( 1, 'Atom',	   
['is the smallest constituent unit of ordinary matter ', 
'that has the properties of a chemical element. ',
'Every atom is composed of a nucleus and '
'one or more electrons bound to the nucleus.'], 
[2, 3, 4] ).

The user always gets an object with the explaining text and the references to other objects, e.g.:

Atom (ID=1)
is the smallest constituent unit of ordinary matter that has the properties of a chemical element.
Every atom is composed of a nucleus and one or more electrons bound to the nucleus. 

See also: 
2 - atomic nucleus
3 - electron
6 - nuclear power

The user can use the following commands:

init Initialize the history of visited objects to []. The history [3, 2, 1] means that the object 1 was visited first and the object 3 was visited last.
show_all Show all objects with their identifiers.
show(ID) Show the object with the identifier ID. Suppose the current history is [3, 2, 1]. If the system shows currently 3, then the new history becomes [ID, 3, 2, 1]. If the system shows currently 1, then the new history becomes [ID, 1].
trace Show the history of the displayed objects.
back Move forward in the history and show the corresponding object. The history list is not changed.
fwd Move forward in the history and show the corresponding object. The history list is not changed.

Solution 9