edit uri of existing resource using jena

后端 未结 3 1375
[愿得一人]
[愿得一人] 2020-12-04 02:14

I try to modify the uri of an existing resource of a ontology model. I thought of creating a new model, new resource (including the new desired uri) and duplicating the cont

3条回答
  •  -上瘾入骨i
    2020-12-04 03:00

    As you've found resources are immutable. You can bring about the same effect using ResourceUtils.renameResource(resource, newName). This goes through your model removing statements mentioning the old resource and adding the equivalents with the new, which is as close as you're going to get to a rename.

    Example:

    Resource renamed = 
      ResourceUtils.renameResource(originalResource, "http://example.com/new");
    

提交回复
热议问题