Package org.semanticweb.owlapi.reasoner

Examples of org.semanticweb.owlapi.reasoner.OWLReasoner


        // PelletReasonerFactory(); Load an example ontology - for the purposes
        // of the example, we will just load the pizza ontology.
        OWLOntologyManager man = OWLManager.createOWLOntologyManager();
        OWLOntology ont = loadPizza(man);
        // Create the reasoner and classify the ontology
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(ont);
        reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
        // To generate an inferred ontology we use implementations of inferred
        // axiom generators to generate the parts of the ontology we want (e.g.
        // subclass axioms, equivalent classes axioms, class assertion axiom
        // etc. - see the org.semanticweb.owlapi.util package for more
        // implementations). Set up our list of inferred axiom generators
View Full Code Here


        // the latest version of the Pellet libraries are on the runtime class
        // path
        OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
        // Uncomment the line below reasonerFactory = new
        // PelletReasonerFactory();
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(ont);
        // Now we can query the reasoner, suppose we want to determine the
        // properties that instances of Marghertia pizza must have
        OWLClass margheritaPizza = man.getOWLDataFactory().getOWLClass(
                IRI.create(prefix + "Quokka"));
        // printProperties(man, ont, reasoner, margheritaPizza);
View Full Code Here

        // We now add all subclasses (direct and indirect) of the chosen
        // classes. Ideally, it should be done using a DL reasoner, in order to
        // take inferred subclass relations into account. We are using the
        // structural reasoner of the OWL API for simplicity.
        Set<OWLEntity> seedSig = new HashSet<OWLEntity>();
        OWLReasoner reasoner = new StructuralReasoner(ont,
                new SimpleConfiguration(), BufferingMode.NON_BUFFERING);
        for (OWLEntity ent : sig) {
            seedSig.add(ent);
            if (OWLClass.class.isAssignableFrom(ent.getClass())) {
                NodeSet<OWLClass> subClasses = reasoner.getSubClasses(
                        (OWLClass) ent, false);
                seedSig.addAll(subClasses.getFlattened());
            }
        }
        // Output for debugging purposes
View Full Code Here

     *         the oWL exception
     */
    private boolean isSatisfiable(@Nonnull OWLClassExpression unsatClass)
            throws OWLException {
        createDebuggingOntology();
        OWLReasoner reasoner = getReasonerFactory().createNonBufferingReasoner(
                verifyNotNull(debuggingOntology));
        if (OntologyUtils.containsUnreferencedEntity(
                verifyNotNull(debuggingOntology), unsatClass)) {
            reasoner.dispose();
            return true;
        }
        satTestCount++;
        boolean sat = reasoner.isSatisfiable(unsatClass);
        reasoner.dispose();
        return sat;
    }
View Full Code Here

        assertEquals("Maximum number of asserted named superclasses",
                new MaximumNumberOfNamedSuperclasses(createOntology).getName());
        assertEquals("Number of classes with asserted multiple inheritance",
                new NumberOfClassesWithMultipleInheritance(createOntology)
                        .getName());
        OWLReasoner mock = mock(OWLReasoner.class);
        when(mock.getRootOntology()).thenReturn(createOntology);
        assertEquals("Unsatisfiable class count",
                new UnsatisfiableClassCountMetric(mock).getName());
    }
View Full Code Here

     * @throws OWLException
     *         the oWL exception
     */
    private boolean isSatisfiable() throws OWLException {
        createDebuggingOntology();
        OWLReasoner reasoner = reasonerFactory
                .createNonBufferingReasoner(getDebuggingOntology());
        satTestCount++;
        boolean sat = reasoner.isSatisfiable(verifyNotNull(currentClass));
        reasoner.dispose();
        return sat;
    }
View Full Code Here

     */
    private boolean isSatisfiable(OWLClassExpression unsatClass) throws OWLException {
        createDebuggingOntology();
        ontologyCounter++;

        OWLReasoner reasoner = getReasonerFactory().createNonBufferingReasoner(getOntology());

        if (OntologyUtils.containsUnreferencedEntity(debuggingOntology, unsatClass))
            return true;
        satTestCount++;
        boolean sat = reasoner.isSatisfiable(unsatClass);
        reasoner.dispose();
        return sat;
    }
View Full Code Here

        createDebuggingOntology();
//        RDFXMLRenderer ren = new RDFXMLRenderer();
//        ren.setOWLOntologyManager(owlOntologyManager);
//        ren.render(debuggingOntology, IRI.create("file:/Users/matthewhorridge/Desktop/DebuggingOntology" + ontologyCounter + ".owlapi"));
        ontologyCounter++;
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(debuggingOntology);
        satTestCount++;
        boolean sat = reasoner.isSatisfiable(currentClass);
        reasoner.dispose();
        return sat;
    }
View Full Code Here

    System.out.println("*******************");
    System.out.print(query.getTask() + ".....");
   
    double min = Double.MAX_VALUE;
    String reasonerName = "none";
    OWLReasoner reasoner;
    for(int i = 0; i < ReasonerPara.getReasonerCount(); i ++){
     
      try{
        reasoner = reasonerManager.getReasoner(i, ontology);
      }catch(ReasonerInternalException e){
        continue;
      }catch(UnsupportedDatatypeException e){
        continue;
      }
     
      double tmp = runtimeTest(reasoner, query);
      if(tmp < min){
        min = tmp;
        reasonerName = reasoner.getReasonerName();
      }
    }
    Result<Object> result = new Result<Object>();
    result.setReasoner(reasonerName);
   
View Full Code Here

  public Factpp(){
    factory = new FaCTPlusPlusReasonerFactory();
  }
 
  public OWLReasoner getReasoner(OWLOntology ontology){
    OWLReasoner reasoner = factory.createReasoner(ontology);
    return reasoner;
  }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.reasoner.OWLReasoner

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.