Re: validating the URI of $this, and ensuring superclass disjointness

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 <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

Received on Saturday, 15 September 2018 00:43:19 UTC