admin管理员组

文章数量:1123887

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: </>
PREFIX wd: </>

SELECT 
?country 
WHERE {
  SERVICE <; {
  ?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 (/) Construct query could do the job.

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.

Share Improve this question edited 15 hours ago thalhamm asked yesterday thalhammthalhamm 3472 silver badges6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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

本文标签: sparqlUse a dynamic list for SHACL39s shInConstraintComponent (shin)Stack Overflow