1 6 7 package com.hp.hpl.jena.db.impl; 8 9 import com.hp.hpl.jena.shared.PrefixMapping; 10 import com.hp.hpl.jena.shared.impl.PrefixMappingImpl; 11 12 import java.util.*; 13 14 24 public class DBPrefixMappingImpl extends PrefixMappingImpl { 25 26 protected DBPropGraph m_graphProperties = null; 27 28 41 public DBPrefixMappingImpl( DBPropGraph graphProperties) { 42 super(); 43 m_graphProperties = graphProperties; 44 45 Iterator it = m_graphProperties.getAllPrefixes(); 48 while( it.hasNext()) { 49 DBPropPrefix prefix = (DBPropPrefix)it.next(); 50 super.setNsPrefix( prefix.getValue(), prefix.getURI() ); 51 } 52 } 53 54 public PrefixMapping removeNsPrefix( String prefix ) 55 { 56 String uri = getNsPrefixURI( prefix ); 57 super.removeNsPrefix( prefix ); 58 if (uri != null) m_graphProperties.removePrefix( prefix ); 59 return this; 60 } 61 62 67 public PrefixMapping setNsPrefix(String prefix, String uri) { 68 super.setNsPrefix(prefix, uri); 74 75 m_graphProperties.addPrefix(prefix, uri); 79 return this; 80 } 81 82 86 public PrefixMapping setNsPrefixes(PrefixMapping other) { 87 return setNsPrefixes(other.getNsPrefixMap()); 88 } 89 90 94 public PrefixMapping setNsPrefixes(Map other) { 95 checkUnlocked(); 96 Iterator it = other.entrySet().iterator(); 97 while (it.hasNext()) { 98 Map.Entry e = (Map.Entry) it.next(); 99 setNsPrefix((String ) e.getKey(), (String ) e.getValue()); 100 } 101 return this; 102 } 103 } 104 105 | Popular Tags |