Package org.mindswap.pellet.jena

Examples of org.mindswap.pellet.jena.PelletInfGraph


    D.addDisjointWith( E );

    // add individual
    Individual i4 = model.createIndividual( ns + "i4", D );

    PelletInfGraph graph = (PelletInfGraph) model.getGraph();

    model.prepare();

    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ) == null );
    assertIteratorValues( model.listIndividuals(), new Resource[] { i1, i2, i3, i4 } );

    i4.addRDFType( C );
    model.prepare();
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 1 );
  }
View Full Code Here


    model.prepare();

    // add individual
    Individual i4 = model.createIndividual( ns + "i4", D );

    PelletInfGraph graph = (PelletInfGraph) model.getGraph();
    model.prepare();

    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() > 0 );
    assertIteratorValues( model.listIndividuals(), new Resource[] { i1, i2, i3, i4 } );

    i4.addRDFType( model.createCardinalityRestriction( null, p, 1 ) );
    graph.getKB().timers.getTimer( "isIncConsistent" ).reset();

    model.prepare();

    // check that incremental consistency was not used
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 0 );

    i4.addRDFType( E );

    // check that the kb is now inconsistent and that incremental
    // consistency was used
    assertFalse( ((PelletInfGraph) model.getGraph()).isConsistent() );
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() > 0 );

    i4.removeRDFType( E );

    graph.getKB().timers.getTimer( "isIncConsistent" ).reset();

    model.prepare();

    // check that the kb is now inconsistent and that incremental
    // consistency was used
    assertTrue( ((PelletInfGraph) model.getGraph()).isConsistent() );
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 0 );

    ObjectProperty op = model.createObjectProperty( ns + "op" );
    i2.addProperty( op, i4 );

    model.prepare();

    // check that the kb is now inconsistent and that incremental
    // consistency was used
    assertTrue( ((PelletInfGraph) model.getGraph()).isConsistent() );
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 0 );

    i2.addRDFType( CONJ );

    model.prepare();

    // check that the kb is now inconsistent and that incremental
    // consistency was used
    assertTrue( ((PelletInfGraph) model.getGraph()).isConsistent() );
    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 0 );
  }
View Full Code Here

        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );

    model.prepare();

    PelletInfGraph graph = (PelletInfGraph) model.getGraph();

    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ) == null );
    assertIteratorValues( a.listPropertyValues( dp ), new Literal[] { one } );

    a.addProperty( op, b );

    // check consistency
    model.prepare();

    assertIteratorValues( a.listPropertyValues( op ), new Resource[] { b } );
    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 1 );

    Literal two = model.createTypedLiteral( "2", TypeMapper.getInstance().getTypeByName(
        XSD.positiveInteger.getURI() ) );
    b.addProperty( dp, two );

    graph.getKB().isConsistent();

    assertIteratorValues( b.listPropertyValues( dp ), new Literal[] { two } );
    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 2 );
  }
View Full Code Here

        XSD.positiveInteger.getURI() ) );
    a.addProperty( dp, one );

    model.prepare();

    PelletInfGraph graph = (PelletInfGraph) model.getGraph();

    assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ) == null );
    assertIteratorValues( a.listPropertyValues( dp ), new Literal[] { one } );

    a.addProperty( op, anon1 );

    // check consistency
    model.prepare();

    assertIteratorValues( a.listPropertyValues( op ), new Resource[] { anon1 } );
    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() > 0 );

    Individual anon2 = model.createIndividual( C );
    anon2.addProperty( op, a );

    // check consistency
    model.prepare();

    assertIteratorValues( anon2.listPropertyValues( op ), new Resource[] { a } );
    // check that the update occurred and that the incremental consistency
    // was used
    assertTrue( !PelletOptions.USE_INCREMENTAL_CONSISTENCY || graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() == 2 );
  }
View Full Code Here

        inds[0], inds[1], inds[2], inds[3] } );

    assertIteratorValues( class2.listInstances(), new Resource[] {
        inds[2], inds[3], inds[4], inds[5] } );

    PelletInfGraph graph = (PelletInfGraph) ontmodel.getGraph();

    //assertTrue( graph.getKB().timers.getTimer( "isIncConsistent" ) == null );
    long prevCount = graph.getKB().timers.getTimer( "isIncConsistent" ) == null ?
      0 : graph.getKB().timers.getTimer( "isIncConsistent" ).getCount();
   
    inds[4].addRDFType( class1 );
    inds[5].addRDFType( class1 );

    ontmodel.prepare();

    assertIteratorValues( class1.listInstances(), new Resource[] {
        inds[0], inds[1], inds[2], inds[3], inds[4], inds[5] } );

    assertTrue( prevCount < graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() );

    graph.getKB().timers.getTimer( "isIncConsistent" ).reset();

    RDFList list = ontmodel.createList( new RDFNode[] { class1, class2 } );

    IntersectionClass class3 = ontmodel.createIntersectionClass( null, list );

    UnionClass class4 = ontmodel.createUnionClass( null, list );

    graph.getKB().timers.getTimer( "isIncConsistent" ).reset();
   
    ontmodel.prepare();

    assertIteratorValues( class3.listInstances(), new Resource[] {
        inds[2], inds[3], inds[4], inds[5] } );

    assertIteratorValues( class4.listInstances(), new Resource[] {
        inds[0], inds[1], inds[2], inds[3], inds[4], inds[5] } );

    assertEquals( 0, graph.getKB().timers.getTimer( "isIncConsistent" ).getCount() );

    Individual newind = ontmodel.createIndividual( nc + "Ind7", class4 );

    ontmodel.prepare();
View Full Code Here

  public void testEntailment(String entailmentFileURI, boolean positiveEntailment) {
    Model entailments = ModelFactory.createOntologyModel( OntModelSpec.OWL_MEM );
    entailments.read( entailmentFileURI, entailmentFileURI, fileType( entailmentFileURI ) );
   
    Graph entailmentsGraph = entailments.getGraph();
    PelletInfGraph pellet = (PelletInfGraph) model.getGraph();

    GraphLoader savedLoader = pellet.attachTemporaryGraph( entailmentsGraph );

    ExtendedIterator i = entailmentsGraph.find( Triple.ANY );
   
    while( i.hasNext() ) {
      Triple triple = (Triple) i.next();
      if( !pellet.entails( triple ) ) {
        assertFalse( "Entailment failed for " + triple, positiveEntailment );
        return;       
      }
    }

    pellet.detachTemporaryGraph( entailmentsGraph, savedLoader );
   
    assertTrue( "All axioms entailed in negative entailment test", positiveEntailment );
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.jena.PelletInfGraph

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.