1 5 6 package com.hp.hpl.jena.rdf.arp; 7 8 import org.xml.sax.*; 9 10 import com.hp.hpl.jena.rdf.model.*; 11 import com.hp.hpl.jena.shared.*; 12 import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler; 13 14 22 public class SAX2Model extends SAX2RDF { 23 34 static public SAX2Model newInstance(String base, Model m) throws MalformedURIException { 35 return new SAX2Model(base,m,""); 36 } 37 55 static public SAX2Model newInstance(String base, Model m, String lang) throws MalformedURIException { 56 return new SAX2Model(base,m,lang); 57 } 58 80 public void startPrefixMapping (String prefix, String uri) 81 { super.startPrefixMapping(prefix,uri); 82 } 83 84 private RDFErrorHandler errorHandler = new RDFDefaultErrorHandler(); 85 86 final private JenaHandler handler; 87 88 protected SAX2Model(String base, Model m, String lang) throws MalformedURIException { 89 super(base,lang); 90 handler = new JenaHandler(m,errorHandler); 91 handler.useWith(getHandlers()); 92 } 93 private boolean closed = false; 94 public void close() throws SAXException{ 95 if (!closed) { 97 super.close(); 98 handler.bulkUpdate(); 99 closed = true; 100 } 101 } 102 113 public RDFErrorHandler setErrorHandler(RDFErrorHandler errHandler) { 114 RDFErrorHandler old = this.errorHandler; 115 this.errorHandler = errHandler; 116 if (handler != null) { 117 handler.setErrorHandler(errHandler); 118 } 119 return old; 120 } 121 214 public Object setProperty(String str, Object value) throws JenaException { 215 Object obj = value; 216 if (str.startsWith("http:")) { 217 if (str.startsWith(JenaReader.arpPropertiesURL)) { 218 str = str.substring(JenaReader.arpPropertiesURLLength); 219 } 220 } 221 return setArpProperty(str, obj); 222 } 223 private Object setArpProperty( String str, Object v) { 224 return JenaReader.setArpProperty(getOptions(),str,v,errorHandler); 225 } 226 } 227 228 229 255 256 | Popular Tags |