Final answer:
Old Saint Peter's Basilica served as a precedent for the architectural design of Hagia Sophia, providing a model for its basilica layout with a transept addition, thereby taking on a cruciform shape.
Step-by-step explanation:
The building that served as a precedent for the Hagia Sophia in terms of style and construction was Old Saint Peter's Basilica. This basilica model was adopted in the construction of Old St. Peter's church in Rome, which used to stand in the place where the new St. Peter's Basilica is currently located after the old one was taken down in 1506. The Hagia Sophia took inspiration from this earlier Christian church, adhering to the traditional basilica layout which was rectangular and often included a transept, thereby giving the church a cruciform shape. The groundbreaking design of Old St. Peter's, aligned with the Roman tradition of basilicas serving civic and juridical purposes, including those structurally designed like the Basilica Ulpia, provided historical guidance in constructing the Hagia Sophia.
The Old St. Peter's Basilica incorporated the Roman basilica architectural features like an aisle leading to an apse, as well as a transept to make the building cruciform, similar to the plan used for the Hagia Sophia. The latter was envisioned to be the biggest and grandest by Emperor Justinian and integrated architectural elements and materials from various ancient cities. For the construction of the Hagia Sophia, special materials were appropriated, such as Hellenistic columns and diverse marble stones, indicating a shared heritage of monumental basilica-type structures.