From: <lor...@us...> - 2011-11-01 21:36:42
|
Revision: 3354 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3354&view=rev Author: lorenz_b Date: 2011-11-01 21:36:36 +0000 (Tue, 01 Nov 2011) Log Message: ----------- Solved problem with missing axioms, caused by missing import declarations. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-01 18:59:35 UTC (rev 3353) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-11-01 21:36:36 UTC (rev 3354) @@ -147,6 +147,8 @@ Set<OWLOntology> allImports = new HashSet<OWLOntology>(); prefixes = new TreeMap<String, String>(); + + Set<OWLImportsDeclaration> directImports = new HashSet<OWLImportsDeclaration>(); for (AbstractKnowledgeSource source : sources) { @@ -169,6 +171,7 @@ } owlAPIOntologies.add(ontology); + directImports.addAll(ontology.getImportsDeclarations()); try { // imports includes the ontology itself //FIXME this line throws the strange error @@ -227,6 +230,12 @@ } try { ontology = manager.createOntology(IRI.create("http://dl-learner/all"), new HashSet<OWLOntology>(owlAPIOntologies)); + //we have to add all import declarations manually here, because this are no axioms + List<OWLOntologyChange> addImports = new ArrayList<OWLOntologyChange>(); + for(OWLImportsDeclaration i : directImports){ + addImports.add(new AddImport(ontology, i)); + } + manager.applyChanges(addImports); } catch (OWLOntologyCreationException e1) { e1.printStackTrace(); } @@ -251,8 +260,7 @@ reasoner = new ReasonerFactory().createNonBufferingReasoner(ontology, conf); } else if (getReasonerTypeString().equals("pellet")) { // instantiate Pellet reasoner - reasoner = PelletReasonerFactory.getInstance().createNonBufferingReasoner(ontology, conf); - + reasoner = PelletReasonerFactory.getInstance().createNonBufferingReasoner(owlAPIOntologies.iterator().next(), conf); // change log level to WARN for Pellet, because otherwise log // output will be very large Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |