private void runGibbsSampling() {
		for (int i = 0; i < param.nIterations; ++i) {
			for (int d = 0; d < param.D; ++d) {
				int N = docs[d].length;
				for (int n = 0; n < N; ++n) {
					// Sample from p(z_i|z_-i, w)
					sampleTopicAssignment(d, n);
				}
			}

			if (i >= param.nBurnin) {
				if (i == param.nBurnin
						|| i % param.knowledgeUpdatelag == 0) {
					// Extract the knowledge and update the urn matrix.
					// Compute the instance values of distributions.
					computeTopicWordDistribution(-1);
					ArrayList<PriorityQueue<Integer>> topWordIDList = getTopWordsUnderEachTopic(phi);

					topicToMustlinksMap = getKnowledgeFromTopicModelResults(
							topWordIDList,
							topicModelListForKnowledgeExtraction, phi,
							corpus.vocab);
					// The counting matrixes will be updated in this function.
					updateUrnMatrix(topicToMustlinksMap);
				}
			}

			if (i >= param.nBurnin && param.sampleLag > 0
					&& i % param.sampleLag == 0) {
				updatePosteriorDistribution();
			}
		}
	}