- From: Irene Polikoff <irene@topquadrant.com>
- Date: Fri, 10 Apr 2020 17:08:05 -0400
- To: James Hudson <jameshudson3010@gmail.com>
- Cc: Public Shacl W3C <public-shacl@w3.org>
- Message-Id: <1B261B68-AD31-43F8-B2C0-28F8B8889A55@topquadrant.com>
How does your query find resources that have no type?
As for ensuring that the type in either a class or a property, you could for example do the following:
ex:Shape1 a sh:NodeShape;
sh:targetSubjectsOf rdf:type;
sh:or (
[
sh:path rdf:type ;
sh:class rdfs:Class ;
]
[
sh:path rdf:type ;
sh:class rdf:Property ;
]
) .
Btw, SHACL Advanced Features supports SPARQL-based targets https://w3c.github.io/shacl/shacl-af/ <https://w3c.github.io/shacl/shacl-af/>.
> On Apr 10, 2020, at 4:21 PM, James Hudson <jameshudson3010@gmail.com> wrote:
>
> Hello,
>
> I asked a question on SO ( https://stackoverflow.com/questions/60993789/targeting-all-nodes-for-validation <https://stackoverflow.com/questions/60993789/targeting-all-nodes-for-validation> ) regarding how to verify that every node in my graph had a rdf:type and that the type was ultimately either a rdfs:Class or rdf:Property. The response I received was that it was impossible with SHACL because:
>
> The problem is that none of the four built-in target types is sufficient to reach all subject/objects regardless of predicate.
>
> I was just wondering why such a target type does not exist or if there were plans to include such a target type in the future...?
>
> I was able to do what I needed to do with SPARQL with the following query:
>
> {
> ?s rdf:type+ ?o .
> FILTER NOT EXISTS {
> ?s rdf:type+ ?c .
> FILTER(?c IN (rdfs:Class, rdf:Property))
> }
> }
>
> but, I would have preferred to use SHACL.
>
> Regards,
> James
>
Received on Friday, 10 April 2020 21:08:20 UTC