### Question:
SparqlUpdateHelper { public static String createSparqlReplace(String subjUri, Property property, Object object) { return createSparqlReplace(subjUri, property, object, null); } private  SparqlUpdateHelper(); static String createSparqlInsert(Model model); static String createSparqlInsert(String subjUri, Property property,
            Object object); static String createSparqlReplace(String subjUri, Property property, Object object); static String createSparqlReplace(String subjUri, Property property,
            Object object, List<Object> previousValues); static String createSparqlDelete(String subjUri, Property property, Object object); static String getObjectAsString(Object object);  }### Answer:
@Test public void createSparqlReplaceTest() { String expectedTitle = "Title"; Model model = ModelFactory.createDefaultModel(); Resource resc = model.getResource(RESC_URI); resc.addProperty(DC.title, "1"); resc.addProperty(DC.title, "2"); List<Object> previousTitles = new ArrayList<>(); previousTitles.add("1"); previousTitles.add("2"); String sparql = SparqlUpdateHelper.createSparqlReplace(RESC_URI, DC.title, expectedTitle, previousTitles); UpdateRequest request = UpdateFactory.create(sparql); UpdateAction.execute(request, model); StmtIterator stmtIt = resc.listProperties(DC.title); assertEquals(expectedTitle, stmtIt.next().getString()); assertFalse(stmtIt.hasNext()); }
@Test public void createSparqlReplaceAddOnlyTest() { String expectedTitle = "Title"; String sparql = SparqlUpdateHelper.createSparqlReplace(RESC_URI, DC.title, expectedTitle); Model model = ModelFactory.createDefaultModel(); Resource resc = model.getResource(RESC_URI); resc.addProperty(DC.contributor, "contrib"); UpdateRequest request = UpdateFactory.create(sparql); UpdateAction.execute(request, model); StmtIterator stmtIt = resc.listProperties(DC.title); assertEquals(expectedTitle, stmtIt.next().getString()); assertFalse(stmtIt.hasNext()); }