title: How to construct a SHACL shape using SPARQL
body: <p>I have a <code>ttl</code> file with this information:</p>
  <pre><code>ex:Shape1
      a sh:NodeShape ;
      sh:property ex:Property-1
      rdfs:label &quot;Shape 1&quot;
  
  ex:Property-1
      a sh:PropertyShape ;
      sh:path ex:property1
      sh:name &quot;Property 1&quot;
  
  ex:property1
      a owl:DatatypeProperty
  </code></pre>
  <p>After loading the above data into my triple store (which contains many shapes already), what query can I use to retrieve the same data back?</p>
  <p>I have tried a few things, the closest I got is the below query which returns every shape in my triple store (but not <code>ex:property1</code>):</p>
  <pre><code>PREFIX sh: &lt;http://www.w3.org/ns/shacl#&gt;
  PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
  PREFIX owl: &lt;http://www.w3.org/2002/07/owl#&gt;
  PREFIX ex: &lt;http://example.com/#&gt;
  
  CONSTRUCT {
    ?subject ?predicate ?object
  }
  WHERE {
    ex:Shape1 sh:property ?propertyShape .
    { ex:Shape1 ?predicate ?object } UNION {  ?propertyShape ?predicate ?object }
    ?subject ?predicate ?object .
  }
  </code></pre>