1 6 package com.hp.hpl.jena.reasoner.rulesys.impl; 7 8 import com.hp.hpl.jena.rdf.model.*; 9 import com.hp.hpl.jena.reasoner.*; 10 import com.hp.hpl.jena.util.FileManager; 11 import com.hp.hpl.jena.vocabulary.JenaModelSpec; 12 13 19 public final class WrappedReasonerFactory implements ReasonerFactory 20 { 21 protected final ReasonerFactory factory; 22 protected final Resource config; 23 24 protected final Model schemaUnion = ModelFactory.createDefaultModel(); 25 26 public WrappedReasonerFactory( ReasonerFactory rrf, Resource config ) 27 { super(); 28 this.factory = rrf; 29 this.config = config; 30 loadSchemas( schemaUnion, config ); } 31 32 37 public Reasoner create( Resource ignored ) 38 { Reasoner result = factory.create( config ); 39 return schemaUnion.isEmpty() ? result : result.bindSchema( schemaUnion ); } 40 41 private static Model loadSchemas( Model schema, Resource R ) 42 { 43 StmtIterator schemas = R.listProperties( JenaModelSpec.schemaURL ); 44 while (schemas.hasNext()) 45 { 46 Statement s = schemas.nextStatement(); 47 Resource sc = s.getResource(); 48 FileManager.get().readModel( schema, sc.getURI() ); 49 } 50 return schema; 51 } 52 53 56 public Model getCapabilities() 57 { return factory.getCapabilities(); } 58 59 62 public String getURI() 63 { return factory.getURI(); } 64 } 65 66 | Popular Tags |