As one of the most iconic and recognisable structures in the world, the Eiffel Tower has been the inspiration for the creation of over 50 similar towers around the world. Most are not exact replicas, though there are many like it.

Eifeltower in Texas

Given a database of Eiffel Tower replicas, containing following facts of the form replica_size(Name, Size), replica_country(Name, Country) and replica_place(Name, (X,Y)) giving the values the variable names suggest. Size is given as a term of the form 1:Scale.

Make use of built-in predicates like setof/3, bagof/3, maplist, sort/4.

?- replicas_in("China",List).
List = ["Eiffel Tower of Tiandu City Community (also called Tianducheng)", "Eiffel Tower of Window of the World", "Long Ta"].

?- top_replicaters(List).
List = [("USA", 9),  ("Russia", 4),  ("China", 3),  (..., ...)|...].

?- map_replicas_countries(["Las Vegas Eiffel Tower", "Krasnoyarsk Eiffel Tower"], Countries).
Countries = ["USA", "Russia"].

To test your code, you can use this database1