Skip to content

#185: Added subClassOfInShapesGraph parameter #447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions shacl12-core/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,9 @@ <h3>Terminology</h3>
<div>
The <dfn data-lt="type|types|SHACL type">SHACL types</dfn> of an <a>RDF term</a> in an <a>RDF graph</a> is the set of its <a>values</a> for <code>rdf:type</code> in the
<a>graph</a> as well as the <a>SHACL superclasses</a> of these <a>values</a> in the <a>graph</a>.
Note that some SHACL implementations can be parameterized so that the <code>rdfs:subClassOf</code> triples
that determine the <a>SHACL subclasses</a> may be queried from the <a>shapes graph</a> instead of the <a>data graph</a>.
See <a href="#subClassOfInShapesGraph"></a>.
</div>
</div>
<div class="def">
Expand Down Expand Up @@ -1530,6 +1533,11 @@ <h4>Class-based Targets (sh:targetClass)</h4>
</div>
</div>
</aside>
<p>
Note that the <code>rdfs:subClassOf</code> triples may be queried from the <a>shapes graph</a>,
see <a href="#subClassOfInShapesGraph"></a>, in which case the <code>rdfs:subClassOf</code> triple
from the example above would not be required in the <a>data graph</a>.
</p>

</section>

Expand Down Expand Up @@ -2702,6 +2710,27 @@ <h3>Data Graph</h3>
several related ontologies, pass all of them to the SHACL processor (together or one by one), do not rely on <code>owl:imports</code> links.
</p>
</section>

<section id="subClassOfInShapesGraph">
<h3>Graph for rdfs:subClassOf Triples</h3>
<p>
Some features of SHACL (such as
<a href="#ClassConstraintComponent"></a>,
<a href="#targetClass"></a> and
<a href="#implicit-targetClass"></a>) rely on the notion
of <a>SHACL type</a> to determine whether a <a>node</a> is a <a>SHACL instance</a> of a given class.
By default, this is determined by looking up <code>rdfs:subClassOf</code> and <code>rdf:type</code> <a>triples</a>
in the <a>data graph</a>.
However, in some cases this is impractical as <code>rdfs:subClassOf</code> triples are often stored as part
of the class/shape definitions and not the instance data.
</p>
<p>
SHACL processors SHOULD offer a parameter <code>subClassOfInShapesGraph</code> that, if set to <code>true</code>
should alter the definition of <a>SHACL Type</a> so that the <code>rdfs:subClassOf</code> triples are queried
from the <a>shapes graph</a> instead of the <a>data graph</a>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from the <a>shapes graph</a> instead of the <a>data graph</a>.
from the <a>shapes graph</a> in addition to the <a>data graph</a>.

Why omit consideration of rdfs:subClassOf statements in the data graph when this mode is enabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That COULD work too. I went with the simpler solution because querying a union graph would be more complex, and make optimizations harder. If we know that we only look in the shapes graph, all class closures could be pre-computed into HashSets, instead of having to walk the hierarchy over and over.

Also, what about undesirable cases where some subClassOf triples are in the data graph and others in the shapes graph. That sounds like a mess to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there realistic scenarios where people want to mix and match?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there realistic scenarios where people want to mix and match?

I can imagine some cases e.g. having an upper level ontology in your shapes graph and then lower level ontologies in your data graph. I have no data on whether these appear in the wild.

The <code>rdf:type</code> triples are always expected in the <a>data graph</a>.
</p>
</section>

<section id="sh-shapes-graph">
<h3>Linking to shapes graphs (sh:shapesGraph)</h3>
Expand Down Expand Up @@ -7923,6 +7952,7 @@ <h2>Changes between SHACL 1.0 Core and SHACL 1.2 Core</h2>
<li>Added the new constraint component <a href="#NodeByExpressionConstraintComponent"><code>sh:nodeByExpression</code></a>, see <a href="https://github.com/w3c/data-shapes/issues/408">Issue 408</a></li>
<li>Added the new value <code>sh:ByTypes</code> for <a href="#ClosedConstraintComponent"><code>sh:closed</code></a>; see <a href="https://github.com/w3c/data-shapes/issues/172">Issue 172</a></li>
<li>The values of <a href="#ClassConstraintComponent"><code>sh:class</code></a> and <a href="#DatatypeConstraintComponent"><code>sh:datatype</code></a> can now also be lists, indicating a union of choices; see <a href="https://github.com/w3c/data-shapes/issues/160">Issue 160</a></li>
<li>Added parameter <a href="#subClassOfInShapesGraph"></a> to look up rdfs:subClassOf triples in the shapes graph instead of data graph; see <a href="https://github.com/w3c/data-shapes/issues/185">Issue 185</a></li>
</ul>
</section>

Expand Down