From: <hee...@us...> - 2008-06-10 15:08:27
|
Revision: 952 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=952&view=rev Author: heeroyuy Date: 2008-06-10 08:08:22 -0700 (Tue, 10 Jun 2008) Log Message: ----------- -modified init() to accept OWLAPIOntology Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-10 15:07:29 UTC (rev 951) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-10 15:08:22 UTC (rev 952) @@ -58,6 +58,7 @@ import org.dllearner.core.owl.TypedConstant; import org.dllearner.core.owl.UntypedConstant; import org.dllearner.kb.OWLFile; +import org.dllearner.kb.OWLAPIOntology; import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.RoleComparator; @@ -182,7 +183,7 @@ for(KnowledgeSource source : sources) { - if(source instanceof OWLFile || source instanceof SparqlKnowledgeSource ) { + if(source instanceof OWLFile || source instanceof SparqlKnowledgeSource || source instanceof OWLAPIOntology) { URL url=null; if(source instanceof OWLFile){ url = ((OWLFile)source).getURL(); @@ -192,6 +193,30 @@ } try { + if(source instanceof OWLAPIOntology) + { + System.out.println(source instanceof OWLAPIOntology); + System.out.println("JUHU es geht"); + OWLOntology ontology = ((OWLAPIOntology)source).getOWLOntolgy(); + owlAPIOntologies.add(ontology); + allImports.addAll(manager.getImportsClosure(ontology)); + classes.addAll(ontology.getReferencedClasses()); + owlObjectProperties.addAll(ontology.getReferencedObjectProperties()); + owlDatatypeProperties.addAll(ontology.getReferencedDataProperties()); + owlIndividuals.addAll(ontology.getReferencedIndividuals()); + + // TODO: this obviously works only for exactly one knowledge source + OWLOntologyFormat format = manager.getOntologyFormat(ontology); + if(format instanceof NamespaceOWLOntologyFormat) + { + prefixes = ((NamespaceOWLOntologyFormat)format).getNamespacesByPrefixMap(); + baseURI = prefixes.get(""); + prefixes.remove(""); + } + } + else + { + System.out.println(":'S"); OWLOntology ontology = manager.loadOntologyFromPhysicalURI(url.toURI()); owlAPIOntologies.add(ontology); allImports.addAll(manager.getImportsClosure(ontology)); @@ -207,8 +232,10 @@ baseURI = prefixes.get(""); prefixes.remove(""); } + } - } catch (OWLOntologyCreationException e) { + } + catch (OWLOntologyCreationException e) { e.printStackTrace(); } catch (URISyntaxException e) { e.printStackTrace(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |