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

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 15:04:40 UTC