### Question:
SPARQLQueryBuilder { public String getUpdateWorkQueryString(Model work) { return getCreateQueryString(work); } SPARQLQueryBuilder(); Query getGetResourceByIdQuery(String id); Query describeWorkAndLinkedResources(XURI xuri); Query describePersonAndLinkedResources(String personId); Query describeCorporationAndLinkedResources(String corporationId); String getUpdateWorkQueryString(Model work); String getReplaceSubjectQueryString(String newURI); String getCreateQueryString(Model work); Query getItemsFromModelQuery(String id); Query checkIfResourceExists(XURI xuri); Query checkIfStatementExists(Statement statement); String patch(List<Patch> patches, Resource subject); Query getImportedResourceById(String id, String type); Query getBibliofilPersonResource(String personId); Query getBibliofilPlaceResource(String id); Query describeWorksByCreator(XURI xuri); Query describeLinkedPublications(XURI xuri); Query selectAllUrisOfType(String type); String deleteBiblioReferences(String recordId); Query getPublicationByRecordId(String recordId); Query getPublicationAndWorkContributorURIByRecordId(String recordId); Query selectWorksByAgent(XURI agent); Query constructInformationForMARC(XURI publication); Query getRecordIdsByWork(XURI xuri); Query constructInversePublicationRelations(XURI workUri); Query getNumberOfRelationsForResource(XURI xuri); Query constructFromQueryAndProjection(EntityType entityType, Map<String, String> queryParameters, Collection<String> projection); Query describePublicationFromParsedCoreISBNQuery(String isbn); String patch(List<Patch> deleteModelAsPatches); Query describeEventAndLinkedResources(XURI eventUri); Query describeSerialAndLinkedResources(XURI serialUri); Query retriveResourceRelationships(XURI uri); String mergeNodes(XURI xuri, XURI replaceeURI); String deleteIncomingRelations(XURI xuri); Query getGetInverselyRelatedResourceByPredicate(String id, String predicate); Query relatedResourcesFor(XURI xuri); Query resourceTemplateQuery(String type, Map<String, String> queryParameters); String removeTemplateMatchTriples(); Query describeTranslationResources(); Query retrieveAuthorizedValuesFor(String type); static final String DEFAULT_GRAPH; static final String NEWLINE; static final boolean KEEP_BLANK_NODES; static final boolean SKIP_BLANK_NODES; static final String STARTSWITH_NINE_SEVEN_EIGHT; static final String VALID_ISBN_CHARS; }### Answer:
@Test public void update_work(){ Model m = ModelFactory.createDefaultModel(); Statement s = getTestStatement(); m.add(s); SPARQLQueryBuilder sqb = new SPARQLQueryBuilder(); String query = sqb.getUpdateWorkQueryString(m); String expected = "INSERT { GRAPH <https: + "<http: + "}\n}\n" + "WHERE { SELECT * { OPTIONAL { ?s ?p ?o . } } LIMIT 1 }\n"; assertEquals(expected,query); }