The RDF API functions rdf_normalize() and rdf_denormalize() convert between the two in-memory data representations, and the functions rdf_serialize() and rdf_unserialize() convert data to and from the serialized representation.

Denormalized RDF/PHP

The basic form of dealing with RDF data is as the constituent triples; more specifically, as a two-dimensional, numerically-indexed array of triples. In this form, each array element is another array of length 3, containing the subject, object and predicate:

array(
  array($subject, $predicate, $object),
  array($subject, $predicate, $object),
  ...
);

As is evident, this can be a rather inefficient form of storage due to the subjects and predicates being repeated verbatim for each triple.

Normalized RDF/PHP

The exact same RDF data (i.e. the same directed graph) can be described in a more compact and readable "normalized" form:

array(
  $subject1 => array(
    $predicate1 => array($object1, $object2, ...),
    ...
  ),
  ...
);

It might be said that the denormalized form looks at RDF as a set of statements (triples), and the normalized form in something closer to a directed graph (boxes and arrows).

As PHP's arrays can only be indexed numerically using integers or associatively using strings, URI references for subjects and predicates should be expressed in string form. A shortcut is provided, however: as long as they are unambigious, predicates can be given using a CURIE (in this form, also known as a QName) instead of a URI.