@Override protected PrefixMapping createPrefixMapping() { // TODO Unsatisfactory - need PrefixMap support by DSGs then PrefixMap -> PrefixMapping return new PrefixMappingImpl() ; }
/** Answer this PrefixMapping after updating it with the <code>(p, u)</code> mappings in <code>other</code> where neither <code>p</code> nor <code>u</code> appear in this mapping. */ @Override public PrefixMapping withDefaultMappings( PrefixMapping other ) { checkUnlocked(); for (Entry<String, String> e: other.getNsPrefixMap().entrySet()) { String prefix = e.getKey(), uri = e.getValue(); if (getNsPrefixURI( prefix ) == null && getNsURIPrefix( uri ) == null) setNsPrefix( prefix, uri ); } return this; }
@Override public PrefixMapping setNsPrefix( String prefix, String uri ) { checkUnlocked(); checkLegal( prefix ); if (!prefix.equals( "" )) checkProper( uri ); if (uri == null) throw new NullPointerException( "null URIs are prohibited as arguments to setNsPrefix" ); set( prefix, uri ); return this; }
@Override public String getNsURIPrefix( String uri ) { String x = super.getNsURIPrefix(uri) ; if ( x != null ) return x ; // Do a reverse read. x = prefixes.readByURI(graphName, uri) ; if ( x != null ) super.set(x, uri) ; return x ; }
@Override public PrefixMapping removeNsPrefix(String prefix) { String uri = super.getNsPrefixURI(prefix) ; if ( uri != null ) prefixes.removeFromPrefixMap(graphName, prefix, uri) ; super.removeNsPrefix(prefix) ; return this ; } }
@Override public Map<String, String> getNsPrefixMap() { Map<String, String> m = prefixes.readPrefixMap(graphName) ; // Force into the cache for ( Entry<String, String> e : m.entrySet() ) super.set(e.getKey(), e.getValue()) ; return m ; }
@Override public String getNsPrefixURI( String prefix ) { return get( prefix ); }
@Override public String getNsURIPrefix( String uri ) { String x = super.getNsURIPrefix(uri) ; if ( x != null ) return x ; // Do a reverse read. x = prefixes.readByURI(graphName, uri) ; if ( x != null ) super.set(x, uri) ; return x ; }
@Override public PrefixMapping removeNsPrefix(String prefix) { String uri = super.getNsPrefixURI(prefix) ; if ( uri != null ) prefixes.removeFromPrefixMap(graphName, prefix) ; super.removeNsPrefix(prefix) ; return this ; } }
@Override public Map<String, String> getNsPrefixMap() { Map<String, String> m = prefixes.readPrefixMap(graphName) ; // Force into the cache for ( Entry<String, String> e : m.entrySet() ) super.set(e.getKey(), e.getValue()) ; return m ; }
/** Expand a prefixed URI. There's an assumption that any URI of the form Head:Tail is subject to mapping if Head is in the prefix mapping. So, if someone takes it into their heads to define eg "http" or "ftp" we have problems. */ @Override public String expandPrefix( String prefixed ) { int colon = prefixed.indexOf( ':' ); if (colon < 0) return prefixed; else { String uri = get( prefixed.substring( 0, colon ) ); return uri == null ? prefixed : uri + prefixed.substring( colon + 1 ); } }
public PrefixMapping2(PrefixMapping globalMapping) { this(globalMapping, new PrefixMappingImpl()) ; }
@Override protected void set(String prefix, String uri) { // Delete old one if present and different. String x = get(prefix) ; if ( x != null ) { if(x.equals(uri)) // Already there - no-op (thanks to Eric Diaz for pointing this out) return; // Remove from cache. prefixes.removeFromPrefixMap(graphName, prefix, x) ; } // Persist prefixes.insertPrefix(graphName, prefix, uri) ; // Add to caches. super.set(prefix, uri) ; }
public PrefixMapping2(PrefixMapping globalMapping) { this(globalMapping, new PrefixMappingImpl()) ; }
@Override protected void set(String prefix, String uri) { // Delete old one if present and different. String x = get(prefix) ; if ( x != null ) { if(x.equals(uri)) // Already there - no-op (thanks to Eric Diaz for pointing this out) return; // Remove from cache. prefixes.removeFromPrefixMap(graphName, prefix) ; } // Persist prefixes.insertPrefix(graphName, prefix, uri) ; // Add to caches. super.set(prefix, uri) ; }
public Prologue() { prefixMap = new PrefixMappingImpl() ; }
protected PrefixMapping createPrefixMapping() { return new PrefixMappingImpl() ; }
public Prologue() { prefixMap = new PrefixMappingImpl() ; }