SELECT
	x1.id AS id,
	MIN(x2.value) AS type,
	MIN(x1.description) AS description,
	GROUP_CONCAT(DISTINCT x4.value) AS tags,
	GROUP_CONCAT(x7.value || ':' || x6.value) AS expressions
FROM
	concepts AS x1
	LEFT OUTER JOIN types AS x2 ON (x1.type_id = x2.id)
	LEFT OUTER JOIN concept_tags AS x3 ON (x1.id = x3.concept_id)
	LEFT OUTER JOIN tags AS x4 ON (x3.tag_id = x4.id)
	LEFT OUTER JOIN concept_expressions AS x5 ON (x1.id = x5.concept_id)
	LEFT OUTER JOIN expressions AS x6 ON (x5.expression_id = x6.id)
	LEFT OUTER JOIN languages AS x7 ON (x5.language_id = x7.id)
WHERE
	(
		(:part IS NULL)
		OR
		(x5.value LIKE :part)
	)
GROUP BY
	x1.id
;

