예제 #1
0
 public void classifyOntology(OWLOntology ontology, OWLReasonerFactory factory) {
   ToStringRenderer.getInstance().setRenderer(new ManchesterOWLSyntaxOWLObjectRendererImpl());
   OWLReasoner reasoner = factory.createNonBufferingReasoner(ontology);
   // reasoner.precomputeInferences(InferenceType.values());
   long time = System.currentTimeMillis();
   boolean isConsistent = reasoner.isConsistent();
   int numOfUnsatClasses = reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size();
   time = System.currentTimeMillis() - time;
   DLExpressivityChecker checker = new DLExpressivityChecker(Collections.singleton(ontology));
   String e = checker.getDescriptionLogicName();
   String name = ontology.getOntologyID().getOntologyIRI().getFragment();
   logger.info(
       "ontology: "
           + name
           + ", reasoner: "
           + factory.getReasonerName()
           + ", expressivity: "
           + e
           + ", consistent: "
           + isConsistent
           + ", unsat classes: "
           + numOfUnsatClasses
           + ", time: "
           + time);
 }
예제 #2
0
  public static void main(String[] args) {
    try {
      SimpleRenderer renderer = new SimpleRenderer();
      renderer.setShortFormProvider(
          new DefaultPrefixManager("http://www.mindswap.org/ontologies/tambis-full.owl#"));
      ToStringRenderer.getInstance().setRenderer(renderer);
      OWLOntologyManager man = OWLManager.createOWLOntologyManager();
      OWLOntology ont =
          man.loadOntology(
              IRI.create(
                  "http://owl.cs.manchester.ac.uk/repository/download?ontology=http://www.cs.manchester.ac.uk/owl/ontologies/tambis-patched.owl"));

      System.out.println("Loaded!");
      OWLReasonerFactory reasonerFactory = PelletReasonerFactory.getInstance();
      OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(ont);
      reasoner.getUnsatisfiableClasses();
      ExplanationBasedRootClassFinder rdr =
          new ExplanationBasedRootClassFinder(man, reasoner, reasonerFactory);
      for (OWLClass cls : rdr.getRootUnsatisfiableClasses()) System.out.println("ROOT! " + cls);
    } catch (TimeOutException e) {
      e.printStackTrace();
    } catch (ReasonerInterruptedException e) {
      e.printStackTrace();
    } catch (OWLOntologyCreationException e) {
      e.printStackTrace();
    }
  }
예제 #3
0
 public void shouldTestToStringRenderer() throws Exception {
   ToStringRenderer testSubject0 = ToStringRenderer.getInstance();
   ToStringRenderer result0 = ToStringRenderer.getInstance();
   testSubject0.setShortFormProvider(mock(ShortFormProvider.class));
   testSubject0.setRenderer(mock(OWLObjectRenderer.class));
   String result2 = testSubject0.getRendering(mock(OWLObject.class));
   String result3 = testSubject0.toString();
 }