diff --git a/jsonld.php b/jsonld.php index b23dd06..f02f057 100644 --- a/jsonld.php +++ b/jsonld.php @@ -483,11 +483,12 @@ class JsonLdProcessor { if(isset($options['format'])) { // supported formats if($options['format'] === 'application/nquads') { - $nquads = ''; + $nquads = array(); foreach($statements as $statement) { - $nquads .= $this->_toNQuad($statement); + $nquads[] = $this->_toNQuad($statement); } - $statements = $nquads; + sort($nquads); + $statements = implode($nquads); } else { throw new JsonLdException(