Fix various bugs that cropped up during port.

This commit is contained in:
Dave Longley 2012-04-23 15:00:13 -04:00
parent a1a5a4cb34
commit b763bdde10
1 changed files with 5 additions and 8 deletions

View File

@ -1210,8 +1210,7 @@ class JsonLdProcessor {
$hashes = array_keys((array)$unique); $hashes = array_keys((array)$unique);
sort($hashes); sort($hashes);
foreach($hashes as $hash) { foreach($hashes as $hash) {
$bnode = $unique->{$hash}; $namer->getName($unique->{$hash});
$namer->getName($bnode);
} }
} }
while(count($unnamed) > count($nextUnnamed)); while(count($unnamed) > count($nextUnnamed));
@ -1256,8 +1255,7 @@ class JsonLdProcessor {
// add all bnodes // add all bnodes
foreach($bnodes as $id => $statements) { foreach($bnodes as $id => $statements) {
// add all property statements to bnode // add all property statements to bnode
$name = $namer->getName($id); $bnode = (object)array('@id' => $namer->getName($id));
$bnode = (object)array('@id' => $name);
foreach($statements as $statement) { foreach($statements as $statement) {
if($statement->s === '_:a') { if($statement->s === '_:a') {
$z = $this->_getBlankNodeName($statement->o); $z = $this->_getBlankNodeName($statement->o);
@ -1671,8 +1669,6 @@ class JsonLdProcessor {
$groups = new stdClass(); $groups = new stdClass();
$cache = new stdClass(); $cache = new stdClass();
foreach($statements as $statement) { foreach($statements as $statement) {
$bnode = null;
$direction = null;
if($statement->s !== '_:a' && strpos($statement->s, '_:') === 0) { if($statement->s !== '_:a' && strpos($statement->s, '_:') === 0) {
$bnode = $statement->s; $bnode = $statement->s;
$direction = 'p'; $direction = 'p';
@ -1757,7 +1753,7 @@ class JsonLdProcessor {
} }
// recurse // recurse
if($skipped) { if(!$skipped) {
foreach($recurse as $bnode) { foreach($recurse as $bnode) {
$result = $this->_hashPaths( $result = $this->_hashPaths(
$bnodes, $bnodes->{$bnode}, $namer, $path_namer_copy); $bnodes, $bnodes->{$bnode}, $namer, $path_namer_copy);
@ -1767,7 +1763,7 @@ class JsonLdProcessor {
// skip permutation if path is already >= chosen path // skip permutation if path is already >= chosen path
if($chosen_path !== null && strlen($path) >= strlen($chosen_path) && if($chosen_path !== null && strlen($path) >= strlen($chosen_path) &&
$path > $chosenPath) { $path > $chosen_path) {
$skipped = true; $skipped = true;
break; break;
} }
@ -3295,6 +3291,7 @@ class UniqueNamer {
// save mapping // save mapping
if($old_name !== null) { if($old_name !== null) {
$this->existing->{$old_name} = $name; $this->existing->{$old_name} = $name;
$this->order[] = $old_name;
} }
return $name; return $name;