Type-safe Programming for the Semantic Web