- From: Eric Prud'hommeaux via GitHub <sysbot+gh@w3.org>
- Date: Wed, 08 Feb 2023 17:39:11 +0000
- To: public-shex-dev@w3.org
@gkellogg , have you tried to frame ShExR->ShExJ using JSON-LD 1.1?
@JervenBolleman , I recall it not being quite possible with JSON-LD 1.0 because ShExJ wants e.g. (YAML for terseness):
``` yaml
type: Schema
shapes:
- type: ShapeDecl
id: http://a.example/Commuter
shapeExpr:
type: Shape
expression:
type: TripleConstraint
predicate: http://a.example/rides
valueExpr: http://a.example/Vehicle
- type: ShapeDecl
id: http://a.example/Vehicle
shapeExpr:
type: Shape
expression:
type: TripleConstraint
predicate: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
valueExpr:
type: NodeConstraint
values:
- http://a.example/Bike
- http://a.example/Bicycle
- http://a.example/Unicycle
```
and not:
``` yaml
type: Schema
shapes:
- type: ShapeDecl
id: http://a.example/Commuter
shapeExpr:
type: Shape
expression:
type: TripleConstraint
predicate: http://a.example/rides
valueExpr: http://a.example/Vehicle
- type: ShapeDecl
id: http://a.example/Vehicle
shapeExpr:
type: Shape
expression:
type: TripleConstraint
predicate: http://www.w3.org/1999/02/22-rdf-syntax-ns#type
valueExpr:
type: NodeConstraint
values:
- http://a.example/Bike
- http://a.example/Bicycle
- http://a.example/Unicycle
```
which tends to fall out of framing (at least when you have corefs to `Vehicle`. Gregg used a bit of post-processing to get it the last mile.
So far, we've defined ShExR as ShExJ's JSON-LD interpretation. If we want to specify the return, we need to either specify that post-processing or define it in terms of e.g. JSG with an algorithm that starts with a typed node N, validates it according to ```N@ShExR.shex#schema```, and defined ShExR2ShExJ as e.g.:
[[
There is some ShExJ object O such that match(N rdf:type shex:{O.type}) matches 1 triple.
Thee is a JSG object declaration D named O.type.
For each ShExJ property P in D,
if there is some value V such that match(N, shex:{P}, V) matches 1 triple,
O.{P} = ShExR2ShExJ(V)
]]
Something like that would start with the Schema and recursively visit a valid ShExR schema. We'd want special behavior around ShapeDecls to keep them at the top level.
Thoughts?
--
GitHub Notification of comment by ericprud
Please view or discuss this issue at https://github.com/shexSpec/spec/issues/55#issuecomment-1422999579 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 8 February 2023 17:39:13 UTC