コード例 #1
0
  @Override
  public void evaluate(QueryRecord queryRecord) {
    OWLOntology knowledgebase = relevantPart(queryRecord);

    if (knowledgebase == null) {
      Utility.logDebug("Difficulty of this query: " + queryRecord.getDifficulty());
      return;
    }

    int aboxcount = knowledgebase.getABoxAxioms(true).size();
    Utility.logDebug(
        "ABox axioms: "
            + aboxcount
            + " TBox axioms: "
            + (knowledgebase.getAxiomCount() - aboxcount));
    //		queryRecord.saveRelevantOntology("fragment_query" + queryRecord.getQueryID() + ".owl");

    Timer t = new Timer();
    Checker summarisedChecker = new HermitSummaryFilter(queryRecord, properties.getToCallHermiT());
    //		int validNumber =
    summarisedChecker.check(queryRecord.getGapAnswers());
    summarisedChecker.dispose();
    Utility.logDebug("Total time for full reasoner: " + t.duration());
    //		if (validNumber == 0) {
    queryRecord.markAsProcessed();
    Utility.logDebug("Difficulty of this query: " + queryRecord.getDifficulty());
    //		}
  }
コード例 #2
0
  @Override
  public boolean test() {
    // Check if the ontology contains any axioms
    System.out.println("Number of axioms: " + ontology.getAxiomCount());
    // Every ontology has a unique ID.
    System.out.println("Current Ontology ID: " + ontology.getOntologyID());
    // test of CRUD
    // test of Create
    System.out.println("Number of children: " + factory.getAllChildInstances().size());
    System.out.println("Create a new child ");
    factory.createChild("Nicola");
    System.out.println("Number of children: " + factory.getAllChildInstances().size());
    // test of Read
    Child c = factory.getChild("Nicola");
    System.out.println(c.getOwlIndividual());
    // TODO: test of Update

    // test of Delete
    c.delete();
    System.out.println("Number of children: " + factory.getAllChildInstances().size());

    // save ABox, TBox, RBox to separate files.
    try {
      ontlgAbox = manager.createOntology(ontology.getABoxAxioms(true));
      ontlgTbox = manager.createOntology(ontology.getTBoxAxioms(true));
      ontlgRbox = manager.createOntology(ontology.getRBoxAxioms(true));
    } catch (OWLOntologyCreationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    try {
      manager.saveOntology(ontlgAbox, IRI.create(new File("individual/Abox.owl")));
      manager.saveOntology(ontlgTbox, IRI.create(new File("individual/Tbox.owl")));
      manager.saveOntology(ontlgRbox, IRI.create(new File("individual/Rbox.owl")));
    } catch (OWLOntologyStorageException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return true;
  }