Package com.clarkparsia.pellet.owlapiv3

Examples of com.clarkparsia.pellet.owlapiv3.EntailmentQueryVisitor


  }
   
  public GlassBoxExplanation(PelletReasonerFactory factory, PelletReasoner reasoner) {
    super( reasoner.getRootOntology(), factory, reasoner );
   
    axiomConverter = new AxiomConverter( reasoner );
  }
View Full Code Here


  }

  @Test
  public void testAxiomConverterRules1() {
    KnowledgeBase kb = new KnowledgeBase();
    AxiomConverter converter = new AxiomConverter( kb, OWL.manager.getOWLDataFactory() );

    ATermAppl C = ATermUtils.makeTermAppl( "C" );
    ATermAppl D = ATermUtils.makeTermAppl( "D" );
    ATermAppl x = ATermUtils.makeVar( "x" );

    kb.addClass( C );
    kb.addClass( D );

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makeTypeAtom( x, D ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makeTypeAtom( x, C ) };

    ATermAppl rule = ATermUtils.makeRule( head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( classAtom( Class( "C" ), variable( "x" ) ) );
View Full Code Here


  @Test
  public void testAxiomConverterRules1b() {
    KnowledgeBase kb = new KnowledgeBase();
    AxiomConverter converter = new AxiomConverter( kb, OWL.manager.getOWLDataFactory() );

    ATermAppl C = ATermUtils.makeTermAppl( "C" );
    ATermAppl D = ATermUtils.makeTermAppl( "D" );
    ATermAppl x = ATermUtils.makeVar( "x" );
    ATermAppl name = ATermUtils.makeTermAppl( "MyRule" );

    kb.addClass( C );
    kb.addClass( D );

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makeTypeAtom( x, D ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makeTypeAtom( x, C ) };

    ATermAppl rule = ATermUtils.makeRule( name, head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( classAtom( Class( "C" ), variable( "x" ) ) );
View Full Code Here

    assertEquals( expected, actual );
  }
 
  public void testAxiomConverterRules1c() {
    KnowledgeBase kb = new KnowledgeBase();
    AxiomConverter converter = new AxiomConverter( kb, OWL.manager.getOWLDataFactory() );

    ATermAppl C = ATermUtils.makeTermAppl( "C" );
    ATermAppl D = ATermUtils.makeTermAppl( "D" );
    ATermAppl x = ATermUtils.makeVar( "x" );
    ATermAppl name = ATermUtils.makeBnode( "MyRule" );

    kb.addClass( C );
    kb.addClass( D );

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makeTypeAtom( x, D ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makeTypeAtom( x, C ) };

    ATermAppl rule = ATermUtils.makeRule( name, head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( classAtom( Class( "C" ), variable( "x" ) ) );
View Full Code Here

  }
 
  @Test
  public void testAxiomConverterRules2() {
    KnowledgeBase kb = new KnowledgeBase();
    AxiomConverter converter = new AxiomConverter( kb, OWL.manager.getOWLDataFactory() );

    ATermAppl C = ATermUtils.makeTermAppl( "C" );
    ATermAppl D = ATermUtils.makeTermAppl( "D" );
    ATermAppl i = ATermUtils.makeTermAppl( "i" );

    kb.addClass( C );
    kb.addClass( D );
    kb.addIndividual( i );

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makeTypeAtom( i, D ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makeTypeAtom( i, C ) };

    ATermAppl rule = ATermUtils.makeRule( head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( classAtom( Class( "C" ), SWRL.individual( OWL.Individual( "i" ) ) ) );
View Full Code Here

  @Test
  public void testAxiomConverterRules3() {
    KnowledgeBase kb = new KnowledgeBase();
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory df = manager.getOWLDataFactory();
    AxiomConverter converter = new AxiomConverter( kb, df );

    ATermAppl p = ATermUtils.makeTermAppl( "p" );
    ATermAppl q = ATermUtils.makeTermAppl( "q" );
    ATermAppl x = ATermUtils.makeVar( "x" );
    ATermAppl y = ATermUtils.makeVar( "y" );

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

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makePropAtom( q, x, y ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makePropAtom( p, x, y ) };

    ATermAppl rule = ATermUtils.makeRule( head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( propertyAtom( ObjectProperty( "p" ), variable( "x" ), variable( "y" ) ) );
View Full Code Here

  }

  @Test
  public void testAxiomConverterRules4() {
    KnowledgeBase kb = new KnowledgeBase();
    AxiomConverter converter = new AxiomConverter( kb, OWL.manager.getOWLDataFactory() );

    ATermAppl r = ATermUtils.makeTermAppl( "r" );
    ATermAppl s = ATermUtils.makeTermAppl( "s" );
    ATermAppl x = ATermUtils.makeVar( "x" );
    ATermAppl y = ATermUtils.makeVar( "y" );

    kb.addDatatypeProperty( r );
    kb.addDatatypeProperty( s );

    ATermAppl[] head = new ATermAppl[] { ATermUtils.makePropAtom( r, x, y ) };
    ATermAppl[] body = new ATermAppl[] { ATermUtils.makePropAtom( s, x, y ) };

    ATermAppl rule = ATermUtils.makeRule( head, body );

    OWLAxiom actual = converter.convert( rule );

    Set<SWRLAtom> antecedent = new HashSet<SWRLAtom>();
    Set<SWRLAtom> consequent = new HashSet<SWRLAtom>();

    antecedent.add( propertyAtom( DataProperty( "s" ), variable( "x" ), variable( "y" ) ) );
View Full Code Here

      assertTrue( "Entailment failed", reasoner.isEntailed( axiom ) );

      Set<ATermAppl> terms = reasoner.getKB().getExplanationSet();
      assertTrue( "Explanation incorrect " + terms, terms.size() == 1);
     
      OWLAxiom explanation = new AxiomConverter(reasoner).convert(terms.iterator().next());
      assertEquals( "Unexpected explanation", axiom, explanation );
    }
    finally {
      if (ont != null)
        manager.removeOntology( ont );
View Full Code Here

      entailmentOntology = loader.getManager().loadOntology( entailmentFileURI );
    } catch( Exception e ) {
      throw new PelletCmdException( e );
    }
   
    EntailmentChecker checker = new EntailmentChecker(reasoner);   
    Set<OWLLogicalAxiom> axioms = entailmentOntology.getLogicalAxioms();
   
    verbose( "Check entailments for (" + axioms.size() + ") axioms" );
    startTask( "Checking" );
    Set<OWLAxiom> nonEntailments = checker.findNonEntailments(axioms, findAll);   
    finishTask( "Checking" );
   
    if( nonEntailments.isEmpty() ) {
      output( "All axioms are entailed." );
    }
View Full Code Here

    try {
      OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
      Collection<String> inputFiles = FileUtils.getFileURIs(getInputFiles());

      LimitedMapIRIMapper iriMapper = new LimitedMapIRIMapper();
      OWLOntology  baseOntology = manager.createOntology();
      manager.clearIRIMappers();

      if(options.getOption("ignore-imports").getValueAsBoolean())
      {
View Full Code Here

TOP

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

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.