public static boolean isPN_PREFIX(String prefix){
  if (prefix.length() == 0) {
    logger.debug("PN_PREFIX was not valid (empty)");
    return false;
  }
  if (!isPN_CHARS_BASE(prefix.charAt(0))) {
    logger.debug("PN_PREFIX was not valid (start character invalid) i=0 nextchar={} prefix=",prefix.charAt(0),prefix);
    return false;
  }
  final int numberOfCodePoints=prefix.codePointCount(0,prefix.length());
  for (int i=1; i < numberOfCodePoints; i++) {
    final int codePoint=prefix.codePointAt(i);
    if (!isPN_CHARS(codePoint) || (codePoint == '.' && i < (numberOfCodePoints - 1))) {
      logger.debug("PN_PREFIX was not valid (intermediate character invalid) i=" + i + " nextchar={} prefix={}",Character.toChars(codePoint),prefix);
      return false;
    }
    if (codePoint == '%' && (prefix.length() - i) < 2) {
      logger.debug("PN_PREFIX was not valid (percent encoding) i=" + i + " nextchar={} prefix={}",Character.toChars(codePoint),prefix);
      return false;
    }
    if (Character.isHighSurrogate((char)codePoint)) {
      i++;
    }
  }
  return true;
}

public static boolean isPN_PREFIX ( String prefix ) { if ( prefix . length ( ) == 0 ) { logger . debug ( "PN_PREFIX was not valid (empty)" ) ; return false ; } if ( ! isPN_CHARS_BASE ( prefix . charAt ( 0 ) ) ) { logger . debug ( "PN_PREFIX was not valid (start character invalid) i=0 nextchar={} prefix=" , prefix . charAt ( 0 ) , prefix ) ; return false ; } final int numberOfCodePoints = prefix . codePointCount ( 0 , prefix . length ( ) ) ; for ( int i = 1 ; i < numberOfCodePoints ; i ++ ) { final int codePoint = prefix . codePointAt ( i ) ; if ( ! isPN_CHARS ( codePoint ) || ( codePoint == '.' && i < ( numberOfCodePoints - 1 ) ) ) { logger . debug ( "PN_PREFIX was not valid (intermediate character invalid) i=" + i + " nextchar={} prefix={}" , Character . toChars ( codePoint ) , prefix ) ; return false ; } if ( codePoint == '%' && ( prefix . length ( ) - i ) < 2 ) { logger . debug ( "PN_PREFIX was not valid (percent encoding) i=" + i + " nextchar={} prefix={}" , Character . toChars ( codePoint ) , prefix ) ; return false ; } if ( Character . isHighSurrogate ( ( char ) codePoint ) ) { i ++ ; } } return true ; }
checks if the supplied prefix string is a valid turtle namespace prefix . from turtle spec : < p > http : / / www . w3 . org / tr / turtle / # grammar - production - pn_prefix < p > [ 167s ] pn_prefix : : = pn_chars_base ( ( pn_chars | ' . ' ) * pn_chars ) ?
