{{!
@param IRI class
@param IRI graph
@param IRI property
@param IRI range
}}

SELECT (MIN(?cardinality) AS ?minCardinality)
       (MAX(?cardinality) AS ?maxCardinality)
WHERE {
  {
    SELECT ?s (COUNT(*) AS ?cardinality)
    WHERE {
      {{#graph}}
      GRAPH <{{.}}> {
      {{/graph}}
        ?s a <{{class}}> .
        OPTIONAL {
          ?s <{{property}}> [ a <{{range}}> ] .
        }
      {{#graph}}
      }
      {{/graph}}
    }
    GROUP BY ?s
  }
}

{{!
@param IRI class
@param IRI graph
@param IRI property
@param IRI range
}}

SELECT (MIN(?cardinality) AS ?minCardinality)
       (MAX(?cardinality) AS ?maxCardinality)
WHERE {
  {
    SELECT ?s (COUNT(DISTINCT ?o) AS ?cardinality)
    WHERE {
      {{#graph}}
      GRAPH <{{.}}> {
      {{/graph}}
        ?s a <{{class}}> .
        OPTIONAL {
          ?s <{{property}}> ?o .
          ?o a <{{range}}> .
        }
      {{#graph}}
      }
      {{/graph}}
    }
    GROUP BY ?s
  }
}

Fix minimum cardinality of object properties
Fix minimum cardinality of object properties
