Why generate URIs at all in the beginning, can't you use blank nodes? Rewriting URIs is generally a bad idea in a Linked Data setting. Make one datasource canonical and let the other one deal with that. Or maybe you can configure your proxy in a way that hides the port number and you don't need the second version (just a guess).
Also, you generate document URIs, and persons are not documents. Hash URIs would probably be best for persons. If you choose to ignore the above, this method might help you: https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/util/ResourceUtils.html#renameResource-org.apache.jena.rdf.model.Resource-java.lang.String- On Tue, May 22, 2018 at 1:00 PM, Claude Warren <[email protected]> wrote: > I have what I think may be a common problem and am looking for suggested > patterns and anti-patterns for a solution. > > For the sake of this example let's assume that the system described creates > FOAF records. > > == PROBLEM > > Backend: > > The backend system generates FOAF records but does not have any information > about where they will be stored/deployed. So it generates records like > > <urn:mysystem:foaf1> a foaf:Person ; > foaf:name "Jimmy Wales" ; > foaf:mbox <mailto:[email protected]> ; > foaf:homepage <http://www.jimmywales.com> ; > foaf:nick "Jimbo" ; > foaf:depiction <http://www.jimmywales.com/aus_img_small.jpg> ; > foaf:interest <http://www.wikimedia.org> ; > foaf:knows <urn:mysystem:foaf2> . > > <urn:mysystem:foaf2> a foaf:Person ; > foaf:name "Angela Beesley" . > > > This data is stored in a Fuseki based server. > > Frontend 1: > > The front end should take replace the <urn:mysystem> based URIs with http > based URIs that point to the frontend. So assuming the frontend is at > http://frontend:8080 and has a method to return RDF in turtle format the > RDF should look like > > <http://frontend:8080/foaf1> a foaf:Person ; > foaf:name "Jimmy Wales" ; > foaf:mbox <mailto:[email protected]> ; > foaf:homepage <http://www.jimmywales.com> ; > foaf:nick "Jimbo" ; > foaf:depiction <http://www.jimmywales.com/aus_img_small.jpg> ; > foaf:interest <http://www.wikimedia.org> ; > foaf:knows <http://frontend:8080/foaf2> . > > <http://frontend:8080/foaf2> a foaf:Person ; > foaf:name "Angela Beesley" . > > Frontend 2: > > There is a second frontend with a different URL. http://frontend2:8080, > frontend 1 and frontend 2. Frontend 2 does not have access to frontend 1 > (assume that there is a firewall that prohibits the access). Frontend2 > should produce RDF like: > > <http://frontend2:8080/foaf1> a foaf:Person ; > foaf:name "Jimmy Wales" ; > foaf:mbox <mailto:[email protected]> ; > foaf:homepage <http://www.jimmywales.com> ; > foaf:nick "Jimbo" ; > foaf:depiction <http://www.jimmywales.com/aus_img_small.jpg> ; > foaf:interest <http://www.wikimedia.org> ; > foaf:knows <http://frontend2:8080/foaf2> . > > <http://frontend2:8080/foaf2> a foaf:Person ; > foaf:name "Angela Beesley" . > > == Question > > How can I setup a system that will automatically convert one URI to another > without storing multiple copies of the data (e.g. not multiple datasets). > I have thought about using owl:sameAs and am wondering if there is a > reasoner that will process it. > > Anyway, has anyone else come across this problem (I figure so) and does > anyone have a possible solution? > > > > > Thx, > Claude > -- > I like: Like Like - The likeliest place on the web > <http://like-like.xenei.com> > LinkedIn: http://www.linkedin.com/in/claudewarren >
