@Override public String getNameSpace() { String s = (String) label; return s.substring( 0, Util.splitNamespace( s ) ); }
/** Call System.getProperty and suppresses SecurityException, (simply returns null). *@return The property value, or null if none or there is a SecurityException. */ public static String XgetProperty(String p) { return XgetProperty( p, null ); } /** Call System.getProperty and suppresses SecurityException, (simply returns null).
public static boolean isNiceURI( String uri ) { if (uri.equals( "" )) return false; char last = uri.charAt( uri.length() - 1 ); return Util.notNameChar( last ); }
protected String substitutedAttribute( String s ) { String substituted = Util.substituteStandardEntities( s ); if (!showDoctypeDeclaration.booleanValue()) return attributeQuoted( substituted ); else { int split = Util.splitNamespace( substituted ); String namespace = substituted.substring( 0, split ); String prefix = modelPrefixMapping.getNsURIPrefix( namespace ); return prefix == null || isPredefinedEntityName( prefix ) ? attributeQuoted( substituted ) : attributeQuoted( "&" + strForPrefix(prefix) + ";" + substituted.substring( split ) ) ; } }
public static String substituteStandardEntities( String s ) { if (standardEntities.matcher( s ).find()) { return substituteEntitiesInElementContent( s ) .replaceAll( "'", "'" ) .replaceAll( "\t","	" ) .replaceAll( "\n", "
" ) .replaceAll( "\r", "
" ) .replaceAll( "\"", """ ) ; } else return s; }
private void generateDoctypeDeclaration( Model model, PrintWriter pw ) { String rdfns = RDF.getURI(); String rdfRDF = model.qnameFor( rdfns + "RDF" ); if ( rdfRDF == null ) { model.setNsPrefix("rdf",rdfns); rdfRDF = "rdf:RDF"; } Map<String, String> prefixes = model.getNsPrefixMap(); pw.print( "<!DOCTYPE " + rdfRDF +" [" ); for (Iterator<String> it = prefixes.keySet().iterator(); it.hasNext();) { String prefix = it.next(); if (isPredefinedEntityName( prefix ) ) continue ; pw.print( newline + " <!ENTITY " + strForPrefix(prefix) + " '" + Util.substituteEntitiesInEntityValue(prefixes.get( prefix )) + "'>" ); } pw.print( "]>" + newline ); }
private void wValueString(Literal lt) { String val = lt.getString(); print(Util.substituteEntitiesInElementContent(val)); }
public static String getLocalName( String uri ) { int split = Util.splitNamespace(uri); return uri.substring(split); } }
protected void writeLiteral( Literal l, PrintWriter writer ) { String lang = l.getLanguage(); String form = l.getLexicalForm(); if (!lang.equals("")) { writer.print(" xml:lang=" + attributeQuoted( lang )); } if (l.isWellFormedXML() && !blockLiterals) { writer.print(" " + rdfAt("parseType") + "=" + attributeQuoted( "Literal" )+">"); writer.print( form ); } else { String dt = l.getDatatypeURI(); if (dt != null) writer.print( " " + rdfAt( "datatype" ) + "=" + substitutedAttribute( dt ) ); writer.print(">"); writer.print( Util.substituteEntitiesInElementContent( form ) ); } }
for ( ; i >= 1 ; i--) { ch = uri.charAt(i); if (notNameChar(ch)) break;
@Override public String getLocalName() { String s = (String) label; return s.substring( Util.splitNamespace( s ) ); }
private boolean wPropertyEltDatatype(WType wt, Property prop, Statement s, RDFNode r) { if (!((r instanceof Literal) && ((Literal) r).getDatatypeURI() != null)) { return false; } // print out. done(s); tab(); print("<"); wt.wTypeStart(prop); wIdAttrReified(s); maybeNewline(); wDatatype(((Literal) r).getDatatypeURI()); maybeNewline(); print(">"); print(Util.substituteEntitiesInElementContent(((Literal) r) .getLexicalForm())); print("</"); wt.wTypeEnd(prop); print(">"); return true; }
public static String getNameSpace( String uri ) { int split = Util.splitNamespace(uri); return uri.substring(0, split); }
public static String localName( String uri ) { return uri.substring( Util.splitNamespace( uri ) ); }
public static String nameSpace( String uri ) { return uri.substring( 0, Util.splitNamespace( uri ) ); }
protected String getLocalName(String uri) { return uri.substring( Util.splitNamespace( uri )); }
/** Answer the qname for <code>uri</code> which uses a prefix from this mapping, or null if there isn't one. <p> Relies on <code>splitNamespace</code> to carve uri into namespace and localname components; this ensures that the localname is legal and we just have to (reverse-)lookup the namespace in the prefix table. @see com.hp.hpl.jena.shared.PrefixMapping#qnameFor(java.lang.String) */ @Override public String qnameFor( String uri ) { int split = Util.splitNamespace( uri ); String ns = uri.substring( 0, split ), local = uri.substring( split ); if (local.equals( "" )) return null; String prefix = URItoPrefix.get( ns ); return prefix == null ? null : prefix + ":" + local; }
static SplitURI create(String uri) { int cut = splitNamespace( uri ); String ns = uri.substring( 0, cut ); String ln = uri.substring( cut ); return new SplitURI(uri, ns, ln); }
String splitTag(String uriref, int type) { int split = Util.splitNamespace( uriref ); if (split == uriref.length()) throw new InvalidPropertyURIException( uriref ); return tag( uriref.substring( 0, split ), uriref.substring( split ), type, true ); }
private void updateNamespace( Set<String> set, Iterator<Node> it ) { while (it.hasNext()) { Node node = it.next(); if (node.isURI()) { String uri = node.getURI(); String ns = uri.substring( 0, Util.splitNamespace( uri ) ); // String ns = IteratorFactory.asResource( node, this ).getNameSpace(); set.add( ns ); } } }