src/Util.php
public static function expandPrefixedName ($prefixedName, $prefixes)
    {
        preg_match("/(?:^|\"\^\^)([^:\/#\"'\^_]*):[^\/]*$/", $prefixedName, $match, PREG_OFFSET_CAPTURE);
        $prefix = "";
        $base = "";
        $index = "";
        
        if (!empty($match)) {
            $prefix = $match[1][0];
            $base = "";
            if (isset($prefixes[$prefix]))
            {
                $base = $prefixes[$prefix];
            } else {
                $base = null;
            }
            $index = $match[1][1];
        }
        if (!$base) {
            return $prefixedName;
        }

        // The match index is non-zero when expanding a literal's type
        if ($index === 0) {
            // base + prefixedName.substr(prefix.length + 1)
            return $base . substr($prefixedName, strlen($prefix) + 1);
        } else {
            // prefixedName.substr(0, index + 3) + base + prefixedName.substr(index + prefix.length + 4);
            return substr($prefixedName, 0, $index) . $base . substr($prefixedName, $index + strlen($prefix) + 1);
        }   
    }
public static function expandPrefixedName ($prefixedName, $prefixes)
    {
        preg_match("/(?:^|\"\^\^)([^:\/#\"'\^_]*):[^\/]*$/", $prefixedName, $match, PREG_OFFSET_CAPTURE);
        $prefix = "";
        $base = "";
        $index = "";
        
        if (!empty($match)) {
            $prefix = $match[1][0];
            $base = "";
            if (isset($prefixes[$prefix]))
            {
                $base = $prefixes[$prefix];
            } else {
                $base = null;
            }
            $index = $match[1][1];
        }
        if (!$base) {
            return $prefixedName;
        }

        // The match index is non-zero when expanding a literal's type
        if ($index === 0) {
            // base + prefixedName.substr(prefix.length + 1)
            return $base . substr($prefixedName, strlen($prefix) + 1);
        } else {
            // prefixedName.substr(0, index + 3) + base + prefixedName.substr(index + prefix.length + 4);
            return substr($prefixedName, 0, $index) . $base . substr($prefixedName, $index + strlen($prefix) + 1);
        }   
    }
Expands the prefixed name to a full IRI (also when it occurs as a literal's type)