Package com.clarkparsia.pellet.owlapiv3

Examples of com.clarkparsia.pellet.owlapiv3.OWLAPILoader


  protected KBLoader getLoader(String loaderName) {
    if( loaderName.equalsIgnoreCase( "Jena" ) )
      loader = new JenaLoader();
    else if( loaderName.equalsIgnoreCase( "OWLAPIv3" )
        || loaderName.equalsIgnoreCase( "OWLAPI" ) )
      loader = new OWLAPILoader();
    else if( loaderName.equalsIgnoreCase( "KRSS" ) )
      loader = new KRSSLoader();
    else
      throw new PelletCmdException( "Unknown loader: " + loaderName );
View Full Code Here


      startTask( "classification" );
      incrementalClassifier.classify();
      finishTask( "classification" );
    }

    TaxonomyPrinter<OWLClass> printer = new OWLClassTreePrinter();
    printer.print( incrementalClassifier.getTaxonomy() );
   
    if( !currentStateSaved ) {
      persistIncrementalClassifier( incrementalClassifier, ontology );
    }
  }
View Full Code Here

    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();
    OWLOntology ontology = manager.loadOntology( IRI.create( mindswappers ) );

    // we want a non-buffering reasoner here (a buffering reasoner would not process any additions, until manually refreshed)
    PelletReasoner reasoner = com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.getInstance().createNonBufferingReasoner( ontology );
    manager.addOntologyChangeListener( reasoner );

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

    // peform ABox addition which results in a consistent KB
    OWLClass concept = factory.getOWLClass( IRI.create( mindswap + "GraduateStudent" ) );
    OWLNamedIndividual individual = factory
        .getOWLNamedIndividual( IRI.create( mindswappers + "JohnDoe" ) );
    manager.applyChange( new AddAxiom( ontology, factory.getOWLClassAssertionAxiom( concept, individual ) ) );

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

    // peform ABox addition which results in an inconsistent KB
    OWLObjectProperty role = factory.getOWLObjectProperty( IRI.create( foaf + "mbox" ) );
    individual = factory.getOWLNamedIndividual( IRI.create( mindswappers + "Christian.Halaschek" ) );
    OWLNamedIndividual mbox = factory.getOWLNamedIndividual( IRI.create( "mailto:kolovski@cs.umd.edu" ) );
    manager.applyChange( new AddAxiom( ontology, factory.getOWLObjectPropertyAssertionAxiom(
        role, individual, mbox ) ) );

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

   
    System.out.print("Reading file " + file + "...");
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLOntology ontology = manager.loadOntology(IRI.create(file));

    PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner( ontology );
    System.out.println("done.");
   
    reasoner.getKB().realize();
    reasoner.getKB().printClassTree();
   
    // create property and resources to query the reasoner
    OWLClass Person = manager.getOWLDataFactory().getOWLClass(IRI.create("http://xmlns.com/foaf/0.1/Person"));
    OWLObjectProperty workHomepage = manager.getOWLDataFactory().getOWLObjectProperty(IRI.create("http://xmlns.com/foaf/0.1/workInfoHomepage"));
    OWLDataProperty foafName = manager.getOWLDataFactory().getOWLDataProperty(IRI.create("http://xmlns.com/foaf/0.1/name"));
   
    // get all instances of Person class
    NodeSet<OWLNamedIndividual> individuals = reasoner.getInstances( Person, false);
    for(Node<OWLNamedIndividual> sameInd : individuals) {
      // sameInd contains information about the individual (and all other individuals that were inferred to be the same)
      OWLNamedIndividual ind =  sameInd.getRepresentativeElement();
     
        // get the info about this specific individual
      Set<OWLLiteral> names = reasoner.getDataPropertyValues( ind, foafName );                       
        NodeSet<OWLClass> types = reasoner.getTypes( ind, true );       
        NodeSet<OWLNamedIndividual> homepages = reasoner.getObjectPropertyValues( ind, workHomepage );
       
        // we know there is a single name for each person so we can get that value directly
        String name = names.iterator().next().getLiteral();
      System.out.println( "Name: " + name );
       
View Full Code Here

   
    // read the ontology
    OWLOntology ontology = manager.loadOntology( IRI.create(ont) );
   
    // load the ontology to the reasoner
    PelletReasoner reasoner = com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.getInstance().createReasoner( ontology );
   
    // create property and resources to query the reasoner
    OWLClass Person = factory.getOWLClass(IRI.create("http://xmlns.com/foaf/0.1/Person"));
    OWLObjectProperty workHomepage = factory.getOWLObjectProperty(IRI.create("http://xmlns.com/foaf/0.1/workInfoHomepage"));
    OWLDataProperty foafName = factory.getOWLDataProperty(IRI.create("http://xmlns.com/foaf/0.1/name"));
   
    // get all instances of Person class
    Set<OWLNamedIndividual> individuals = reasoner.getInstances( Person, false ).getFlattened();
    for(OWLNamedIndividual ind : individuals) {     
        // get the info about this specific individual
      Set<OWLLiteral> names = reasoner.getDataPropertyValues( ind, foafName );                       
        NodeSet<OWLClass> types = reasoner.getTypes( ind, true );       
        NodeSet<OWLNamedIndividual> homepages = reasoner.getObjectPropertyValues( ind, workHomepage );
       
        // we know there is a single name for each person so we can get that value directly
        String name = names.iterator().next().getLiteral();
      System.out.println( "Name: " + name );
       
View Full Code Here

    // 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
View Full Code Here

    for(OWLAxiom axiom: axiomsFromABox)
    {
      OWL.manager.applyChange( new AddAxiom( ontologyTBox, axiom ) );
    }
   
    PelletReasoner reasoner = com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory.getInstance().createReasoner( ontologyTBox );
   
    System.out.println("Entities:");
    for(int i=0; i< entities.length; i++)
    {
      OWLClass obj = (OWLClass) entities[i];
      String name = obj.toStringID();
      System.out.println("Class:  " + name.substring(name.indexOf("#")+1));
     
      // get all instances of Person class
      Set<OWLNamedIndividual> individuals = reasoner.getInstances( obj, false ).getFlattened();
      for(OWLNamedIndividual ind : individuals) {
        System.out.println("Individual: " + ind.toString());
      }
      System.out.println("---------------------------");
    }
View Full Code Here

    factory = PelletReasonerFactory.getInstance();
  }
 
  public OWLReasoner getReasoner(OWLOntology ontology){
    OWLReasonerConfiguration config = new SimpleConfiguration(ReasonerPara.TIMEOUT);
    PelletReasoner reasoner = factory.createReasoner(ontology, config);
    return reasoner;
  }
View Full Code Here

    return iri;
  }

  @Override
  protected boolean isConsistent(OWLOntology o) {
    PelletReasoner reasoner = reasonerFactory.createReasoner( o );
    reasoner.getKB().setTimeout( timeout );
    return reasoner.isConsistent();
  }
View Full Code Here

    return reasoner.isConsistent();
  }

  @Override
  protected boolean isEntailed(OWLOntology premise, OWLOntology conclusion) {
    PelletReasoner reasoner = reasonerFactory.createReasoner( premise );
    reasoner.getKB().setTimeout( timeout );
    return reasoner.isEntailed( conclusion.getLogicalAxioms() );
  }
View Full Code Here

TOP

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

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.