[data-shapes] Alternative property for computed values (#301)

bergos has just created a new issue for https://github.com/w3c/data-shapes:

== Alternative property for computed values ==
As discussed in the [definition of node expressions PR](https://github.com/w3c/data-shapes/pull/274), the `sh:path` property could be misleading for the use case of creating intermediate values for validations. One may expect that `sh:path` keeps the functionality of traversing the path given as the object value. In the case of a node expression, the result of the node expression should be used for traversing. A new property could be defined that skips the traversing part and only sets the value to the computed value of the node expression.

Below are two property shapes and how they could be translated into SPARQL:

```turtle
ex:propertyShape1 a sh:PropertyShape;
  sh:path [
    shn:iri [
      shn:concat ("http://example.org/" "property")
    ]
  ].

ex:propertyShape2 a sh:PropertyShape;
  sh:computed [
    shn:iri [
      shn:concat ("http://example.org/" "property")
    ]
  ].
```

```sparql
# for ex:propertyShape1
SELECT * WHERE {
  $this IRI(CONCAT("http://example.org/", "property")) $value
}
```

```sparql
# for ex:propertyShape2
SELECT * WHERE {
  BIND(IRI(CONCAT("http://example.org/", "property")) AS $value)  
}
```

There were multiple proposals in the PR for the name of the property. *derived* sounds good, but I would prefer *computed*. As shown in the example, it's not required to derive the value from any existing data. Maybe also combine it with *value*, like *computedValue*. *computedNode* may give the impression that only blank node and named node results are expected from the node expressions, but literals would also be allowed.

I took the term *value* from the SPARQL definitions of the constraint components as I think we don't have a defined term for the result of the traversing step from focus node over path.

Please view or discuss this issue at https://github.com/w3c/data-shapes/issues/301 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 4 March 2025 21:37:37 UTC