RDFLib: Remove namespace from a URIRef resource

user1894963

I have the following resource: http://test.com/domainOnt/email#[email protected]

As in RDFLib, when you search for this in a graph, it returns a URIRef object. I would like to remove the namespace from the object so that it becomes [email protected]

any help is appreciated

Ted Lawless

URIRef objects in RDFLib are unicode objects and have all of the unicode object methods, like split. The following will work if all of your class names are separated from the namespace with a '#'.

resource = URIRef('http://test.com/domainOnt/email#[email protected]')
print resource.split('#')[-1]

This question and answer is quite similar to yours.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related