/** Use the prefix map to turn a URI into a qname, or return the original URI */ public String shortForm(String uri) { return prefixMap.shortForm(uri) ; } }
/** Answer a String representing the node, taking into account the PrefixMapping. The horrible test against null is a stopgap to avoid a circularity issue. TODO fix the circularity issue */ @Override public String toString( PrefixMapping pm, boolean quoting ) { return pm == null ? (String) label : pm.shortForm( (String) label ); }
/** Use the prefix map to turn a URI into a qname, or return the original URI */ public String shortForm(String uri) { return prefixMap.shortForm(uri) ; }
@Override public String shortForm(String uri) { return this.prefixes.shortForm(uri); }
protected String rangeType( PrefixMapping pm, String uri ) { if (uri == null) return "unspecified"; return pm.shortForm( uri ); }
private String linkFor(PrefixMapping pm, String uri) { return "<a href='" + uri + "'>" + pm.shortForm( uri ) + "</a>"; }
public String forceShorten( String uri ) { String shorter = allPrefixes.shortForm( uri ); return shorter.equals( uri ) ? null : shorter.replace( ':', '_' ); }
protected static String shortForm( PrefixMapping pm, Resource r ) { return pm.shortForm( r.getURI() ); }
@Override public String shortForm( String uri ) { return getPrefixMapping().shortForm( uri ); }
/** Compress the URI using the prefix mapping. This version of the code looks through all the maplets and checks each candidate prefix URI for being a leading substring of the argument URI. There's probably a much more efficient algorithm available, preprocessing the prefix strings into some kind of search table, but for the moment we don't need it. */ @Override public String shortForm( String uri ) { String s = getBaseMapping().shortForm( uri ); if (s.equals( uri )) { List<Graph> graphs = poly.getSubGraphs(); for (int i = 0; i < graphs.size(); i += 1) { String ss = graphs.get(i).getPrefixMapping().shortForm( uri ); if (!ss.equals( uri )) return ss; } } return s; }
private void node(Node n) { if ( ! n.isURI() ) return ; String uri = n.getURI() ; if ( usedPMap.shortForm(uri) != uri ) return ; for ( Iterator<Map.Entry<String, String>> iter = pmap.entrySet().iterator() ; iter.hasNext() ; ) { Map.Entry<String, String> e = iter.next(); String k = e.getKey() ; String v = e.getValue() ; if ( uri.startsWith(v) ) { usedPMap.setNsPrefix(k, v) ; return ; } } } }
protected void recordAltName(String uri, PrefixMapping pm) { // Note local name recordAltName( getLocalName(uri), uri ); // Note prefixed name String sf = pm.shortForm(uri); if (!sf.equals( uri )) recordAltName( sf.replace(':', '_'), uri ); }
private void node(Node n) { if ( ! n.isURI() ) return ; String uri = n.getURI() ; if ( usedPMap.shortForm(uri) != uri ) return ; for ( Iterator<Map.Entry<String, String>> iter = pmap.entrySet().iterator() ; iter.hasNext() ; ) { Map.Entry<String, String> e = iter.next(); String k = e.getKey() ; String v = e.getValue() ; if ( uri.startsWith(v) ) { usedPMap.setNsPrefix(k, v) ; return ; } } } }
String lf = v.spelling() == null ? "<i>none</i>" : v.spelling(); String type = v.type().length() > 0 ? pm.shortForm( v.type() ) : v.lang().length() > 0 ? v.lang() : ""
private static String prefixFor(String uri, PrefixMapping mapping) { if ( mapping == null ) return null ; String pname = mapping.shortForm(uri) ; if ( pname != uri && checkValidPrefixName(pname) ) return pname ; pname = mapping.qnameFor(uri) ; if ( pname != null && checkValidPrefixName(pname) ) return pname ; return null ; }
private static String prefixFor(String uri, PrefixMapping mapping) { if ( mapping == null ) return null ; String pname = mapping.shortForm(uri) ; if ( pname != uri && checkValidPrefixName(pname) ) return pname ; pname = mapping.qnameFor(uri) ; if ( pname != null && checkValidPrefixName(pname) ) return pname ; return null ; }