protected function parseCompactedIri($iri) {
    // As naive as it gets.
    list($prefix, $rest) = array_pad(explode(":", $iri, 2), 2, '');
    if ((substr($rest, 0, 2) == "//") || ($prefix == $iri)) {
      // Means this was never a compacted IRI.
      return ['prefix' => NULL, 'term' => $iri];
    }
    return ['prefix' => $prefix, 'term' => $rest];
  }
protected function parseCompactedIri($iri) {
    // As naive as it gets.
    list($prefix, $rest) = array_pad(explode(":", $iri, 2), 2, '');
    if ((substr($rest, 0, 2) == "//") || ($prefix == $iri)) {
      // Means this was never a compacted IRI.
      return ['prefix' => NULL, 'term' => $iri];
    }
    return ['prefix' => $prefix, 'term' => $rest];
  }
protected function parseCompactedIri ( $ iri ) { // As naive as it gets. list ( $ prefix , $ rest ) = array_pad ( explode ( ":" , $ iri , 2 ) , 2 , '' ) ; if ( ( substr ( $ rest , 0 , 2 ) == "//" ) || ( $ prefix == $ iri ) ) { // Means this was never a compacted IRI. return [ 'prefix' => NULL , 'term' => $ iri ] ; } return [ 'prefix' => $ prefix , 'term' => $ rest ] ; }
Parses and IRI, checks if it is complaint with compacted IRI definition.

Assumes this notion of compact IRI/similar to CURIE
http://json-ld.org/spec/ED/json-ld-syntax/20120522/#dfn-prefix.

@param string $iri
IRIs are strings.

@return array
If $iri is a compacted iri, prefix and term as separate
array members, if not, unmodified $iri in term position
and null prefix.
Parses and IRI checks if it is complaint with compacted IRI definition .