diff --git a/Erfurt/Store.php b/Erfurt/Store.php index 282ad697..7d8eaf35 100644 --- a/Erfurt/Store.php +++ b/Erfurt/Store.php @@ -1676,11 +1676,12 @@ private function _getTransitiveClosure($modelIri, $property, $startResources, $i $subSparql = 'SELECT ?parent ?child FROM <' . $modelIri . '>' . PHP_EOL . $from . ' WHERE { - ' . $where . ' + ' . $where . ' OPTIONAL {?child ?order} FILTER ( sameTerm(?parent, <' . implode('>) || sameTerm(?parent, <', $classes) . '>) ) - }'; + } + ORDER BY ?order'; require_once 'Erfurt/Sparql/SimpleQuery.php'; $subSparql = Erfurt_Sparql_SimpleQuery::initWithString($subSparql);