Ontology is a formal representation of knowledge as a set of concepts within a domain, and the relationships between those concepts. Those concepts and relationships create graph-structures and can be described by the lattice theory or other mathematical models.
The ontology describes a domain of knowledge by concepts. All the relationships among concepts are represented in the ontology like concepts too. In general, we talk about the Cartesian multiplication of sets where our concepts can be like objects and subjects. As result, we can represent knowledge on the ontology by 5 level of definitions, namely: abstract, semantic, structural, conceptual and data levels.