Package com.clarkparsia.pellet.owlapiv3

Examples of com.clarkparsia.pellet.owlapiv3.OWLClassTreePrinter


  public void testDLSafeConstants() throws OWLOntologyCreationException {
    String ns = "http://owldl.com/ontologies/dl-safe-constants.owl#";

    OWLOntology ont = loadOntology( base + "dl-safe-constants.owl" );

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );

    OWLClass DreamTeamMember = Class( ns + "DreamTeamMember" );
    OWLClass DreamTeamMember1 = Class( ns + "DreamTeamMember1" );
    OWLClass DreamTeamMember2 = Class( ns + "DreamTeamMember2" );

    OWLIndividual Alice = Individual( ns + "Alice" );
    OWLIndividual Bob = Individual( ns + "Bob" );
    OWLIndividual Charlie = Individual( ns + "Charlie" );

    for( int test = 0; test < 1; test++ ) {
      if( test != 0 ) {
              reasoner.prepareReasoner();
            }

      assertIteratorValues( reasoner.getInstances( DreamTeamMember, false ).getFlattened().iterator(),
          new Object[] { Alice, Bob, Charlie } );

      assertIteratorValues( reasoner.getInstances( DreamTeamMember1, false ).getFlattened().iterator(),
          new Object[] { Alice, Bob, Charlie } );

      assertIteratorValues( reasoner.getInstances( DreamTeamMember2, false ).getFlattened().iterator(),
          new Object[] { Alice, Bob, Charlie } );
    }
  }
View Full Code Here


    OWLOntology ont = OWL.Ontology( transitive( p1 ),
        classAssertion( x, all( p1, C ) ), propertyAssertion( x, p1, y ),
        propertyAssertion( y, p1, z ) );

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );

    assertTrue( reasoner.isEntailed( classAssertion( y, C ) ) );
    assertTrue( reasoner.isEntailed( classAssertion( z, C ) ) );

    OWLAxiom[] axioms = new OWLAxiom[] {
        functional( p1 ), inverseFunctional( p1 ), irreflexive( p1 ), asymmetric( p1 ),
        disjointProperties( p1, p2 ), subClassOf( C, min( p1, 2 ) ),
        classAssertion( x, max( p1, 3 ) ), disjointClasses( C, min( p1, 2 ) ) };

    for( int i = 0; i < axioms.length; i++ ) {
      addAxioms( ont, axioms[i] );

      reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );
      assertTrue( axioms[i].toString(), reasoner.isEntailed( classAssertion( y, C ) ) );
      assertFalse( axioms[i].toString(), reasoner.isEntailed( classAssertion( z, C ) ) );

      removeAxioms( ont, axioms[i] );
    }
  }
View Full Code Here

  @Test
  public void testInvalidTransitivity2() throws OWLOntologyCreationException {
    OWLOntology ont = loadOntology( base + "invalidTransitivity.owl" );

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );

    KnowledgeBase kb = reasoner.getKB();
    kb.prepare();

    for( Role r : kb.getRBox().getRoles() ) {
      if( !ATermUtils.isBuiltinProperty( r.getName() ) ) {
        assertTrue( r.toString(), r.isSimple() );
View Full Code Here

    axioms.add( propertyAssertion( a, q, c ) );

    OWLOntology ont = OWL.Ontology( axioms, ontIRI );

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );

    assertEquals( SetUtils.create( a ), reasoner.getSameIndividuals( a ).getEntities() );
    assertEquals( SetUtils.create( b, c ), reasoner.getSameIndividuals( b ).getEntities() );
    assertEquals( SetUtils.create( b, c ), reasoner.getSameIndividuals( c ).getEntities() );

    assertPropertyValues( reasoner, a, p, b, c );
   
    assertPropertyValues( reasoner, a, q, b, c );
   
View Full Code Here

    axioms.add( classAssertion( i3, c ) );

    OWLOntology ont = OWL.Ontology( axioms, ontIRI );

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ont );

    assertTrue( !reasoner.isEntailed( sameAs( i1, i2 ) ) );
    assertTrue( !reasoner.isEntailed( sameAs( i1, i3 ) ) );
    assertEquals( SetUtils.create( i1 ), reasoner.getSameIndividuals( i1 ).getEntities() );

    assertTrue( !reasoner.isEntailed( sameAs( i2, i1 ) ) );
    assertTrue( !reasoner.isEntailed( sameAs( i2, i3 ) ) );
    assertEquals( SetUtils.create( i2 ), reasoner.getSameIndividuals( i2 ).getEntities() );

    assertTrue( !reasoner.isEntailed( sameAs( i3, i1 ) ) );
    assertTrue( !reasoner.isEntailed( sameAs( i3, i2 ) ) );
    assertEquals( SetUtils.create( i3 ), reasoner.getSameIndividuals( i3 ).getEntities() );

  }
View Full Code Here

      }
    });
  }
 
  private static void runComparisonTest(OWLOntology ontology, ModuleExtractor modExtractor, ReasonerComparisonMethod comparisonMethod) {
    PelletReasoner unified = PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
    IncrementalClassifier modular = PelletIncremantalReasonerFactory.getInstance().createReasoner( ontology, modExtractor );
   
    PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.CONSOLE;
    modular.classify();
    unified.getKB().classify();
   
    comparisonMethod.compare( unified, modular );
   
    modular.dispose();
  }
View Full Code Here

    modular.dispose();
  }
 
  private static void runComparisonUpdateTest(OWLOntology ontology, ModuleExtractor modExtractor,
      Collection<OWLAxiom> additions, Collection<OWLAxiom> deletions, ReasonerComparisonMethod comparisonMethod) {
    PelletReasoner unified = PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
    IncrementalClassifier modular = PelletIncremantalReasonerFactory.getInstance().createReasoner( ontology, modExtractor );

    PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.CONSOLE;
    modular.classify();

    comparisonMethod.compare( unified, modular );
   
    OntologyUtils.addAxioms( ontology, additions );   
    OntologyUtils.removeAxioms( ontology, deletions );
   
    modular.classify();
    unified.flush();
    unified.getKB().classify();
   
    modular.timers.print();

    comparisonMethod.compare( unified, modular );
   
View Full Code Here

    if( log.isLoggable( Level.FINE ) ) {
          log.fine( "Module axioms " + owlModule.getLogicalAxioms() );
        }

    // load the extracted module to a new reasoner
    PelletReasoner moduleReasoner = PelletReasonerFactory.getInstance().createReasoner( owlModule );

    // classify the module
    moduleReasoner.getKB().classify();

    if( log.isLoggable( Level.FINE ) ) {
      log.fine( "Classified module:" );

      new ClassTreePrinter().print( moduleReasoner.getKB().getTaxonomy(), new PrintWriter( System.err ) );
    }

    Taxonomy<OWLClass> moduleTaxonomy = buildClassHierarchy( moduleReasoner );

    Set<OWLClass> affectedCls = new HashSet<OWLClass>();
View Full Code Here

   
    OWLAPILoader loader = (OWLAPILoader) getLoader( "OWLAPIv3" );
   
    getKB();
   
    PelletReasoner reasoner = loader.getReasoner();
   
    OWLOntology entailmentOntology = null;
    try {
      verbose( "Loading entailment file: " );
      verbose( entailmentFile );
View Full Code Here

    OWLSubClassOfAxiom sc = factory.getOWLSubClassOfAxiom(c,
        dataSomeRestriction);

    manager.addAxiom(ontology, sc);
   
    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner(ontology);

    assertTrue(reasoner.isConsistent());
   
    KnowledgeBase kb = reasoner.getKB();
    assertTrue(kb.isClass(term("http://example#c")));
   
    // check for complex class that refers to a user-defined datatype
    ATermAppl term = reasoner.term( dataSomeRestriction );
    term = ATermUtils.normalize( term );
    assertTrue( kb.isClass( term ) );   
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.owlapiv3.OWLClassTreePrinter

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.