From: <lor...@us...> - 2008-04-22 13:31:55
|
Revision: 808 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=808&view=rev Author: lorenz_b Date: 2008-04-22 06:31:50 -0700 (Tue, 22 Apr 2008) Log Message: ----------- added method moveIndividual() to class ORE Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-04-22 13:26:06 UTC (rev 807) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-04-22 13:31:50 UTC (rev 808) @@ -180,6 +180,7 @@ OWLDescription newConceptOWLAPI = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc); OWLDescription oldConceptOWLAPI = OWLAPIDescriptionConvertVisitor.getOWLDescription(concept); + OWLOntology ontology = reasoner.getOWLAPIOntologies().get(0); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); @@ -192,7 +193,6 @@ OWLAxiom axiomOWLAPI = factory.getOWLEquivalentClassesAxiom(ds); - AddAxiom axiom = new AddAxiom(ontology, axiomOWLAPI); try { @@ -214,9 +214,6 @@ public void deleteIndividual(Individual ind){ - - - OWLOntology ontology = reasoner.getOWLAPIOntologies().get(0); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); @@ -244,10 +241,52 @@ } remover.reset(); - + try { + manager.saveOntology(ontology); + } catch (UnknownOWLOntologyException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLOntologyStorageException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + public void moveIndividual(Individual ind, Description oldDescription, Description newDescription){ + + OWLOntology ontology = reasoner.getOWLAPIOntologies().get(0); + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLDataFactory factory = manager.getOWLDataFactory(); + OWLIndividual individualOWLAPI = null; + + + try { + individualOWLAPI = factory.getOWLIndividual( new URI(ind.getName())); + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + //Loeschen + OWLEntityRemover remover = new OWLEntityRemover(manager, Collections.singleton(ontology)); + individualOWLAPI.accept(remover); + + try { + manager.applyChanges(remover.getChanges()); + } catch (OWLOntologyChangeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + remover.reset(); + + //Hinzufuegen + + } + + public static void main(String[] args){ @@ -262,7 +301,6 @@ System.err.println("Concepts :" + rs.getAtomicConcepts()); - test.setConcept(new NamedClass("http://example.com/father#father")); test.setPosNegExamples(); System.out.println(test.posExamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |