Online communities provide a useful environment for web users to communicate and interact with other users by sharing their thoughts, ideas and opinions, and for resolving problems and issues. Companies and organisations now host online communities in order to support their products and services. Given this investment such communities are required to remain healthy and flourish. The behaviour that users exhibit within online communities is associated with their actions and interactions with other community users while the role that a user assumes is the label associated with a given type of behaviour. The domination of one type of behaviour within an online community can impact upon its health, for example, it might be the case within a question-answering community that there is a large portion of expert users and very few users asking questions, thereby reducing the involvement of and the need for experts. Understanding how the role composition - i.e. the distribution of users assuming different roles - of a community affects its health informs community managers with the early indicators of possible reductions or increases in community activity and how the community is expected to change. In this paper we present an approach to analyse communities based on their role compositions. We present a behaviour ontology that captures user behaviour within a given context (i.e. time period and community) and a semantic-rule based methodology to infer the role that a user has within a community based on his/her exhibited behaviour. We describe a method to tune roles for a given community-platform through the use of statistical clustering and discretisation of continuous feature values. We demonstrate the utility of our approach through role composition analyses of the SAP Community Network by: a) gauging the differences between communities, b) predicting community activity increase/decrease, and c) performing regression analysis of the post count within each community. Our findings indicate that communities on the SAP Community Network differ in terms of their average role percentages and experts, while being similar to one another in terms of the dominant role in each community - being a novice user. The findings also indicate that an increase in expert users who ask questions and initiate discussions was associated with increased community activity and that for 23 of the 25 communities analysed we were able to accurately detect a decrease in community activity using the community’s role composition.