forked from friendica/php-json-ld
Sort subjects and properties in toRDF.
This commit is contained in:
parent
5be8e20433
commit
f775f8ceda
12
jsonld.php
12
jsonld.php
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* PHP implementation of the JSON-LD API.
|
* PHP implementation of the JSON-LD API.
|
||||||
* Version: 0.0.34
|
* Version: 0.0.35
|
||||||
*
|
*
|
||||||
* @author Dave Longley
|
* @author Dave Longley
|
||||||
*
|
*
|
||||||
|
@ -2943,8 +2943,14 @@ class JsonLdProcessor {
|
||||||
protected function _graphToRDF($graph, $namer) {
|
protected function _graphToRDF($graph, $namer) {
|
||||||
$rval = array();
|
$rval = array();
|
||||||
|
|
||||||
foreach($graph as $id => $node) {
|
$ids = array_keys((array)$graph);
|
||||||
foreach($node as $property => $items) {
|
sort($ids);
|
||||||
|
foreach($ids as $id) {
|
||||||
|
$node = $graph->{$id};
|
||||||
|
$properties = array_keys((array)$node);
|
||||||
|
sort($properties);
|
||||||
|
foreach($properties as $property) {
|
||||||
|
$items = $node->{$property};
|
||||||
if($property === '@type') {
|
if($property === '@type') {
|
||||||
$property = self::RDF_TYPE;
|
$property = self::RDF_TYPE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue