# No SHACL SQPARQL Variables in SHACL Message Supported

**URL:** <https://community.stardog.com/t/no-shacl-sqparql-variables-in-shacl-message-supported/3472>\
**Category:** Feature Request\
**Created:** [January 24, 2022, 5:22pm UTC](https://community.stardog.com/t/no-shacl-sqparql-variables-in-shacl-message-supported/3472 "2022-01-24T17:22:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flo](https://avatars.discourse-cdn.com/v4/letter/f/b38774/32.png) [@Flo](https://community.stardog.com/u/Flo)\
**Post date:** [January 24, 2022, 5:22pm UTC](https://community.stardog.com/t/no-shacl-sqparql-variables-in-shacl-message-supported/3472/1 "2022-01-24T17:22:47Z")

</div>

Hi,

I would like to display variables form SHACL SPARQL query in `sh:message`.

With other environments, I could do so by putting SHACL SPARQL variables in {}-brackets. Why is it not working within Stardog? How can I display variables in SHACL messages in Stardog?

Thank you for the support.

Example SHACL code:

```auto
<http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#CostsRuleShapeIII> a sh:NodeShape ;
    sh:severity sh:Info ;
    sh:targetClass <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Teacher> ;
    sh:sparql [
        a sh:SPARQLConstraint ;
        sh:message "{?student} is a student that gets teached." ;
        sh:prefixes [
            sh:declare [
                sh:namespace "http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#"^^xsd:anyURI ;
                sh:prefix "maic"
            ]
        ] ;
        sh:select """
  SELECT $this ?student
  WHERE {
  $this maic:teaches ?student
  }"""
    ] .

<http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Teacher> a owl:Class ;
    rdfs:subClassOf <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Person> .

```

Example validation result:

```auto
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_162 a sh:ValidationReport ;
   sh:conforms false .
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_163 a sh:ValidationResult ;
   sh:resultSeverity sh:Info ;
   sh:sourceShape <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#CostsRuleShapeIII> ;
   sh:sourceConstraint _:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_159 ;
   sh:sourceConstraintComponent sh:SPARQLConstraintComponent ;
   sh:focusNode <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Elia> ;
   sh:value <http://www.semanticweb.org/florianschmid/ontologies/2022/0/untitled-ontology-60#Elia> ;
   sh:resultMessage "{?student} is a student that gets teached." .
_:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_162 sh:result _:bnode_3a94ee23_fce8_4cd6_817d_d02f2ed6c433_163 .

```

Expected validation result:

```auto
sh:resultMessage "Flo is a student that gets teached." .

```
