The following query is valid according to Jena but gives an error on https://dbpedia.org/sparql:
`Virtuoso 37000 Error SP031: SPARQL compiler: The name ?p is used in multiple clauses, without any logical connection`
```sparql
SELECT (?p AS ?property) (MIN(?c) AS ?minCardinality) (MAX(?c) AS ?maxCardinality) 
{
  SELECT ?s ?p (count(?o) AS ?c) {
    { SELECT DISTINCT ?p { [] ?p [] }}
    { SELECT DISTINCT ?s { ?s ?p [] }}
    OPTIONAL { ?s ?p ?o }
  }
  GROUP BY ?s ?p
}
GROUP BY ?p
```
Error SP031: SPARQL compiler: The name is used in multiple clauses, without any logical connection
This is a GitHub Issue
repo:virtuoso-opensource
owner:openlink
Title : Error SP031: SPARQL compiler: The name is used in multiple clauses, without any logical connection
Issue date:

--- start body ---
The following query is valid according to Jena but gives an error on https://dbpedia.org/sparql:
`Virtuoso 37000 Error SP031: SPARQL compiler: The name ?p is used in multiple clauses, without any logical connection`
```sparql
SELECT (?p AS ?property) (MIN(?c) AS ?minCardinality) (MAX(?c) AS ?maxCardinality) 
{
  SELECT ?s ?p (count(?o) AS ?c) {
    { SELECT DISTINCT ?p { [] ?p [] }}
    { SELECT DISTINCT ?s { ?s ?p [] }}
    OPTIONAL { ?s ?p ?o }
  }
  GROUP BY ?s ?p
}
GROUP BY ?p
```
--- end body ---
