1 18 19 package com.hp.hpl.jena.ontology.daml.impl; 22 23 24 import java.util.*; 27 28 import com.hp.hpl.jena.ontology.daml.*; 29 import com.hp.hpl.jena.vocabulary.*; 30 31 32 33 34 44 public class DAMLLoader 45 { 46 49 50 51 52 53 public static final String FILE_URI_PREFIX = "file://"; 54 55 56 57 58 public static final long STATUS_OK = 0L; 59 60 61 public static final long STATUS_INPUT_UNAVAILABLE = 1L; 62 63 64 public static final long STATUS_IO_ERROR = 2L; 65 66 67 public static final long STATUS_SYNTAX_ERROR = 4L; 68 69 70 public static final long STATUS_MISC_ERROR = 8L; 71 72 73 76 77 78 81 82 private long m_status = STATUS_OK; 83 84 85 private DAMLModel m_damlModel = null; 86 87 88 private List m_importBlockList = new ArrayList(); 89 90 91 private boolean m_useImportBlocking = true; 92 93 94 97 102 DAMLLoader( DAMLModel m ) { 103 m_damlModel = m; 104 105 initialiseImportBlockList(); 107 } 108 109 110 113 114 119 public DAMLModel getDAMLModel() { 120 return m_damlModel; 121 } 122 123 124 140 protected void initialiseImportBlockList() { 141 m_importBlockList.add( DAMLVocabulary.NAMESPACE_DAML_2000_12_URI ); 142 m_importBlockList.add( DAMLVocabulary.NAMESPACE_DAML_2001_03_URI ); 143 m_importBlockList.add( RDFS.getURI() ); 144 } 145 146 147 154 public Iterator getImportBlockList() { 155 return m_importBlockList.iterator(); 156 } 157 158 159 168 public boolean isBlockedImport( String uri ) { 169 return m_useImportBlocking && m_importBlockList.contains( uri ); 170 } 171 172 173 179 public void addImportBlock( String uri ) { 180 if (!m_importBlockList.contains( uri )) { 182 m_importBlockList.add( uri ); 183 } 184 } 185 186 187 194 public void removeImportBlock( String uri ) { 195 m_importBlockList.remove( uri ); 196 } 197 198 199 205 public boolean getLoadImportedOntologies() { 206 return m_damlModel.getDocumentManager().getProcessImports(); 207 } 208 209 210 217 public void setLoadImportedOntologies( boolean loadImports ) { 218 m_damlModel.getDocumentManager().setProcessImports( loadImports ); 219 } 220 221 222 231 public void setUseImportBlocking( boolean useBlocking ) { 232 m_useImportBlocking = useBlocking; 233 } 234 235 236 242 public boolean getUseImportBlocking() { 243 return m_useImportBlocking; 244 } 245 246 247 253 public boolean isLoadedOntology( String uri ) { 254 return m_damlModel.hasLoadedImport( uri ); 255 } 256 257 258 259 265 public long getStatus() { 266 return m_status; 267 } 268 269 270 273 public void resetStatus() { 274 m_status = STATUS_OK; 275 } 276 277 278 279 282 283 284 288 289 } 290 291 317 318 | Popular Tags |