The compositionality of the semantics of logic programs with respect to (different varieties of) program union has been studied recently by a number of researchers. The approaches used can be considered quite ad hoc in the sense that they provide, from scratch, the semantic constructions needed to ensure compositionality and, in some cases, full abstraction in the given framework. In this paper, we study the application of general algebraic methods for obtaining, systematically, this kind of results. In particular, the method proposed consists in studying the adequate institution for describing the given class of logic programs and, then, in using general institution-independent results to prove compositionality and full abstraction. This is done in detail for the class of definite logic programs with respect to three kinds of composition operations: Ω-union, standard union and module composition. In addition two different institutions are considered: the standard institution of Horn clause logic and a new institution that better captures the input/output operational behaviour of logic programs. Finally, a similar solution is sketched for other classes of logic programs.