%create the KB for a reduced version of the solar system -- sun, with earth,mars,saturn, nepture and their moons
% from a drawing

%%these are our 'facts'
%% single argument clause
star(the_sun).
planet(the_earth).
planet(saturn).
planet(neptune).
%% multi argument clause
orbits(the_earth, the_sun).
orbits(the_moon, the_earth).
orbits(mars, the_sun).
orbits(saturn, the_sun).
orbits(neptune,the_sun).
orbits(titan, saturn).
orbits(nereid, neptune).

%these are some relationships ('rules') using those facts
%Q: write an isMoon(M) predicate (note that the sun doesn't have any moons)
isMoon(M) :- orbits(M,P),planet(P).


% Q. now, let's define a satellite relationship (the moon is a satellite
% of the sun as well as of the earth).
satellite( X, Y) :- orbits(X, Y).
satellite( X, Y) :- orbits(X, Z), satellite(Z, Y).

% Q: now, let's define a relationship "star_of" to find the star of a planet (presumably because we can add other
% solar systems)
star_of(S,Body) :- satellite(Body,S),star(S).
