fn qualify(document: &str, reference: &str) -> String
Rewrites a ref into the document#def form a $type would be written in.
document#def
$type