Package org.mindswap.pellet

Examples of org.mindswap.pellet.KnowledgeBase


      kb.addObjectProperty( p );
    }
  }
 
  public void reset() {
    kb = new KnowledgeBase();
  }
View Full Code Here


  public PelletInfGraph(KnowledgeBase kb, PelletReasoner pellet, GraphLoader loader) {
    this( kb, Factory.createDefaultGraph(), pellet, loader );
  }
 
  public PelletInfGraph(Graph graph, PelletReasoner pellet, GraphLoader loader) {
    this( new KnowledgeBase(), graph, pellet, loader );
  }
View Full Code Here

  private Set<ATermAppl> pruneExplanation(Triple pattern, Set<ATermAppl> explanation) {
    Set<ATermAppl> prunedExplanation = new HashSet<ATermAppl>( explanation );
   
    OntBuilder builder = new OntBuilder( kb );
    KnowledgeBase copyKB;
    PelletInfGraph copyGraph;

    GraphLoader loader = new DefaultGraphLoader();
    for( ATermAppl axiom : explanation ) {
      prunedExplanation.remove( axiom );
View Full Code Here

    this.ontology = ontology;
    monitor = config.getProgressMonitor();
   

    kb = new KnowledgeBase();
    kb.setTaxonomyBuilderProgressMonitor( new ProgressAdapter( monitor ) );
    if( config.getTimeOut() > 0 ) {
      kb.timers.mainTimer.setTimeout( config.getTimeOut() );
    }
   
View Full Code Here

    // load the model to the reasoner
    model.prepare();

    // Get the KnolwedgeBase object
    KnowledgeBase kb = ((PelletInfGraph) model.getGraph()).getKB();

    // perform initial consistency check
    long s = System.currentTimeMillis();
    boolean consistent = kb.isConsistent();
    long e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );

    // peform ABox addition which results in a consistent KB
    ATermAppl concept = ATermUtils.makeTermAppl( mindswap + "GraduateStudent" );
    ATermAppl individual = ATermUtils.makeTermAppl( mindswappers + "JohnDoe" );
    kb.addIndividual( individual );
    kb.addType( individual, concept );

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

    // peform ABox addition which results in an inconsistent KB
    ATermAppl role = ATermUtils.makeTermAppl( foaf + "mbox" );
    individual = ATermUtils.makeTermAppl( mindswappers + "Christian.Halaschek" );
    ATermAppl mbox = ATermUtils.makeTermAppl( "mailto:kolovski@cs.umd.edu" );
    kb.addPropertyValue( role, individual, mbox );

    // perform incremental consistency check
    s = System.currentTimeMillis();
    consistent = kb.isConsistent();
    e = System.currentTimeMillis();
    System.out.println( "Consistent? " + consistent + " (" + (e - s) + "ms)" );
  }
View Full Code Here

   * {@inheritDoc}
   */
  public boolean isParsable() {
    try {
      QueryEngine.getParser().parse( new FileInputStream( queryURI.substring( 5 ) ),
          new KnowledgeBase() );

      return true;
    } catch( Exception e ) {
      log.log( Level.INFO, e.getMessage(), e );
      return false;
View Full Code Here

          }
      };

    expGen = new HSTExplanationGenerator( singleExpGen );
   
    KnowledgeBase kb = reasoner.getKB();
   
    if( classify ) {
      kb.setDoExplanation( true );
      kb.ensureConsistency();
      kb.setDoExplanation( false );
     
      kb.realize();
    }
  }
View Full Code Here

   * An axiom like B = B or (not B) cause problems in classification process
   * because B was marked disjoint with itself.
   */
  @Test
  public void testTopClass3() {
    KnowledgeBase kb = new KnowledgeBase();

    ATermAppl A = term( "A" );
    ATermAppl B = term( "B" );
    ATermAppl C = term( "C" );

    kb.addClass( A );
    kb.addClass( B );
    kb.addClass( C );

    kb.addEquivalentClass( A, B );
    kb.addEquivalentClass( B, or( B, not( B ) ) );
    kb.addSubClass( C, A );

    assertTrue( kb.isConsistent() );

    kb.classify();

    assertTrue( kb.isEquivalentClass( A, TOP ) );
    assertTrue( kb.isEquivalentClass( B, TOP ) );
    assertFalse( kb.isEquivalentClass( C, TOP ) );
  }
View Full Code Here

    assertTrue( kb.isSatisfiable( C ) );
  }

  @Test
  public void testCyclicTBox2() {
    KnowledgeBase kb = new KnowledgeBase();

    ATermAppl B = term( "B" );
    ATermAppl C = term( "C" );
    ATermAppl D = term( "D" );

    kb.addClass( B );
    kb.addClass( C );
    kb.addClass( D );
    kb.addSubClass( C, B );
    kb.addSubClass( D, C );
    kb.addEquivalentClass( D, B );

    kb.classify();

    assertTrue( kb.isEquivalentClass( B, C ) );
    assertTrue( kb.isEquivalentClass( B, D ) );
    assertTrue( kb.isEquivalentClass( D, C ) );
  }
View Full Code Here

    assertTrue( top.getEquivalents().containsAll( classes ) );
  }

  @Test
  public void testComplexTypes() {
    KnowledgeBase kb = new KnowledgeBase();

    ATermAppl a = term( "a" );
    ATermAppl p = term( "p" );
    ATermAppl q = term( "q" );

    kb.addIndividual( a );

    kb.addType( a, min( p, 3, TOP ) );
    kb.addType( a, max( q, 2, TOP ) );
    kb.addType( a, min( q, 1, TOP ) );
    kb.addType( a, min( q, 1, TOP ) );

    kb.addObjectProperty( p );
    kb.addObjectProperty( q );

    assertTrue( kb.isConsistent() );
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.KnowledgeBase

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.