You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node Expression Intro and Syntax overview chapters (#441)
* Started some introductory section
* Progress with the definitions and examples
* Fixed duplicate section ID, broken references after merge
* Apply suggestions from code review
Co-authored-by: David Habgood <[email protected]>
---------
Co-authored-by: David Habgood <[email protected]>
A <dfn>named parameter function</dfn> is a <a>node expression function</a>
782
+
that is represented by a <a>blank node</a> that is the <a>subject</a> of at least
783
+
one <a>triple</a> where the <a>predicate</a> can be used to uniquely identify the function,
784
+
which is known as the <dfn>key parameter</dfn>.
785
+
</p>
786
+
<p>The evaluation of a <a>named parameter function</a> can produce either:
787
+
<ul>
788
+
<li>zero <a>output nodes</a>, i.e. the empty list</li>
789
+
<li>one or more <a>output nodes</a>, i.e. a list of one or more nodes</li>
790
+
<li>an <a>evaluation failure</a>, i.e. an (unexpected) error during the evaluation</li>
791
+
</ul>
792
+
</p>
793
+
<p>
794
+
For example, the <a>named parameter function</a><ahref="#FilterShapeExpression">sh:FilterShapeExpression</a> has
795
+
<code>sh:filterShape</code> as its <a>key parameter</a>.
796
+
In this document, key parameters are marked in <b>bold face</b>.
797
+
</p>
798
+
<p>
799
+
Expressions based on <a>named parameter functions</a> often take other <a>node expressions</a>
800
+
as arguments, evaluate those input node expressions and then produce a different list of <a>nodes</a>
801
+
as <a>output nodes</a>.
802
+
</p>
803
+
<p><em>The remainder of this section is informative.</em></p>
804
+
<p>
805
+
This document includes many examples of <a>named parameter functions</a>, such as
806
+
the <ahref="#EstonianCompanyShapeExample">Estonian Company Shape example</a>.
807
+
</p>
808
+
</section>
620
809
<sectionid="ListParameterFunction">
621
810
<h3>List Parameter Functions</h3>
622
811
<p>
623
-
...
812
+
A <dfn>list parameter function</dfn> is a <a>node expression function</a>
813
+
that is represented by a <a>blank node</a> that is the <a>subject</a> of a single
814
+
<a>triple</a> where the <a>object</a> is a <a>SHACL list</a>.
815
+
The <a>predicate</a> of this <a>triple</a> is called the <dfn>list parameter property</dfn>.
624
816
</p>
625
-
</section>
626
-
<sectionid="NamedArgumentFunctions">
627
-
<h3>Named Argument Functions</h3>
628
817
<p>
629
-
...
818
+
The <a>evaluation</a> of a <a>list parameter function</a> can produce either:
819
+
</p>
820
+
<ul>
821
+
<li>one <a>output node</a>, i.e. a list of one <a>node</a></li>
822
+
<li>zero <a>output nodes</a>, i.e. the empty list</li>
823
+
<li>an <a>evaluation failure</a>, i.e. an (unexpected) error during the evaluation</li>
824
+
</ul>
825
+
<p>
826
+
Furthermore, all arguments of a <a>list parameter function</a> must evaluate to individual <a>nodes</a>
827
+
and not lists of nodes.
828
+
If an argument is a <a>node expression</a> then this <a>node expression</a> must evaluate to
829
+
at most one <a>output node</a>.
830
+
An <a>evaluation failure</a> must be produced if there is more than one <a>output node</a>.
831
+
This is different from <a>named parameter functions</a>, where arguments may produce lists of multiple nodes.
832
+
</p>
833
+
<p><em>The remainder of this section is informative.</em></p>
834
+
<p>
835
+
Note that some <a>named parameter functions</a> such as <code>sh:IntersectionExpression</code>
836
+
also use <a>SHACL lists</a> as object of the <a>key parameter</a>, similar to <a>list parameter functions</a> which always have <a>SHACL lists</a> as object of their <a>list parameter property</a>.
837
+
However, these may produce more than one <a>output nodes</a> and also accept lists as input nodes.
838
+
</p>
839
+
<p>
840
+
The following example uses multiple (imaginary) <a>list parameter functions</a>
841
+
<code>ex:coalesce</code> and <code>ex:concat</code> to compute the <code>ex:displayName</code>
842
+
of a person as either the value of <code>ex:fullName</code> or (if that doesn't exist)
843
+
as the concatenation of first and last names, with a space in between.
844
+
</p>
845
+
<p>
846
+
<asideclass="example" title="A comple node expression based on list parameter functions.">
847
+
<divclass="shapes-graph">
848
+
<divclass="turtle">
849
+
ex:Person-displayName
850
+
a sh:PropertyShape ;
851
+
sh:name "display name" ;
852
+
sh:path ex:displayName ;
853
+
sh:datatype xsd:string ;
854
+
sh:values <b>[
855
+
ex:coalesce (
856
+
[
857
+
# This is a path expression that is expected to return zero or one values
858
+
sh:path ex:fullName ;
859
+
]
860
+
[
861
+
ex:concat (
862
+
[ sh:path ex:firstName ] # Path expression with at most one value
863
+
" " # A constant literal expression
864
+
[ sh:path ex:lastName ] # Path expression with at most one value
0 commit comments