Add a method to convert qname back to URI · Issue #1868 · RDFLib/rdflib (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@dany-nonstop

Description

@dany-nonstop

rdflib.Graph already has a very helpful method qname() which basically converts http://example.com/ns#object to ns:obj if the namespace prefix ns has already been bound by bind('ns', Namespace('http://example.com/ns')).

I sometimes need use the reverse of qname() to make the URI input more human-friendly. It would be great if we have something like resolve_qname() which would translate a qname ns:obj back to http://example.com/ns#object. A neat solution is already provided here by somebody on stackoverflow.

https://stackoverflow.com/questions/63088670/rdflib-python-how-to-get-a-uriref-from-a-string-such-as-nsxxx