Updating objects
An existing object can be updated by calling the update endpoint with the identifier.
The identifier also needs to be present in the payload
Update operation and implications
The update operation deletes all existing objects with identifier in the payload and then inserts the new data. As such, a partial description in the payload of an existing object in the knowledge graph would result in a full update of that object and only the partial information would be stored.
Updating data and links to other objects
Links to other exciting objects should be in the data represented as just identifiers without any additional description of the to-be-link object. Otherwise, we would again perform also an update on the linked object.
Example calls
Updating an object with external identifier
If we want to update an object with an external identifier, then we need again to call the API with the localname and namespace.
Here is the call to update our localbusiness example.
curl --location --request PUT 'https://proxy.opendatagermany.io/api/ts/v1/kg/things/imports/things/LB1?ns=http://example.com/entity/' \
--header 'X-PUBLISHER: $PUBLISHER_UUID' \
--header 'X-DATASOURCE: $DATASOURCE_UUID' \
--header 'Content-Type: application/ld+json' \
--header 'x-api-key: $API_KEY' \
--data-raw '{
"@id": "http://example.com/entity/LB1",
"@type": "https://schema.org/LocalBusiness",
"https://schema.org/address": {
"@type": "https://schema.org/PostalAddress",
"https://schema.org/addressCountry": "DE",
"https://schema.org/addressLocality": "city",
"https://schema.org/postalCode": "1234",
"https://schema.org/streetAddress": "example street"
},
"https://schema.org/description": "A simple description about the local business",
"https://schema.org/name": "LocalBusinessTest with updates",
"https://vocab.sti2.at/ds/compliesWith": {
"@id": "https://semantify.it/ds/uGBhB9lBI"
}
}'
We receive again an import report id, with which we can check the status and success of the update operation.
Updated 6 months ago