Closed parisni closed 9 years ago
i am writing this while on holiday but as i recall the returned object implements ResourceWrapper. if your interface extends that it makes it easy to call get GetResource().getUri(). if you dont implement ResourceWrapper you can cast your object to a ResourceWriter and then call getResource()
Claude On Sep 2, 2015 6:27 p.m., "Paris Nicolas" notifications@github.com wrote:
Hello Claude,
I wonder if it would be possible to get the pojo uri from an instance. Eg:
Model model = ModelFactory.createModel(); EntityManager entityManager = EntityManagerFactory.getEntityManager(); Resource r = model.createResource( "http://example.com/mylibrary/book1" ); Book book = EntityManager.read( r, Book.class ); System.out.println("my uri is : %s",String.format(book.getUri()); // prints http://example.com/mylibrary/book1
In my use case (I serialyse your pojos as json), the uri could be used as unique id (or the instance identifier).
Thanks for all,
— Reply to this email directly or view it on GitHub https://github.com/Claudenw/PA4RDF/issues/1.
Sorry for having disturbed holiday, and thanks for the tip !
Did that solve your problem? Were you able to use either solution?
Claude
On Fri, Sep 4, 2015 at 6:28 PM, Paris Nicolas notifications@github.com wrote:
Sorry for having disturbed holiday, and thanks for the tip !
— Reply to this email directly or view it on GitHub https://github.com/Claudenw/PA4RDF/issues/1#issuecomment-137799266.
I like: Like Like - The likeliest place on the web http://like-like.xenei.com LinkedIn: http://www.linkedin.com/in/claudewarren
Yes, it solved the problem in a clean way thanks again
Issue resolved with use of ResourceWrapper interface as described in comment stack.
Hello Claude,
I wonder if it would be possible to get the pojo uri from an instance. Eg:
In my use case (I serialyse your pojos as json), the uri could be used as unique id (or the instance identifier).
Thanks for all,