Conditional expectation conditionally on the sigma-algebra on $[0,1]$ generated by the Borel subsets of $[0,1/2]$ 
Let $\Omega = [0,1]$ with Lebesgue measure and let $X(\omega)= \omega$. Find $\mathbb{E} \left(X|\mathcal{G}\right)$ if (a) $\mathcal{G} = \left\{ [0,1/2], (1/2, 1], [0,1], \emptyset \right\} $ and (b) $\mathcal{G}$ is generated by the family of sets $\left\{ B \subset[0,1/2], \text{Borel} \right\}$.

The first part is easy as there is only a finite number of atoms so that the conditional expectation is $\mathbb{E} (X| \mathcal{G}) = 1/4$ if $\omega \in [0,1/2]$ and $\mathbb{E} (X| \mathcal{G}) = 3/4$ for $\omega \in (1/2,1]$. I am having trouble, however, with the second part as I cannot visualize this sigma field. Could you please give me some hints? 

Hint:
You are looking for a $\mathcal G$-measurable function $f:[0,1]\to\mathbb R$ with: $$\int_Axdx=\int_Af(x)dx\text{ for every }A\in\mathcal G$$ 
Note that in b) a function is $\mathcal G$-measurable iff it is Borel measurable and is constant on $(\frac12,1]$. 
How about $f$ prescribed by $x\mapsto x$ if $x\leq\frac12$ and $x\mapsto c$ otherwise, where $c$ denotes some (yet to be found) constant?
