Hi Michael,

sh:update is by default not doing anything in SHACL. It is a property that can be used by extensions. One such extension is the DASH suggestions framework supported by TopBraid:

    http://datashapes.org/suggestions.html

Please take a look and let me know if this would help. It is currently limited to constraint components, i.e. it is not yet possible to define suggestions that would be for a specific constraint instance only.

Holger


On 21/02/2017 5:12, Michael Johnson wrote:
I am attempting to insert a triple when a particular SHACL violation occurs. It seems as if I would use the sh:update, but I can't seem to get it right. I have a Person class that has a property Comment. I can easily update the Person by
INSERT {
?s ex:Comment "inserted Comments" .
}
WHERE {
?s rdf:type ex:Person .

I have tried to add the sh:update as a property constraint:

ex:Person
  rdf:type rdfs:Class ;
  rdf:type sh:Shape ;
  rdfs:label "Person" ;
  rdfs:subClassOf rdfs:Resource ;
  sh:property [
      sh:predicate ex:Comment ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
*    sh:update """PREFIX ex: <http://example.com#>*
*INSERT {*
*?s ex:Comment \"inserted Comments\" .*
*}*
*WHERE {*
*?s rdf:type ex:Person . }""" ;*
    ] ;
  sh:property [
      sh:predicate ex:firstName ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
      sh:name "first name" ;
    ] ;
  sh:property [
      sh:predicate ex:gender ;
      sh:class ex:Gender ;
      sh:description "A Person's gender" ;
      sh:maxCount 1 ;
      sh:minCount 1 ;
      sh:name "gender" ;
    ] ;
  sh:property [
      sh:predicate ex:lastName ;
      sh:datatype xsd:string ;
      sh:description "last name" ;
      sh:maxCount 1 ;
      sh:minCount 1 ;
      sh:name "last name" ;
    ] ;
  sh:property [
      sh:predicate ex:mother ;
      sh:class ex:Person ;
      sh:description "A Person's mother";
      sh:maxCount 1 ;
      sh:name "mother" ;
      sh:nodeKind sh:IRI ;
      sh:shape ex:FemaleShape ;
    ] ;
  sh:update """INSERT {
?s ex:Comment \"inserted Comments\" .
}
WHERE {
?s rdf:type ex:Person . }""" ;
.



ex:Person
  rdf:type rdfs:Class ;
  rdf:type sh:Shape ;
  rdfs:label "Person" ;
  rdfs:subClassOf rdfs:Resource ;
  sh:property [
      sh:predicate ex:Comment ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
      sh:update """INSERT {
?s ex:Comment \"inserted Comments\" .
}
WHERE {
?s rdf:type ex:Person . }""" ;
    ] ;
  sh:property [
      sh:predicate ex:firstName ;
      sh:datatype xsd:string ;
      sh:minCount 1 ;
      sh:name "first name" ;
    ] ;
  sh:property [
      sh:predicate ex:gender ;
      sh:class ex:Gender ;
      sh:description "A Person's gender" ;
      sh:maxCount 1 ;
      sh:minCount 1 ;
      sh:name "gender" ;
    ] ;
  sh:property [
      sh:predicate ex:lastName ;
      sh:datatype xsd:string ;
      sh:description "last name" ;
      sh:maxCount 1 ;
      sh:minCount 1 ;
      sh:name "last name" ;
    ] ;
  sh:property [
      sh:predicate ex:mother ;
      sh:class ex:Person ;
      sh:description "A Person's mother" ;
      sh:maxCount 1 ;
      sh:name "mother" ;
      sh:nodeKind sh:IRI ;
      sh:shape ex:FemaleShape ;
    ] ;
.


--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include the TopBraid Suite family of products and its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Group "TopBraid 
Suite Users", the topics of which include the TopBraid Suite family of products and 
its base technologies such as SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to