Update a resource with Sparql-Update and build an HTTP response
@param res the resource
@return the Response builder
554674
public ResponseBuilder updateResource(final Resource res) {
        final String baseUrl = getBaseUrl();
        final String identifier = baseUrl + req.getPartition() + req.getPath() +
            (ACL.equals(req.getExt()) ? "?ext=acl" : "");

        if (isNull(sparqlUpdate)) {
            throw new WebApplicationException("Missing Sparql-Update body", BAD_REQUEST);
        }
        final Session session = ofNullable(req.getSession()).orElseGet(HttpSession::new);

        // Check if this is already deleted
        checkDeleted(res, identifier);

        // Check the cache
        final EntityTag etag = new EntityTag(md5Hex(res.getModified() + identifier));
        checkCache(req.getRequest(), res.getModified(), etag);

        LOGGER.debug("Updating {} via PATCH", identifier);

        final IRI graphName = ACL.equals(req.getExt()) ? PreferAccessControl : PreferUserManaged;
        final IRI otherGraph = ACL.equals(req.getExt()) ? PreferUserManaged : PreferAccessControl;

        // Put triples in buffer
        final List<Triple> triples = updateGraph(res, graphName);

        try (final TrellisDataset dataset = TrellisDataset.createDataset()) {

            triples.stream().map(skolemizeTriples(resourceService, baseUrl))
                .map(t -> rdf.createQuad(graphName, t.getSubject(), t.getPredicate(), t.getObject()))
                .forEachOrdered(dataset::add);

            // Add audit-related triples
            audit.ifPresent(svc -> svc.update(res.getIdentifier(), session).stream()
                    .map(skolemizeQuads(resourceService, baseUrl)).forEachOrdered(dataset::add));

            // Add existing LDP type
            dataset.add(rdf.createQuad(PreferServerManaged, res.getIdentifier(), RDF.type, res.getInteractionModel()));

            // Check any constraints
            final List<ConstraintViolation> violations = constraintServices.stream()
                .flatMap(svc -> dataset.getGraph(graphName).map(Stream::of).orElseGet(Stream::empty)
                    .flatMap(g -> svc.constrainedBy(res.getInteractionModel(), baseUrl, g)))
                .collect(toList());

            if (!violations.isEmpty()) {
                final ResponseBuilder err = status(CONFLICT);
                violations.forEach(v -> err.link(v.getConstraint().getIRIString(), LDP.constrainedBy.getIRIString()));
                throw new WebApplicationException(err.build());
            }

            // When updating User or ACL triples, be sure to add the other category to the dataset
            try (final Stream<? extends Triple> remaining = res.stream(otherGraph)) {
                remaining.map(t -> rdf.createQuad(otherGraph, t.getSubject(), t.getPredicate(), t.getObject()))
                    .forEachOrdered(dataset::add);
            }

            // Save new dataset
            if (resourceService.put(res.getIdentifier(), dataset.asDataset())) {

                final ResponseBuilder builder = ok();

                ldpResourceTypes(res.getInteractionModel()).map(IRI::getIRIString)
                    .forEach(type -> builder.link(type, "type"));

                return ofNullable(req.getPrefer()).flatMap(Prefer::getPreference).filter(PREFER_REPRESENTATION::equals)
                    .map(prefer -> {
                        final RDFSyntax syntax = getSyntax(req.getHeaders().getAcceptableMediaTypes(), empty())
                            .orElseThrow(NotAcceptableException::new);
                        final IRI profile = ofNullable(getProfile(req.getHeaders().getAcceptableMediaTypes(), syntax))
                            .orElseGet(() -> getDefaultProfile(syntax, identifier));

                        final StreamingOutput stream = new StreamingOutput() {
                            @Override
                            public void write(final OutputStream out) throws IOException {
                                ioService.write(triples.stream().map(unskolemizeTriples(resourceService, baseUrl)),
                                        out, syntax, profile);
                            }
                        };

                        return builder.header(PREFERENCE_APPLIED, "return=representation").type(syntax.mediaType)
                               .entity(stream);
                    }).orElseGet(() -> builder.status(NO_CONTENT));
            }
        }

        LOGGER.error("Unable to persist data to location at {}", res.getIdentifier());
        return serverError().type(TEXT_PLAIN)
            .entity("Unable to persist data. Please consult the logs for more information");
    }
94876
public ResponseBuilder initialize(final Resource parent, final Resource resource) {

        if (MISSING_RESOURCE.equals(resource)) {
            // Can't patch non-existent resources
            throw new NotFoundException();
        } else if (DELETED_RESOURCE.equals(resource)) {
            // Can't patch non-existent resources
            throw new ClientErrorException(GONE);
        } else if (updateBody == null) {
            LOGGER.error("Missing body for update: {}", resource.getIdentifier());
            throw new BadRequestException("Missing body for update");
        } else if (!supportsInteractionModel(LDP.RDFSource)) {
            throw new BadRequestException(status(BAD_REQUEST)
                .link(UnsupportedInteractionModel.getIRIString(), LDP.constrainedBy.getIRIString())
                .entity("Unsupported interaction model provided").type(TEXT_PLAIN_TYPE).build());
        } else if (syntax == null) {
            // Get the incoming syntax and check that the underlying I/O service supports it
            LOGGER.warn("Content-Type: {} not supported", getRequest().getContentType());
            throw new NotSupportedException();
        }
        // Check the cache headers
        final EntityTag etag = new EntityTag(buildEtagHash(getIdentifier(), resource.getModified(),
                    getRequest().getPrefer()));
        checkCache(resource.getModified(), etag);

        setResource(resource);
        resource.getContainer().ifPresent(p -> setParent(parent));
        return ok();
    }
647488
public static base_response update(nitro_service client, rnatparam resource) throws Exception {
		rnatparam updateresource = new rnatparam();
		updateresource.tcpproxy = resource.tcpproxy;
		return updateresource.update_resource(client);
	}
1070369
public static base_responses update(nitro_service client, tmtrafficaction resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			tmtrafficaction updateresources[] = new tmtrafficaction[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new tmtrafficaction();
				updateresources[i].name = resources[i].name;
				updateresources[i].apptimeout = resources[i].apptimeout;
				updateresources[i].sso = resources[i].sso;
				updateresources[i].formssoaction = resources[i].formssoaction;
				updateresources[i].persistentcookie = resources[i].persistentcookie;
				updateresources[i].initiatelogout = resources[i].initiatelogout;
				updateresources[i].kcdaccount = resources[i].kcdaccount;
				updateresources[i].samlssoprofile = resources[i].samlssoprofile;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
1205675
public static base_responses update(nitro_service client, snmpalarm resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			snmpalarm updateresources[] = new snmpalarm[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new snmpalarm();
				updateresources[i].trapname = resources[i].trapname;
				updateresources[i].thresholdvalue = resources[i].thresholdvalue;
				updateresources[i].normalvalue = resources[i].normalvalue;
				updateresources[i].time = resources[i].time;
				updateresources[i].state = resources[i].state;
				updateresources[i].severity = resources[i].severity;
				updateresources[i].logging = resources[i].logging;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
979090
public static base_responses update(nitro_service client, Interface resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			Interface updateresources[] = new Interface[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new Interface();
				updateresources[i].id = resources[i].id;
				updateresources[i].speed = resources[i].speed;
				updateresources[i].duplex = resources[i].duplex;
				updateresources[i].flowctl = resources[i].flowctl;
				updateresources[i].autoneg = resources[i].autoneg;
				updateresources[i].hamonitor = resources[i].hamonitor;
				updateresources[i].tagall = resources[i].tagall;
				updateresources[i].trunk = resources[i].trunk;
				updateresources[i].lacpmode = resources[i].lacpmode;
				updateresources[i].lacpkey = resources[i].lacpkey;
				updateresources[i].lagtype = resources[i].lagtype;
				updateresources[i].lacppriority = resources[i].lacppriority;
				updateresources[i].lacptimeout = resources[i].lacptimeout;
				updateresources[i].ifalias = resources[i].ifalias;
				updateresources[i].throughput = resources[i].throughput;
				updateresources[i].bandwidthhigh = resources[i].bandwidthhigh;
				updateresources[i].bandwidthnormal = resources[i].bandwidthnormal;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
202107
public static base_responses update(nitro_service client, filteraction resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			filteraction updateresources[] = new filteraction[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new filteraction();
				updateresources[i].name = resources[i].name;
				updateresources[i].servicename = resources[i].servicename;
				updateresources[i].value = resources[i].value;
				updateresources[i].respcode = resources[i].respcode;
				updateresources[i].page = resources[i].page;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
773121
@Override
	public Response process(Response.ResponseBuilder responseBuilder)
	{
		final String entity = process();

		responseBuilder.entity(entity);

		return responseBuilder.build();
	}
987441
public static base_responses update(nitro_service client, systemuser resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			systemuser updateresources[] = new systemuser[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new systemuser();
				updateresources[i].username = resources[i].username;
				updateresources[i].password = resources[i].password;
				updateresources[i].externalauth = resources[i].externalauth;
				updateresources[i].promptstring = resources[i].promptstring;
				updateresources[i].timeout = resources[i].timeout;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
14236
public static base_responses update(nitro_service client, dnssrvrec resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			dnssrvrec updateresources[] = new dnssrvrec[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new dnssrvrec();
				updateresources[i].domain = resources[i].domain;
				updateresources[i].target = resources[i].target;
				updateresources[i].priority = resources[i].priority;
				updateresources[i].weight = resources[i].weight;
				updateresources[i].port = resources[i].port;
				updateresources[i].ttl = resources[i].ttl;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
678540
public static base_responses update(nitro_service client, snmpuser resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			snmpuser updateresources[] = new snmpuser[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new snmpuser();
				updateresources[i].name = resources[i].name;
				updateresources[i].group = resources[i].group;
				updateresources[i].authtype = resources[i].authtype;
				updateresources[i].authpasswd = resources[i].authpasswd;
				updateresources[i].privtype = resources[i].privtype;
				updateresources[i].privpasswd = resources[i].privpasswd;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
312104
def _update(self, resource, update_dict=None, params=None, **kwargs):
        """"""
        url = self._client._build_url(resource, **kwargs)
        response = self._client._request('PUT', url, json=update_dict, params=params)

        if response.status_code != requests.codes.ok:  # pragma: no cover
            raise APIError("Could not update {} ({})".format(self.__class__.__name__, response.json().get('results')))
        else:
            self.refresh()
1223455
public static base_response update(nitro_service client, server resource) throws Exception {
		server updateresource = new server();
		updateresource.name = resource.name;
		updateresource.ipaddress = resource.ipaddress;
		updateresource.domainresolveretry = resource.domainresolveretry;
		updateresource.translationip = resource.translationip;
		updateresource.translationmask = resource.translationmask;
		updateresource.domainresolvenow = resource.domainresolvenow;
		updateresource.comment = resource.comment;
		return updateresource.update_resource(client);
	}
196069
public static base_responses update(nitro_service client, server resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			server updateresources[] = new server[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new server();
				updateresources[i].name = resources[i].name;
				updateresources[i].ipaddress = resources[i].ipaddress;
				updateresources[i].domainresolveretry = resources[i].domainresolveretry;
				updateresources[i].translationip = resources[i].translationip;
				updateresources[i].translationmask = resources[i].translationmask;
				updateresources[i].domainresolvenow = resources[i].domainresolvenow;
				updateresources[i].comment = resources[i].comment;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
1114581
public static base_responses update(nitro_service client, ntpserver resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			ntpserver updateresources[] = new ntpserver[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new ntpserver();
				updateresources[i].serverip = resources[i].serverip;
				updateresources[i].servername = resources[i].servername;
				updateresources[i].minpoll = resources[i].minpoll;
				updateresources[i].maxpoll = resources[i].maxpoll;
				updateresources[i].preferredntpserver = resources[i].preferredntpserver;
				updateresources[i].autokey = resources[i].autokey;
				updateresources[i].key = resources[i].key;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
449212
public static base_response update(nitro_service client, responderparam resource) throws Exception {
		responderparam updateresource = new responderparam();
		updateresource.undefaction = resource.undefaction;
		return updateresource.update_resource(client);
	}
451947
public static base_response update(nitro_service client, rnat6 resource) throws Exception {
		rnat6 updateresource = new rnat6();
		updateresource.name = resource.name;
		updateresource.redirectport = resource.redirectport;
		return updateresource.update_resource(client);
	}