jenaapache-jena

apache jena rename resource doesn't check prefix


I'm trying to change the URI of a resource in a Model. I'm using ResourceUtils.renameResource it works, but when i save the model in a file, the new URI is extended (has the form <http://prefix.com/resource> instead of prefix:resource) even though there is a prefix in the model (@prefix prefix: <http://prefix.com/>). Is there a way to force Jena to use the prefix when replacing the URI of the resource or a method to update the model rewriting every URI using the short version with "prefix:" when possible?


Solution

  • It didn't work because there where symbols like "/" and "#" in the new URI after the prefix. Solved replacing that symbols with a dash "-".