function to find concise bounded graph for SPARQL Updates for dealing with blank nodes

Hi all,

  this is probably a known issue SPARQL land, and I wonder if anyone has
yet written a function to try to update a graph with a blank node.

I have written up the issue here https://github.com/stample/react-foaf/issues/7

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.

    

Social Web Architect
http://bblfish.net/

Received on Friday, 24 January 2014 11:30:46 UTC