add graphs into the query for inverse attributes