I'm trying to identify a method, in SHACL, where the following SPARQL query is evaluated live at validation and is used as an input to an sh:in rule
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT
?country
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
?country wdt:P31 wd:Q3624078 }
}
I've envisioned the following SHACL rule:
ex:InExampleShape
a sh:NodeShape ;
sh:targetNode ex:Person ;
sh:property [
sh:path ex:bornIn ;
sh:in ex:DYNAMIC_COUNTRY_LIST_FROM_WIKIDATA ;
] .
Probably turning the SPARQL SELECT query into a CONSTRUCT that returns a proper rdf:List is the first challenge here.
I've also considered using SHACL SPARQL-based constraints but the SERVICE keyword is explicitly disallowed (for good reasons). I've also been wondering if a SPIN (https://spinrdf.org/) Construct query could do the job.
As this is not supported by current SHACL standard versions, I assume you are open to discussing some SHACL extension?
This is what we support now in our product, for pretty much exactly your use case: https://datashapes.org/dynamic.html#example-state