- From: Holger Knublauch <holger@topquadrant.com>
- Date: Thu, 23 Apr 2015 11:11:23 +1000
- To: public-data-shapes-wg@w3.org
I am not seeing too much of an issue with implementing closed shapes in SPARQL, assuming that we can access the shape definitions at runtime - it boils down to FILTER NOT EXISTS. In my local version I just added a template sh:ClosedShapeConstraint a sh:ConstraintTemplate ; rdfs:subClassOf sh:LocalTemplateConstraint ; rdfs:label "Closed shape constraint" ; rdfs:comment "Triggers an error for each triple of the focus node that has a predicate that is not explicitly enumerated using sh:property in the surrounding shape." ; sh:labelTemplate "Closed shape" ; sh:message "Invalid triple for closed shape" ; sh:sparql """ SELECT ?this (?this AS ?subject) ?predicate ?object WHERE { ?this ?predicate ?object . FILTER (?predicate != rdf:type && ?predicate != sh:nodeShape) . FILTER NOT EXISTS { GRAPH ?shapesGraph { ?currentShape sh:property/sh:predicate ?predicate . } } } """ ; . sh:ClosedShape a sh:ClosedShapeConstraint ; rdfs:label "Closed shape" ; rdfs:comment "A singleton instance of sh:ClosedShapeConstraint that can be shared between multiple shape definitions." ; . assuming that the definition of "closed" is that all predicates must be mentioned as sh:property/sh:predicate in the current shape, plus rdf:type and sh:nodeShape. An example test case is ex:MyClass a rdfs:Class ; rdfs:subClassOf rdfs:Resource ; sh:property [ sh:predicate ex:value ; ] ; sh:constraint sh:ClosedShape ; . ex:ValidInstance1 a ex:MyClass ; sh:nodeShape ex:MyClass ; ex:value "A" ; . ex:InvalidInstance1 a ex:MyClass ; ex:value "A" ; ex:value2 "A" ; . Note that the SPARQL query above assumes the presence of two pre-bound variables ?shapesGraph and ?currentShape that are passed into the query by the engine. Open questions would be should this also honor inheritance/extension and sh:inverseProperty. I would not be in favor of having closed shapes as a flag to the engine - I think this should be driven by the shape definitions themselves. Holger On 4/23/2015 7:00, Peter F. Patel-Schneider wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > OK. I'll list them right at that spot in addition to the other places that > they are listed. > > peter > > PS: They turn out to be recursive shapes and closed shapes. Hmm, neither > of these are actually accepted requirements yet, so I'll change the wording > as well. > > On 04/22/2015 01:33 PM, Ted Thibodeau Jr wrote: >> On Apr 17, 2015, at 03:23 AM, Peter F. Patel-Schneider >> <pfpschneider@gmail.com> wrote: >> >>> I light of >>> >>> http://www.w3.org/2015/04/16-shapes-minutes.html#resolution03 >>> RESOLUTION: All proposals to be considered should be in decent shape by >>> the end of the month (30 April) or will be dropped >>> >>> I updated my proposal for a SHACL based on SPARQL at >>> https://www.w3.org/2014/data-shapes/wiki/Shacl-sparql >>> >>> >>> I welcome questions and suggestions for improvement. >>> >>> peter >> >> "Several SHACL accepted requirements cannot be handled in SPARQL and so >> are not in this proposal for SHACL." >> >> Enumerating these would make informed consideration of this proposal much >> less challenging. >> >> Thanks, >> >> Ted >> >> >> >> -- A: Yes. >> http://www.idallen.com/topposting.html | Q: Are you sure? | | A: Because >> it reverses the logical flow of conversation. | | | Q: Why is top posting >> frowned upon? >> >> Ted Thibodeau, Jr. // voice +1-781-273-0900 x32 >> Senior Support & Evangelism // mailto:tthibodeau@openlinksw.com >> // http://twitter.com/TallTed OpenLink Software, Inc. >> // http://www.openlinksw.com/ 10 Burlington Mall Road, Suite >> 265, Burlington MA 01803 Weblog -- http://www.openlinksw.com/blogs/ >> LinkedIn -- http://www.linkedin.com/company/openlink-software/ Twitter >> -- http://twitter.com/OpenLink Google+ -- >> http://plus.google.com/100570109519069333827/ Facebook -- >> http://www.facebook.com/OpenLinkSoftware Universal Data Access, >> Integration, and Management Technology Providers >> >> >> >> >> >> >> >> > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQEcBAEBCAAGBQJVOAvnAAoJECjN6+QThfjzp2UH/3Nyb9e8DcsNzpUfDhkX02aI > vlJKqjCXG6hR4J3pjS5fTOg6sejru4iw7/O4bv33pbwHM5G3Z3cMJqIa5S42wpeQ > 2Kq8Gi9VAtAtOkAHumCa/ZkaM052bcMXaVYgu0IOZJK/lne9BHxxb/FLBNLWFnJr > v/Jizl4ksqZkcAK0XYr2xNuyoeZHD1UlOYqsG7TUBsMwByD8PkyqSe4FMssRFzCT > xQwGGHqdfxNrc6wqupd1KxSzv411QrA0r2dpUVjYl3+kPIWiCGWQu+aGJYmoLygK > xNn0j3MugWwWSSEW+wFaTTTs9p+KMXfMhKu7TJtW/24u944O8N6AVFgh+h0chC0= > =VS/F > -----END PGP SIGNATURE----- >
Received on Thursday, 23 April 2015 01:13:01 UTC