-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
To simplify implementing resources backed by a SPARQL query, I'd like to have a handler, possibly exported from a dedicated package, that would make it possible declaratively. For example
<>
a kl:ResourceShape ;
kl:api </api> ;
sh:targetClass api:ExternalResource ;
kl:handler
[
a kl:Handler ;
kl:method "GET" ;
code:implementedBy
[
a code:EcmaScriptModule ;
code:link <node:@kopflos-cms/query#construct> ;
] ;
code:arguments
[
arg:endpoint "lindas" ;
arg:query
[
a code:SparqlQuery ;
code:link <file:queries/external-resource.rq>
] ;
arg:variables
[
arg:this [ sh:path schema:sameAs ] ;
] ;
]
] ;
.Given the above, when a request for an instance of api:ExternalResource would be made, the handler would load the query from queries/external-resource.rq and run it against env.sparql.lindas endpoint.
If arg:endpoint would be omitted, the default endpoint should be used.
arg:variable maps resource contents to SPARQL inputs. The handler would follow sh:path from the request subject. Might also allow an imperative way
Open questions
- What happens when there are multiple values found by resolving
arg:variables? Especially in the case of multiple variables. Do we just createVALUESclause with the cartesian product? - How could we support federated queries?
Metadata
Metadata
Assignees
Labels
No labels