Meaning of localization map in the structure sheaf of an affine scheme I'm reading the book $\textit{The Geometry of Schemes}$ and am a bit confused about the definition of the structure sheaf of an affine scheme. 
For a ring $R$, we define the $\textit{distinguished open sets}$ of $X=\text{Spec}R$ to be the sets 
$$X_f= \text{Spec}R-V(f)=\{p \in \text{Spec}R : f \not\in p \}.$$
To define a sheaf $\mathcal{O}$ on $X$, we assign to each $X_f$ the ring $R_f$, i.e. the localization of $R$ at the element $f$. 
Now the book says that if $X_g \subseteq X_f$, we have $g^n \in (f)$, for some integer $n$. Why is that?
Also, for the morphisms, the book says to define 
$$\text{res}_{X_f, X_g}: R_f \to R_{gf}=R_g$$
as the localization map. What does this mean? I'm mostly confused about the terminology here (what is the localization map?). 
 A: If $X_g \subset X_f$ then $V(f) \subset V(g)$. So, every prime ideal that contains $f$ also contains $g$, hence $g \in \sqrt{(f)}$. It means there exist some $n$ such that $g^n \in (f)$. 
(Edit: leibnewtz has pointed out a typo in the definition of the map)
Let's say $g^n = fh$, for some $h \in R$. The restriction map is just the map $R_f \to R_g$ that sends $\frac{a}{f^k} \in R_f$ to $\frac{ah^k}{g^{nk}} \in R_g$.
It's quite straightforward to check that this map is in fact well defined and satisfies the composition requirement. 
A: For your first question: $X_g\subseteq X_f$ means every prime ideal containing $f$ contains $g$. However, the intersection of the prime ideal containing $f$ is the radical of the ideal generated by $f$. In particular, $g$ is in this radical. So by definition of radical, $g^n\in (f)$ for some $n$.
For your second question: The term localisation map refers to the localisation map of the structural sheaf $\mathcal{O}$. The sheaf is a contravariant functor from open subsets of $X$, so for any open subsets $U_1\subseteq U_2\subseteq X$, there should be a map from $\mathcal{O}(U_2)$ to $\mathcal{O}(U_1)$.
