Package com.clarkparsia.owlapi.explanation.io.manchester

Examples of com.clarkparsia.owlapi.explanation.io.manchester.ManchesterSyntaxExplanationRenderer


  public void run() throws OWLOntologyCreationException, OWLException, IOException {
    PelletExplanation.setup();
   
    // The renderer is used to pretty print explanation
    ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer();
    // The writer used for the explanation rendered
    PrintWriter out = new PrintWriter( System.out );
    renderer.startRendering( out );

    // Create an OWLAPI manager that allows to load an ontology file and
    // create OWLEntities
    OWLOntologyManager manager = OWL.manager;
    OWLOntology ontology = manager.loadOntology( IRI.create( file ) );

    // Create the reasoner and load the ontology
    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ontology );

    // Create an explanation generator
    PelletExplanation expGen = new PelletExplanation( reasoner );

    // Create some concepts
    OWLClass madCow = OWL.Class( NS + "mad+cow" );
    OWLClass animalLover = OWL.Class( NS + "animal+lover" );
    OWLClass petOwner = OWL.Class( NS + "pet+owner" );

    // Explain why mad cow is an unsatisfiable concept
    Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations( madCow );
    out.println( "Why is " + madCow + " concept unsatisfiable?" );   
    renderer.render( exp );

    // Now explain why animal lover is a sub class of pet owner
    exp = expGen.getSubClassExplanations( animalLover, petOwner );
    out.println( "Why is " + animalLover + " subclass of " + petOwner + "?" );
    renderer.render( exp );
   
    renderer.endRendering();
  }
View Full Code Here


  public void run() throws OWLOntologyCreationException, OWLException, IOException {
    PelletExplanation.setup();
   
    // The renderer is used to pretty print explanation
    ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer();
    // The writer used for the explanation rendered
    PrintWriter out = new PrintWriter( System.out );
    renderer.startRendering( out );

    // Create an OWLAPI manager that allows to load an ontology file and
    // create OWLEntities
    OWLOntologyManager manager = OWL.manager;
    OWLOntology ontology = manager.loadOntology( IRI.create( file ) );

    // Create the reasoner and load the ontology
    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ontology );

    // Create an explanation generator
    PelletExplanation expGen = new PelletExplanation( reasoner );

    // Create some concepts
    OWLClass madCow = OWL.Class( NS + "mad+cow" );
    OWLClass animalLover = OWL.Class( NS + "animal+lover" );
    OWLClass petOwner = OWL.Class( NS + "pet+owner" );

    // Explain why mad cow is an unsatisfiable concept
    Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations( madCow );
    out.println( "Why is " + madCow + " concept unsatisfiable?" );   
    renderer.render( exp );

    // Now explain why animal lover is a sub class of pet owner
    exp = expGen.getSubClassExplanations( animalLover, petOwner );
    out.println( "Why is " + animalLover + " subclass of " + petOwner + "?" );
    renderer.render( exp );
   
    renderer.endRendering();
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.owlapi.explanation.io.manchester.ManchesterSyntaxExplanationRenderer

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.