-
Notifications
You must be signed in to change notification settings - Fork 41
#650: Added link to VarExpression to clarify what "variable" means here #655
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
base: gh-pages
Are you sure you want to change the base?
Conversation
shacl12-node-expr/index.html
Outdated
| <p><em>The remainder of this section is informative.</em></p> | ||
| <p> | ||
| Note that the scope in the evaluation of expression constraints contains the variable <code>value</code> | ||
| Note that the scope in the evaluation of expression constraints contains the <a href="#VarExpression">variable</a> <code>value</code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least:
| Note that the scope in the evaluation of expression constraints contains the <a href="#VarExpression">variable</a> <code>value</code> | |
| Note that the scope in the evaluation of expression constraints contains the <a href="#dfn-var-expression">variable</a> <code>value</code> |
although this called a "var expression" not "a variable" so that seems to make it:
| Note that the scope in the evaluation of expression constraints contains the <a href="#VarExpression">variable</a> <code>value</code> | |
| Note that the scope in the evaluation of expression constraints contains the <a href="#VarExpression">var expression</a> <code>value</code> |
The definition:
A blank node that is the subject of the following properties is called a var expression with the function name shnex:VarExpression:
says the blank node is the var expression and is an RDF term.
If you want to keep it as the current design, please keep using "var expression" and then shacl12-rules can define variable. (There are only two other uses of "variable" in the node expressions doc at the moment.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't even need to talk VarExpressions at all here. The key is the term "scope". And scope is defined in SHACL 1.2 core as
<li><code>scope</code> is a map from (key) <a>nodes</a> to individual (value) <a>nodes</a>.
The empty map is written as <code>{}</code>.
So I think we can avoid the term variable in that definition and just refer to mappings in the scope, where the key in the map is the value of shnex:var of the var expression.
I guess the proper fix is then to create a deep link to the scope definition and reference that from node expressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The map is from a string (taken from shnex:var) to RDF term.
If it is a node (RDF Term), then
[ shnex:var "foo" ] .
[ shnex:var "foo" ] .
is two different scope entries.
If there is no varExpression, how does a node expression work
[ sparql:plus ( [ shnex:var foo" ] 1 ) ]
Something has to define
exprEval([ shnex:var "foo" ])
and that to be an error if "foo" is not in the scope, which is returning an empty list from scope lookup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I struggle to parse your response.
[ shnex:var "foo" ] .
[ shnex:var "foo" ] .
are two times the same expression. Why should those be "different scope entries"?
The sentence above the sparql:plus example seems unfinished. What do you mean?
We could change the handling of undefined variables but then how could we distinguish unbound (optional) parameters from those called by accident in a node expression? There is no "null" value here like in JavaScript.
Anyway, I made further adjustments to the PR and believe external documents can refer to the variable scope by name when they refer to evalExpr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I struggle to parse your response.
[ shnex:var "foo" ] . [ shnex:var "foo" ] .are two times the same expression.
And what RDF term do they evaluate to? That's necessary because:
scope is a map from (key) nodes to individual (value) nodes.
(PS better to say "RDF term", not "nodes" which are the existing subject/objects of a graph)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably me still shaking cobwebs off from being AFK a while, but I need a reminder on one of the less intuitive ideas from RDF:
Is a literal a node?
Is a literal a term?
Update for RDF 1.2:
Is a triple term a node?
Is a triple term a term? (...If it isn't, why?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RDF Terms : https://www.w3.org/TR/rdf12-concepts/#section-terms
IRIs, Blank nodes, literals, triple terms.
Nodes: https://www.w3.org/TR/rdf12-concepts/#dfn-node
"Nodes of a graph" -- the set of Subjects and Objects in use in a graph (not if only in the predicate position, of if only inside triple terms). As in "nodes and arcs" for graphs.
Triple terms: https://www.w3.org/TR/rdf12-concepts/#section-triple-terms
It is a triple in the role of an RDF term.
Is a literal a term?
Yes
Is a literal a node?
If it is in the graph
Is a triple term a node?
If it is in the graph as a <<( )>> thingy.
Is a triple term a term? (...If it isn't, why?)
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If "foo" is not in the scope, then this rule applies
So scope is mapping a string, not a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it maps term to term, and I have taken the word "variable" out of the paragraph that started this thread.
Are you suggesting to rename shnex:var to something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you say that the subject of [ shnex:var "foo" ] is (as in "describes", "represents" or "denotes", not in the RDF syntax where is a blank node) a variable with name "foo"?
After all:
shnex:var sh:datatype xsd:string The variable name, e.g. "focusNode".
sh:minLength 1
Var expressions are expressions. They yield an RDF term when evaluated.
Here, they are the use of a variable in a role.
Closes #650