Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

function to find concise bounded graph for SPARQL Updates #7

Open
bblfish opened this issue Jan 24, 2014 · 2 comments
Open

function to find concise bounded graph for SPARQL Updates #7

bblfish opened this issue Jan 24, 2014 · 2 comments

Comments

@bblfish
Copy link
Member

bblfish commented Jan 24, 2014

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.

@bblfish
Copy link
Member Author

bblfish commented Jan 24, 2014

this requires a function of the type

def calculateUpdate[Rdf<:RDF](pg: PiNG, rel: Rdf#URI, oldValue: Rdf#Node, newValue: Rdf#Node): Sparql#Query 

@bblfish
Copy link
Member Author

bblfish commented Jan 24, 2014

workaround: Use Conditional PUT

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant