Skip to content

Globally replace IRI with a new value #4480

Answered by abrokenjester
reckart asked this question in Q&A
Discussion options

You must be logged in to vote

Alternatively, directly using the API:

conn.begin();
conn.getStatements(oldIRI, null, null).forEach(st -> { conn.remove(st); conn.add(newIRI, st.getPredicate(), st.getObject()); });
conn.getStatements(null, oldIRI, null).forEach(st -> { conn.remove(st); conn.add(st.getSubject(), newIRI, st.getObject()); });
conn.getStatements(null, null, oldIRI).forEach(st -> { conn.remove(st); conn.add(st.getSubject(), st.getPredicate(), newIRI); });
conn.commit();

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@hmottestad
Comment options

@abrokenjester
Comment options

Comment options

You must be logged in to vote
1 reply
@reckart
Comment options

Answer selected by reckart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants