문제

I have the following resource: http://test.com/domainOnt/email#plans@plan.com

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 plans@plan.com

any help is appreciated

도움이 되었습니까?

해결책

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#plans@plan.com')
print resource.split('#')[-1]

This question and answer is quite similar to yours.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top