Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.AddAxiom


        List<AddAxiom> changes = new ArrayList<>();
        for (OWLOntology ont : owlOntologyManager
                .getImportsClosure(originalOntology)) {
            for (OWLAxiom ax : ont.getLogicalAxioms()) {
                assert ax != null;
                changes.add(new AddAxiom(ontology, ax));
            }
        }
        owlOntologyManager.applyChanges(changes);
    }
View Full Code Here


                }
            }
            // Back track - go one level up the tree and run for the next axiom
            currentPathContents.remove(axiom);
            // Done with the axiom that was removed. Add it back in
            owlOntologyManager.applyChange(new AddAxiom(ontology, axiom));
        }
    }
View Full Code Here

            operands.add(cls);
            temporaryAxioms.add(owlOntologyManager.getOWLDataFactory()
                    .getOWLEquivalentClassesAxiom(operands));
            for (OWLAxiom ax : temporaryAxioms) {
                assert ax != null;
                owlOntologyManager.applyChange(new AddAxiom(getOWLOntology(),
                        ax));
            }
            return curCls;
        }
    }
View Full Code Here

        debuggingOntology = owlOntologyManager.createOntology(iri);
        owlOntologyManager.getIRIMappers().remove(mapper);
        List<AddAxiom> changes = new ArrayList<>();
        for (OWLAxiom ax : debuggingAxioms) {
            assert ax != null;
            changes.add(new AddAxiom(getDebuggingOntology(), ax));
        }
        for (OWLAxiom ax : temporaryAxioms) {
            assert ax != null;
            changes.add(new AddAxiom(getDebuggingOntology(), ax));
        }
        // Ensure the ontology contains the signature of the class which is
        // being debugged
        OWLDataFactory factory = owlOntologyManager.getOWLDataFactory();
        OWLAxiom ax = factory.getOWLSubClassOfAxiom(
                verifyNotNull(currentClass), factory.getOWLThing());
        changes.add(new AddAxiom(getDebuggingOntology(), ax));
        owlOntologyManager.applyChanges(changes);
    }
View Full Code Here

        }
        return CollectionFactory.emptyList();
    }

    protected AddAxiom addDeclaration(@Nonnull OWLEntity e) {
        return new AddAxiom(ontology, df.getOWLDeclarationAxiom(e));
    }
View Full Code Here

        if (axiom == null) {
            LOG.error("no axiom");
            return;
        }
        // System.out.println("adding:"+axiom);
        AddAxiom addAx = new AddAxiom(outputOntology, axiom);
        try {
            outputManager.applyChange(addAx);
        } catch (Exception e) {
            LOG.error("COULD NOT TRANSLATE AXIOM", e);
        }
View Full Code Here

    // peform ABox addition which results in a consistent KB
    OWLClass concept = factory.getOWLClass( IRI.create( mindswap + "GraduateStudent" ) );
    OWLNamedIndividual individual = factory
        .getOWLNamedIndividual( IRI.create( mindswappers + "JohnDoe" ) );
    manager.applyChange( new AddAxiom( ontology, factory.getOWLClassAssertionAxiom( concept, individual ) ) );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = reasoner.isConsistent();
    e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );

    // peform ABox addition which results in an inconsistent KB
    OWLObjectProperty role = factory.getOWLObjectProperty( IRI.create( foaf + "mbox" ) );
    individual = factory.getOWLNamedIndividual( IRI.create( mindswappers + "Christian.Halaschek" ) );
    OWLNamedIndividual mbox = factory.getOWLNamedIndividual( IRI.create( "mailto:kolovski@cs.umd.edu" ) );
    manager.applyChange( new AddAxiom( ontology, factory.getOWLObjectPropertyAssertionAxiom(
        role, individual, mbox ) ) );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = reasoner.isConsistent();
View Full Code Here

    OWLAxiom axiom = OWL.subClassOf( headache, pain );

    // Add the axiom to the ontology
    // The copy of the classifier in memory, will receive the notification about this change.
    // However, the state of the classifier saved to the file will become out-of-sync at this point
    OWL.manager.applyChange( new AddAxiom( ontology, axiom ) );

   
    // Now let's restore the classifier from the saved file
    IncrementalClassifier restoredClassifier = null;
   
View Full Code Here

    Object[] entities = ontologyTBox.getClassesInSignature().toArray();
   
    Set<OWLAxiom> axiomsFromABox = ontologyABox.getAxioms();
    for(OWLAxiom axiom: axiomsFromABox)
    {
      OWL.manager.applyChange( new AddAxiom( ontologyTBox, axiom ) );
    }
   
    PelletReasoner reasoner = com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.getInstance().createReasoner( ontologyTBox );
   
    System.out.println("Entities:");
    for(int i=0; i< entities.length; i++)
    {
      OWLClass obj = (OWLClass) entities[i];
      String name = obj.toStringID();
      System.out.println("Class:  " + name.substring(name.indexOf("#")+1));
     
      // get all instances of Person class
      Set<OWLNamedIndividual> individuals = reasoner.getInstances( obj, false ).getFlattened();
      for(OWLNamedIndividual ind : individuals) {
        System.out.println("Individual: " + ind.toString());
      }
      System.out.println("---------------------------");
    }
     
    /*IncrementalClassifier classifier = new IncrementalClassifier( ontologyTBox );
    classifier.classify()
    classifier.getSubCl*/
   
    //Object[] axioms = ontology.getAxioms().toArray();
    /*System.out.println("Axioms:");
    for(int i=0; i < 10; i++)
    {
      OWLAxiom axiom = (OWLAxiom) axioms[i];
      System.out.println(axiom.toString());
    }*/
   
   
   
   
    // Get some entities
    OWLClass headache = OWL.Class( NS + "Mesoscale" );
    OWLClass pain = OWL.Class( NS + "SynopticScale" );
   
    // Get an instance of the incremental classifier
    IncrementalClassifier classifier = new IncrementalClassifier( ontologyTBox );

    // We need some timing to show the performance of the classification
    Timers timers = new Timers();

    // We classify the ontology and use a specific timer to keep track of
    // the time required for the classification
    Timer t = timers.createTimer( "First classification" );
    t.start();
    classifier.classify();
    t.stop();
       
    System.out.println( "\nClassification time: " + t.getTotal() + "ms");
    System.out.println( "Subclasses of " + pain + ": " + classifier.getSubClasses( pain, true ).getFlattened() + "\n");
   
    // Now create a new OWL axiom, subClassOf(Headache, Pain)
    OWLAxiom axiom = OWL.subClassOf( headache, pain );

    // Add the axiom to the ontology, which creates a change event
    OWL.manager.applyChange( new AddAxiom( ontologyTBox, axiom ) );

    // Now we create a second timer to keep track of the performance of the
    // second classification
    t = timers.createTimer("Second classification");
    t.start();
View Full Code Here


    public void handle(String id, String value) {
        if (getConsumer().isTerm()) {
            // We simply add a subclass axiom
            applyChange(new AddAxiom(getOntology(), getDataFactory().getOWLSubClassOfAxiom(
                    getClassFromId(id),
                    getClassFromId(value))
            ));
        } else if (getConsumer().isTypedef()) {
            // We simply add a sub property axiom
            applyChange(new AddAxiom(getOntology(), getDataFactory().getOWLSubObjectPropertyOfAxiom(
                    getOWLObjectProperty(id),
                    getOWLObjectProperty(value))
            ));
        }
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.AddAxiom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.