From 160c1b379a86d5468c9f37384a0ec38c60c82ed4 Mon Sep 17 00:00:00 2001 From: Dave Longley Date: Mon, 21 May 2012 17:41:38 -0400 Subject: [PATCH] Handle @type blank node IRIs. --- jsonld.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jsonld.php b/jsonld.php index 7aa9426..2b7548e 100644 --- a/jsonld.php +++ b/jsonld.php @@ -2354,8 +2354,8 @@ class JsonLdProcessor { continue; } - // copy keywords - if(self::_isKeyword($prop)) { + // copy non-@type keywords + if($prop !== '@type' && self::_isKeyword($prop)) { $subject->{$prop} = $objects; continue; } @@ -2381,6 +2381,10 @@ class JsonLdProcessor { $this->_flatten($subjects, $o->{'@list'}, $namer, $name, $l); $o = (object)array('@list' => (array)$l); } + // special-handle @type blank nodes + else if($prop === '@type' && strpos($o, '_:') === 0) { + $o = $namer->getName($o); + } // add non-subject self::addValue($subject, $prop, $o, true);