# Looking for step by step example of sampling from DAG in Bayesian model

I am looking for a tutorial type example that shows the step by step process sampling from a simple hierarchical model.

For example, I am trying to study the distribution of p in a Bernoulli experiment where I have a set of 10 data / observations (h[i]).

model {
p ~ dunif( 0, 1 )
for( i in 1 : 10)  {
h[i] ~ dbern( p )
}
}


I am not clear as to how the WinBUGS (or similar samplers) would generate the correct samples for p values given my h1-10.

Is there a paper or article that explain this?