When a PATCH request using SPARQL Update contains a subject with a blank node, then INSERT DATA and DELETE DATA cannot work ( unless the relation is an owl:InverseFunctionalProperty ). In that case one must calculate the Concise Bounded Description of the graph and put that in the WHERE clause. So one needs to calculate this CBD.
( not checked exactly if CBD is the right relation )
for example in FOAF foaf:mbox is an owl:inverseFunctionalProperty. In that case
the server could in fact delete all the correct blank nodes for the following request
DELETE DATA { [] foaf:mbox <mailto:henry.story@bblfish.net> . }
But for an graph such as
<#me> contact:home [ a contact:ContactLocation;
contact:address [ contact:city "Fontainebleau";
contact:country "France";
contact:postalCode "77300";
contact:street "21 rue Saint Honore"
];
];
contact:work [ a contact:ContactLocation;
contact:address [ contact:city "Fontainebleau";
contact:country "France";
contact:postalCode "77300";
contact:street "21 rue Saint Merry"
];
];
contact:work [ a contact:ContactLocation;
contact:address [ contact:city "Fontainebleau";
contact:country "France";
contact:postalCode "77300";
contact:street "23 rue Saint Merry"
];
] .
The replacing the postalCode cannot be done like this
DELETE DATA { [] contact:postalCode "77300" }
INSERT DATA { [] contact:postalCode "77305" }
because the server would not know
- which triple in the above graph to remove. ( the one for the home address or the one for the work address ? )
- where to put the new triple ( does it even get attached to an address? )
So really one needs a query such as the following:
DELETE { ?add contact:postalCode "77300" }
INSERT { ?add contact:postalCode "77300" }
WHERE {
?add contact:city "Fontainebleau";
contact:country "France";
contact:postalCode "77300";
contact:street "21 rue Saint Merry"
}
But this works only because we are here assuming that contact:city, contact:country, contact:postalCode and contact:street form an owl:key .
If these four relations did not form an owl:key then one would have to at leat try to add as many relations to the WHERE clause to make the update identify one object in that particular graph.
When a PATCH request using SPARQL Update contains a subject with a blank node, then INSERT DATA and DELETE DATA cannot work ( unless the relation is an owl:InverseFunctionalProperty ). In that case one must calculate the Concise Bounded Description of the graph and put that in the WHERE clause. So one needs to calculate this CBD.
( not checked exactly if CBD is the right relation )
for example in FOAF foaf:mbox is an owl:inverseFunctionalProperty. In that case
the server could in fact delete all the correct blank nodes for the following request
But for an graph such as
The replacing the postalCode cannot be done like this
because the server would not know
So really one needs a query such as the following:
But this works only because we are here assuming that contact:city, contact:country, contact:postalCode and contact:street form an owl:key .
If these four relations did not form an owl:key then one would have to at leat try to add as many relations to the WHERE clause to make the update identify one object in that particular graph.