Re: Is union of targets distinct?

Yes, PySHACL does the same. The final collection of targets is a Set object, which deduplicates any identical nodes that are added.
- Ashley
________________________________
From: Holger Knublauch <holger@topquadrant.com>
Sent: Friday, 7 January 2022 9:30 AM
To: public-shacl@w3.org <public-shacl@w3.org>
Subject: Re: Is union of targets distinct?


Here is my implementation of Shape.getTargetNodes()

    public Set<RDFNode> getTargetNodes(Dataset dataset) {
        Set<RDFNode> results = new HashSet<>();
        for(Target target : targets) {
            target.addTargetNodes(dataset, results);
        }
        return results;
    }

So, it's using a Set which means each target node will only be validated once even if in multiple targets at the same shape.

I believe this is following the intention of the spec. Does any implementer here disagree?

Holger


On 2022-01-07 4:58 am, Vladimir Alexiev wrote:
https://www.w3.org/TR/shacl/#targets: "union of terms produced by the individual targets that are declared by the shape".

Say I have a shape with the following targeting:

sh:targetClass :Foo;
sh:targetSubjectsOf :bar, :baz;
sh:targetObjectsOf :blor;

Say a node matches all of these conditions:
will it be selected for validation once and not 4 times?

I.e., is the "union of terms" supposed to be DISTINCT?
(Union in mathematics is distinct, but not in SPARQL)

--
Vladimir Alexiev, PhD, PMP
Chief Data Architect
Sirma AI, trading as Ontotext: https://www.ontotext.com<https://www.ontotext.com/>, LinkedIn<https://www.linkedin.com/company-beta/208070>, Twitter<https://twitter.com/ontotext>, Rate GraphDB<http://www.capterra.com/database-management-software/reviews/157533/Graph%20DB/Ontotext/new>
Email: vladimir.alexiev@ontotext.com<mailto:vladimir.alexiev@ontotext.com>, skype:valexiev1
Mobile: +359 888 568 132, SMS: 359888568132@sms.mtel.net<mailto:359888568132@sms.mtel.net>
Calendar: https://www.google.com/calendar/embed?src=vladimir.alexiev@ontotext.com
Publications and CV: https://github.com/VladimirAlexiev/my

Received on Thursday, 6 January 2022 23:36:59 UTC