Hi Paul,

The general goal of RDF Patch is to be "assembler" for changes, or "N-Triples for changes" - and there is no pattern matching capability.

In your example you'd have to know the old value:

QD <http://rdf.ontology2.com/henson/aws/Server>
   <http://rdf.ontology2.com/henson/aws/instanceType> "r3.xlarge" .
QA <http://rdf.ontology2.com/henson/aws/Server>
   <http://rdf.ontology2.com/henson/aws/instanceType> "r3.2xlarge" .

(aside: I wonder if instead of the 3/4 rule for triples/quads, a marker for the default graph is better so the tuple is always QD and 4 terms.

QD _ <http://rdf.ontology2.com/henson/aws/Server>
   <http://rdf.ontology2.com/henson/aws/instanceType> "r3.xlarge" .

or have TD, TA

On 13/10/16 17:02, Paul Houle wrote:
There is another use case for an "RDF Patch" which applies to
hand-written models.  For instance I have a model which describes a job
that is run in AWS that looks like

@prefix : <http://rdf.ontology2.com/henson/aws/>
@prefix parameter: <http://rdf.ontology2.com/henson/aws/parameter/>

   :subnetId "subnet-e0ab0197";
   :baseImage "ami-ea602afd";
   :instanceType "r3.xlarge";
   :keyName "o2key";
   :keyFile "~/AMZN Keys/o2key.ppk" ;
   :securityGroupIds "sg-bca0b2d9" ;
   :todo "dbpedia-load" ;
   parameter:RDF_SOURCE "s3://abnes/dbpedia/2015-10-gz/" ;
   parameter:GRAPH_NAME "http://dbpedia.org/"; ;
   :imageCommand "/home/ubuntu/RDFeasy/bin/shred_evidence_and_halt";
   :iamProfile <arn:aws:iam::181667415011:instance-profile/Marcabian> ;
   :instanceName "Image Build Server";
   :qBase <https://sqs.us-east-1.amazonaws.com/181667415011/> .

one thing you might want to do is modify it so it uses a different
:baseImage or a different :instanceType and a natural way to do that is
to say

'remove :Server :instanceType ?x and insert :Server :instanceType

SPARQL Update can provide the "pattern matching" (or some subset like SparqlPatch [https://www.w3.org/2001/sw/wiki/SparqlPatch]):

DELETE { :Server :instanceType ?x }
INSERT { :Server :instanceType "r3.2xlarge" }
WHERE  { :Server :instanceType ?x }


DELETE WHERE { :Server :instanceType ?x }
INSERT DATA { :Server :instanceType "r3.2xlarge" }

That said, the one useful additional to RDF Patch which is "pattern matching" might be limited bulk delete.

QD <http://example/graph/> <http://example/subject> ANY ANY .

because listing all the triples to delete when they can be found from the data anyway is a big space saving.


but better than that if you have a schema that says ":instanceType is a
single valued property" you can write another graph like

   :instanceType "r3.2xlarge" .

and merge it with the first graph to get the desired effect.

More generally this fits into the theme that "the structure of
commonsense knowledge is that there are rules,  then exceptions to the
rules,  then exceptions to the exceptions of the rules,  etc."
For instance I extracted a geospatial database out of Freebase that was
about 10 million facts and I found I had to add and remove about 10
facts on the route to a 99% success rate at a geospatial recognition
task.  A disciplined approach to "agreeing to disagree" goes a long way
to solve the problem that specific applications require us to split
hairs in different ways.

Reply via email to