Examples of OWLReasonerFactory


Examples of org.semanticweb.owl.inference.OWLReasonerFactory

    System.out.println("Running baseline...");
   
    org.mindswap.pellet.utils.Timers timers  = new Timers();
    timers.createTimer("classification");
   
    OWLReasonerFactory reasonerFactory = null;
    switch (selectReasoner){
      case 1: reasonerFactory = new PelletReasonerFactory(); break;
      case 2: reasonerFactory = new FaCTPlusPlusReasonerFactory(); break;
      default: reasonerFactory = new PelletReasonerFactory(); break;
    }
   
    OWLReasoner reasoner = reasonerFactory.createReasoner(manager);
   
    logger.info("Reasoner: "+reasonerFactory.getReasonerName());
   
    /* Load Tbox and all imported ontologies */
    reasoner.loadOntologies(Collections.singleton(tbox));
   
    /*  Load Abox into reasoner */
 
View Full Code Here

Examples of org.semanticweb.owl.inference.OWLReasonerFactory

     
      org.mindswap.pellet.utils.Timers timers  = new Timers();
      timers.createTimer("classification");
      timers.createTimer("approximation");
     
      OWLReasonerFactory reasonerFactory = null;
      switch (selectReasoner){
        case 1: reasonerFactory = new PelletReasonerFactory(); break;
        case 2: reasonerFactory = new FaCTPlusPlusReasonerFactory(); break;
        default: reasonerFactory = new PelletReasonerFactory(); break;
      }     
     
      /* Initialize manager used for loading the Abox */
      OWLOntologyManager manager = null;
      manager = OWLManager.createOWLOntologyManager();

      /* Rewrite Tbox T -> T' based on the current vocabulary subset */
      Timer timerApproximation = timers.startTimer( "approximation" );
      ApproximationResult approximationResult = approximation.getNextTBox();
      timerApproximation.stop();
     
      if (approximationResult != null) {
        System.out.println("Creating Tbox approximation "+runCounter);
       
        OWLOntology abox = null;
        OWLOntology approximatedTbox = null;
        OWLReasoner reasoner = null;
        int newIndividualsToAdd = 0;
       
        /* get the approximated Tbox */
        approximatedTbox = approximationResult.approximatedOntology();
     
        if (approximationResult.isOriginal()){
          /* Last run. Use original Abox to compute the baseline run */
          aboxPhysicalURI = originalAboxURI;
        }
       
        /* Load Abox into the manager */
        abox = manager.loadOntologyFromPhysicalURI(aboxPhysicalURI);
        int aboxIndividualAxiomsCount = abox.getIndividualAxioms().size();
         
        if (measureApproximationTime) {
          /* update time with the time it takes to build the Tbox based on the current vocabulary set */
          approximationTime = timerApproximation.getTotal();
        }
     
        //OWLOntology currentTBox2 = approximationResult.approximatedOntology();
       
        /* Create a new physical URI based on the current run */
        URI tboxPhysicalURI = createNewURI(tmpTboxPhysicalURI, runCounter);
        if (saveApproximatedTbox){
          /* Save approximated Tbox to disk - for debugging purposes only */
          saveOntologyToFile(approximatedTbox, tboxPhysicalURI);
        }     
       
        /* Create the reasoner */
        reasoner = reasonerFactory.createReasoner(manager);
        logger.info("Using reasoner: "+reasonerFactory.getReasonerName());
       
        Set<OWLOntology> ontologiesToLoad = new HashSet<OWLOntology>();
        ontologiesToLoad.add(abox);
        ontologiesToLoad.add(approximatedTbox);
       
View Full Code Here

Examples of org.semanticweb.owl.inference.OWLReasonerFactory

    }
    initLogger(RESULTS_DIR + "AboxReasoner_" + anytimeContract + filename
        + "_run" + approximationCnt + ".log");

    /* Create the reasoner factory according to the reasoner we want to use */
    OWLReasonerFactory reasonerFactory = null;
    switch (selectReasoner)
    {
    case 1:
      reasonerFactory = new PelletReasonerFactory();
      break;
View Full Code Here

Examples of org.semanticweb.owl.inference.OWLReasonerFactory

    int runCounter = 1;
    while (true)
    {
      System.out.println("Running Approximation No. " + runCounter);
      OWLReasonerFactory reasonerFactory = new PelletReasonerFactory();
      // OWLReasonerFactory reasonerFactory = new
      // FaCTPlusPlusReasonerFactory();
      OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
      OWLReasoner reasoner = null;

      OWLOntology aboxOntology = null;
      ApproximationResult approximationResult = null;
      OWLOntology approximatedTboxOntology = null;

      HashMap<OWLClass, Integer> allIndividualsCounts = new HashMap<OWLClass, Integer>();
      HashMap<OWLClass, Integer> directIndividualsCounts = new HashMap<OWLClass, Integer>();
      HashMap<OWLClass, Integer> indirectIndividualsCounts = new HashMap<OWLClass, Integer>();

      int cumulativeDirectIndividualsCounts = 0;
      int cumulativeIndirectIndividualsCounts = 0;

      Timers timers = new Timers();

      double classificationTime = 0;
      double approximationTime = 0;
      double instanceRetrievalTime = 0;
      double aboxUpdateTime = 0;
      double time = 0;

      // System.out.println("--->approximating...");
      timers.createTimer("approximation");
      Timer timerApproximation = timers.startTimer("approximation");
      approximationResult = approximation.getNextTBox();
      timerApproximation.stop();
      if (measureApproximationTime)
      {
        approximationTime += timerApproximation.getTotal();
      }

      if (approximationResult != null)
      {
        approximatedTboxOntology = approximationResult
            .approximatedOntology();

        URI tboxPhysicalURI = createURI(tmpTboxPhysicalURI, runCounter);
        if (saveApproximatedTbox)
        {
          saveOntology(approximatedTboxOntology, tboxPhysicalURI);
        }

        // System.out.println("--->classifying...");
        reasoner = reasonerFactory.createReasoner(manager);
        reasoner.loadOntologies(Collections
            .singleton(approximatedTboxOntology));
        timers.createTimer("classification");
        if (!(reasoner.isClassified()))
        {
View Full Code Here

Examples of org.semanticweb.owl.inference.OWLReasonerFactory

      Set<OWLClass> classes, Set<OWLProperty<?, ?>> properties)
      throws OWLReasonerException
  {
    System.out.println("Running Full Ontology..." + tboxURI.toString());
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLReasonerFactory reasonerFactory = new PelletReasonerFactory();
    // OWLReasonerFactory reasonerFactory = new
    // FaCTPlusPlusReasonerFactory();
    OWLReasoner reasoner = null;
    OWLOntology tboxOntology = null, aboxOntology = null;

    fullCassIndividuals = new HashMap<OWLClass, Set<OWLIndividual>>();
    Set<OWLIndividual> allIndividuals;
    Set<OWLIndividual> directIndividuals;

    HashMap<OWLClass, Integer> allIndividualsCounts = new HashMap<OWLClass, Integer>();
    HashMap<OWLClass, Integer> directIndividualsCounts = new HashMap<OWLClass, Integer>();
    HashMap<OWLClass, Integer> indirectIndividualsCounts = new HashMap<OWLClass, Integer>();

    int cumulativeIndividualsCount = 0;
    int cumulativeDirectindividualsCount = 0;
    int cumulativeIndirectIndividualsCount = 0;

    Timers timers = new Timers();
    double time = 0;
    double classificationTime = 0;
    double instanceRetrievalTime = 0;

    try
    {
      tboxOntology = manager.loadOntology(tboxURI);
      aboxOntology = manager.loadOntology(aboxURI);

    } catch (OWLOntologyCreationException e)
    {
      e.printStackTrace();
      System.exit(0);
    }

    // System.out.println("--->classifying...");
    reasoner = reasonerFactory.createReasoner(manager);
    reasoner.loadOntologies(Collections.singleton(tboxOntology));
    reasoner.loadOntologies(Collections.singleton(aboxOntology));
    timers.createTimer("classification");

    if (!reasoner.isClassified())
View Full Code Here

Examples of org.semanticweb.owl.inference.OWLReasonerFactory

public class RacerProServer extends Server {

  @Override
  public void initialServer(int index) {
    OWLReasonerFactory factory = new RacerTCPReasonerFactory();
    LegacyReasonerFactory legacyFactory =
      new LegacyReasonerFactory(factory);
    AbstractOWLlinkReasonerConfiguration configuration =
      new AbstractOWLlinkReasonerConfiguration();
    int port = ServerParams.getPort(getServerName());
View Full Code Here

Examples of org.semanticweb.owlapi.reasoner.OWLReasonerFactory

        // We need to create an instance of OWLReasoner. An OWLReasoner provides
        // the basic query functionality that we need, for example the ability
        // obtain the subclasses of a class etc. To do this we use a reasoner
        // factory.
        // Create a reasoner factory.
        OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
        return reasonerFactory.createReasoner(rootOntology);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.reasoner.OWLReasonerFactory

        // sure you get the HermiT library and add it to your class path. You
        // can then instantiate the HermiT reasoner factory: Comment out the
        // first line below and uncomment the second line below to instantiate
        // the HermiT reasoner factory. You'll also need to import the
        // org.semanticweb.HermiT.Reasoner package.
        OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
        // OWLReasonerFactory reasonerFactory = new Reasoner.ReasonerFactory();
        // We'll now create an instance of an OWLReasoner (the implementation
        // being provided by HermiT as we're using the HermiT reasoner factory).
        // The are two categories of reasoner, Buffering and NonBuffering. In
        // our case, we'll create the buffering reasoner, which is the default
        // kind of reasoner. We'll also attach a progress monitor to the
        // reasoner. To do this we set up a configuration that knows about a
        // progress monitor. Create a console progress monitor. This will print
        // the reasoner progress out to the console.
        // ConsoleProgressMonitor progressMonitor = new
        // ConsoleProgressMonitor();
        // Specify the progress monitor via a configuration. We could also
        // specify other setup parameters in the configuration, and different
        // reasoners may accept their own defined parameters this way.
        // OWLReasonerConfiguration config = new SimpleConfiguration(
        // progressMonitor);
        // Create a reasoner that will reason over our ontology and its imports
        // closure. Pass in the configuration.
        // OWLReasoner reasoner = reasonerFactory.createReasoner(ont, config);
        OWLReasoner reasoner = reasonerFactory.createReasoner(ont);
        // Ask the reasoner to do all the necessary work now
        reasoner.precomputeInferences();
        // We can determine if the ontology is actually consistent (in this
        // case, it should be).
        boolean consistent = reasoner.isConsistent();
View Full Code Here

Examples of org.semanticweb.owlapi.reasoner.OWLReasonerFactory

        // Create a reasoner factory. In this case, we will use pellet, but we
        // could also use FaCT++ using the FaCTPlusPlusReasonerFactory. Pellet
        // requires the Pellet libraries (pellet.jar, aterm-java-x.x.jar) and
        // the XSD libraries that are bundled with pellet: xsdlib.jar and
        // relaxngDatatype.jar make sure these jars are on the classpath
        OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
        // Uncomment the line below reasonerFactory = new
        // PelletReasonerFactory(); Load an example ontology - for the purposes
        // of the example, we will just load the pizza ontology.
        OWLOntologyManager man = OWLManager.createOWLOntologyManager();
        OWLOntology ont = loadPizza(man);
        // Create the reasoner and classify the ontology
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(ont);
        reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
        // To generate an inferred ontology we use implementations of inferred
        // axiom generators to generate the parts of the ontology we want (e.g.
        // subclass axioms, equivalent classes axioms, class assertion axiom
        // etc. - see the org.semanticweb.owlapi.util package for more
View Full Code Here

Examples of org.semanticweb.owlapi.reasoner.OWLReasonerFactory

        // the local name
        String prefix = ont.getOntologyID().getOntologyIRI().get() + "#";
        // Create a reasoner. We will use Pellet in this case. Make sure that
        // the latest version of the Pellet libraries are on the runtime class
        // path
        OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
        // Uncomment the line below reasonerFactory = new
        // PelletReasonerFactory();
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(ont);
        // Now we can query the reasoner, suppose we want to determine the
        // properties that instances of Marghertia pizza must have
        OWLClass margheritaPizza = man.getOWLDataFactory().getOWLClass(
                IRI.create(prefix + "Quokka"));
        // printProperties(man, ont, reasoner, margheritaPizza);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.