Could you provide a better example? From what you have, this is what I suggest:
onto = get_ontology('file://path to owl file').load()
with onto:
ruleName=Imp()
ruleName.set_as_rule("add your swrl atoms")
onto.save(file="path to owl file")
Also, why not just create the relationship when you are populating the Abox of the ontology. What is relation(link)?
Thank you Iwilliams for your response. My question was : I would like that someone helps me to write the rule that enables me to link two individuals named world and worldCases by an object property named cases !
I want to obtain this relation : word cases worldCases
But I got this error : [Line: 1, Column: 1]: built-in exception thrown by built-in swrlb:endsWith in rule S1: exception thrown by built-in swrlb:endsWith in rule S1: expecting literal, got individual