Ejemplo n.º 1
0
  private String runTests(String query) throws Exception {
    QuestOWLStatement st = conn.createStatement();
    // StringBuilder bf = new StringBuilder(query);
    String retval;
    try {

      QuestOWLResultSet rs = st.executeTuple(query);

      assertTrue(rs.nextRow());
      OWLIndividual ind1 = rs.getOWLIndividual("x");
      retval = ind1.toString();

    } catch (Exception e) {
      throw e;
    } finally {
      try {

      } catch (Exception e) {
        st.close();
        assertTrue(false);
      }
      conn.close();
      reasoner.dispose();
    }
    return retval;
  }
 @Override
 protected GetIndividualsResult execute(
     GetIndividualsAction action, OWLAPIProject project, ExecutionContext executionContext) {
   List<OWLNamedIndividualData> individualsData = new ArrayList<OWLNamedIndividualData>();
   if (action.getType().isOWLThing()) {
     Set<OWLNamedIndividual> individualsInSignature =
         project.getRootOntology().getIndividualsInSignature(true);
     for (OWLNamedIndividual individual : individualsInSignature) {
       individualsData.add(project.getRenderingManager().getRendering(individual));
     }
   } else {
     for (OWLClassAssertionAxiom ax :
         project.getRootOntology().getClassAssertionAxioms(action.getType())) {
       OWLIndividual individual = ax.getIndividual();
       if (individual.isNamed()) {
         individualsData.add(
             project.getRenderingManager().getRendering(individual.asOWLNamedIndividual()));
       }
     }
   }
   Collections.sort(
       individualsData,
       new Comparator<OWLNamedIndividualData>() {
         @Override
         public int compare(
             OWLNamedIndividualData owlNamedIndividualData,
             OWLNamedIndividualData owlNamedIndividualData2) {
           return owlNamedIndividualData
               .getBrowserText()
               .compareTo(owlNamedIndividualData2.getBrowserText());
         }
       });
   PageRequest pageRequest = action.getPageRequest();
   Pager<OWLNamedIndividualData> pager =
       Pager.getPagerForPageSize(individualsData, pageRequest.getPageSize());
   Page<OWLNamedIndividualData> page = pager.getPage(pageRequest.getPageNumber());
   return new GetIndividualsResult(page);
 }
 public void visit(OWLObjectOneOf desc) {
   for (OWLIndividual ind : desc.getIndividuals()) {
     ind.accept(this);
   }
 }
 public void visit(OWLSameIndividualAxiom axiom) {
   for (OWLIndividual ind : axiom.getIndividuals()) {
     ind.accept(this);
   }
   processAxiomAnnotations(axiom);
 }