- From: Irene Polikoff <irene@topquadrant.com>
- Date: Mon, 17 Sep 2018 17:21:04 -0400
- To: Gary Murphy <gary@schemaapp.com>
- Cc: public-shacl@w3.org
- Message-Id: <EEEA51CB-84FD-4589-9F2A-258ACC784BA2@topquadrant.com>
You can do something like this in SHACL Core:
schema:Person
rdf:type owl:Class ;
rdf:type sh:NodeShape ;
sh:disjoint schema:url ;
But then the values of schema:url would need to be resources, not strings e.g.,:
> <http://schemaapp.com/#Person1>
> a schema:Person ;
> schema:url <http://hunchmanifest/gary.html> .
There are 4 SHACL Core constraint components that compare property values https://www.w3.org/TR/shacl/#core-components-property-pairs <https://www.w3.org/TR/shacl/#core-components-property-pairs>. They will compare input values as they get them - without doing any casting, etc.
> On Sep 17, 2018, at 11:04 AM, Gary Murphy <gary@schemaapp.com> wrote:
>
> I'm pretty new to shacl, so my apologies for any fumbling with the terms ;)
>
> yes, I am coding up constraints, translating spin rules into equivalent shacl, what I'm aiming to do here is really a cast problem, turning a URI into a string to detect something like the following
>
> <http://schemaapp.com/#Person1>
> a schema:Person ;
> schema:url "http://hunchmanifest/gary.html" .
>
> now this is a particularly bad example since very often the page for a Person is someplace else, but what I hope to detect in shacl is any mismatch between the string values of strings vs URI values -- in sparql I would just use the casting operator str() and treat them both as strings; can I get "http://schemaapp.com/#Person1" from <http://schemaapp.com/#Person1> without using sparql?
>
> By pure-SHACL I meant as supported by embedded libraries like the js used in the shacl playground. I expect that's SHACL Core?
>
> That second issue on the disjointness of all parent classes, on the other hand, probably requires an endpoint to provide the subclass hierarchy information, thus sparql may be unavoidable.
>
> On Fri, Sep 14, 2018 at 8:42 PM Irene Polikoff <irene@topquadrant.com> wrote:
> What do you mean by the "base URI of the current focus instance”? A non local name part of the URI - a namespace?
>
> If so, I am not sure why you are prepending ‘#’. You need to isolate the namespace. Then, you can compare them using FILTER.
>
> Jena has a function afn:namespace. It is available to you if you are using TopBraid and/or if you are using Jena directly: https://jena.apache.org/documentation/query/library-function.html. If you follow the link, you will also see the alternative to it - using REPLACE.
>
> If you are using sh:validator, are you creating a new SHACL constraint component? If so, then it is “pure SHACL”. May be you meant SHACL Core?
>
>
>> On Sep 14, 2018, at 2:43 PM, Gary Murphy <gary@schemaapp.com> wrote:
>>
>> two more shacl puzzles that I'm hoping to transpose from spin:
>>
>> First involves the string value of what would be $this in a sh:ask clause; the problem is to ensure that the base URI of the current focus instance is different from the base URL of the schema:url property. In SPARQL this would be something possibly like ...
>>
>> sh:validator [
>> sh:ask """
>> ASK {
>> OPTIONAL {
>> $this schema:url ?url .
>> BIND(CONCAT(str($this),'#') AS ?me ) .
>> BIND(CONCAT(str(?url),'#') AS ?it ) .
>> FILTER( STRBEFORE(?me,'#') != STRBEFORE(str(?it),'#') )
>> }
>> }""" ] ;
>>
>> Can this be restated in pure SHACL?
>>
>> Another issue is in ensuring that all superclasses of the current focus instance are disjoint. Again, in my (probably naive) validator rule:
>>
>> sh:validator [
>> sh:ask """
>> ASK {
>> $this a ?class1 .
>> $this a ?class2 .
>> FILTER (?class1 != ?class2) .
>> ?class1 (rdfs:subClassOf)* ?parent1 .
>> ?class2 (rdfs:subClassOf)* ?parent2 .
>> ?parent1 owl:disjointWith ?parent2 .
>> }""" ] ;
>>
>>
>> --
>> Gary Lawrence Murphy <gary@schemaapp.com> - Hunch Manifest, 15 Wyndham N 'C', Guelph
>
>
>
> --
> Gary Lawrence Murphy <gary@schemaapp.com> - Hunch Manifest, 15 Wyndham N 'C', Guelph
Received on Monday, 17 September 2018 21:21:28 UTC