/** * Extracts the "label", or "local part" of an URI, i.e. it removes * its namespace, or base URI * @param string $uri * @return string */ static function extractLabelFromURI( $uri ) { $uriparts = RDFIOUtils::splitURI( $uri ); $basepart = $uriparts[0]; $localpart = $uriparts[1]; if ( $localpart[1] != '' ) { return $localpart; } else { return $basepart; } }
/** * Abbreviate the base URI into a "pseudo-wiki-title-namespace" * @param string $uri * @return string $uri */ public function abbreviateNSFromURIOld( $uri ) { $uriParts = RDFIOUtils::splitURI( $uri ); $basepart = $uriParts[0]; $localpart = $uriParts[1]; if ( $localpart == '' ) { $uri = $basepart; } elseif ( substr( $basepart, 0, 1 ) == '_' ) { // Change ARC:s default "random string", to indicate more clearly that // it lacks title $uri = str_replace( 'arc', 'untitled', $localpart ); } else { $basepart = $this->getPrefixForNS( $basepart ); if ( substr( $basepart, 0, 7 ) == 'http://' ) { // If the abbreviation does not seem to have succeeded, // fall back to use only the local part $uri = $localpart; } elseif ( substr( $basepart, -1 ) == ':' ) { // Don't add another colon $uri = $basepart . $localpart; } else { $uri = $basepart . ':' . $localpart; } } return $uri; }