protected void handleSelectAnnotation() {
   OWLAnnotationProperty prop = new UIHelper(getOWLEditorKit()).pickAnnotationProperty();
   if (prop != null) {
     labelAnnotation = prop.getIRI();
     annotationIriLabel.setText(labelAnnotation.toString());
   }
 }
 protected int compareObjectOfSameType(OWLObject object) {
   OWLAnnotationPropertyDomainAxiom other = (OWLAnnotationPropertyDomainAxiom) object;
   int diff = property.compareTo(other.getProperty());
   if (diff != 0) {
     return diff;
   }
   return domain.compareTo(other.getDomain());
 }
 @Override
 protected int compareObjectOfSameType(OWLObject object) {
   OWLAnnotationPropertyRangeAxiom other = (OWLAnnotationPropertyRangeAxiom) object;
   int diff = property.compareTo(other.getProperty());
   if (diff != 0) {
     return diff;
   }
   return range.compareTo(other.getRange());
 }
 public boolean equals(Object obj) {
   if (obj == this) {
     return true;
   }
   if (!(obj instanceof OWLAnnotationPropertyDomainAxiom)) {
     return false;
   }
   OWLAnnotationPropertyDomainAxiom other = (OWLAnnotationPropertyDomainAxiom) obj;
   return property.equals(other.getProperty())
       && domain.equals(other.getDomain())
       && getAnnotations().equals(other.getAnnotations());
 }
 @Override
 public boolean equals(Object obj) {
   if (super.equals(obj)) {
     // superclass is responsible for null, identity, owlaxiom type and
     // annotations
     if (!(obj instanceof OWLAnnotationPropertyRangeAxiom)) {
       return false;
     }
     OWLAnnotationPropertyRangeAxiom other = (OWLAnnotationPropertyRangeAxiom) obj;
     return property.equals(other.getProperty()) && range.equals(other.getRange());
   }
   return false;
 }
 public Set<OWLAxiom> write(OWLAnnotationProperty property) {
   Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
   axioms.addAll(writeEntityStart(ANNOTATION_PROPERTY, property));
   if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) {
     for (OWLOntology ont : getOntologies()) {
       Set<OWLAnnotation> annos = new TreeSet<OWLAnnotation>();
       for (OWLAnnotationAssertionAxiom ax : ont.getAnnotationAssertionAxioms(property.getIRI())) {
         if (isDisplayed(ax)) {
           annos.add(ax.getAnnotation());
         }
       }
       writeSection(ANNOTATIONS, annos, ",", true, ont);
     }
   }
   if (!isFiltered(AxiomType.SUB_ANNOTATION_PROPERTY_OF)) {
     for (OWLOntology ont : getOntologies()) {
       Set<OWLAnnotationProperty> props = new TreeSet<OWLAnnotationProperty>();
       for (OWLSubAnnotationPropertyOfAxiom ax : ont.getSubAnnotationPropertyOfAxioms(property)) {
         if (isDisplayed(ax)) {
           props.add(ax.getSuperProperty());
         }
       }
       writeSection(SUB_PROPERTY_OF, props, ",", true, ont);
     }
   }
   if (!isFiltered(AxiomType.ANNOTATION_PROPERTY_DOMAIN)) {
     for (OWLOntology ont : getOntologies()) {
       Set<IRI> iris = new TreeSet<IRI>();
       for (OWLAnnotationPropertyDomainAxiom ax :
           ont.getAnnotationPropertyDomainAxioms(property)) {
         if (isDisplayed(ax)) {
           iris.add(ax.getDomain());
         }
       }
       writeSection(DOMAIN, iris, ",", true, ont);
     }
   }
   if (!isFiltered(AxiomType.ANNOTATION_PROPERTY_RANGE)) {
     for (OWLOntology ont : getOntologies()) {
       Set<IRI> iris = new TreeSet<IRI>();
       for (OWLAnnotationPropertyRangeAxiom ax : ont.getAnnotationPropertyRangeAxioms(property)) {
         if (isDisplayed(ax)) {
           iris.add(ax.getRange());
         }
       }
       writeSection(RANGE, iris, ",", true, ont);
     }
   }
   writeEntitySectionEnd(ANNOTATION_PROPERTY.toString());
   return axioms;
 }
 @Override
 public void visit(OWLAnnotationProperty property) {
   handleObject(property);
   property.getIRI().accept(this);
 }
Esempio n. 8
0
  private OWLOntology parseWithReasoner(OWLOntologyManager manager, OWLOntology ontology) {
    try {
      PelletOptions.load(new URL("http://" + cssLocation + "pellet.properties"));
      PelletReasoner reasoner = PelletReasonerFactory.getInstance().createReasoner(ontology);
      reasoner.getKB().prepare();
      List<InferredAxiomGenerator<? extends OWLAxiom>> generators =
          new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
      generators.add(new InferredSubClassAxiomGenerator());
      generators.add(new InferredClassAssertionAxiomGenerator());
      generators.add(new InferredDisjointClassesAxiomGenerator());
      generators.add(new InferredEquivalentClassAxiomGenerator());
      generators.add(new InferredEquivalentDataPropertiesAxiomGenerator());
      generators.add(new InferredEquivalentObjectPropertyAxiomGenerator());
      generators.add(new InferredInverseObjectPropertiesAxiomGenerator());
      generators.add(new InferredPropertyAssertionGenerator());
      generators.add(new InferredSubDataPropertyAxiomGenerator());
      generators.add(new InferredSubObjectPropertyAxiomGenerator());

      InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner, generators);

      OWLOntologyID id = ontology.getOntologyID();
      Set<OWLImportsDeclaration> declarations = ontology.getImportsDeclarations();
      Set<OWLAnnotation> annotations = ontology.getAnnotations();

      Map<OWLEntity, Set<OWLAnnotationAssertionAxiom>> entityAnnotations =
          new HashMap<OWLEntity, Set<OWLAnnotationAssertionAxiom>>();
      for (OWLClass aEntity : ontology.getClassesInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }
      for (OWLObjectProperty aEntity : ontology.getObjectPropertiesInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }
      for (OWLDataProperty aEntity : ontology.getDataPropertiesInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }
      for (OWLNamedIndividual aEntity : ontology.getIndividualsInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }
      for (OWLAnnotationProperty aEntity : ontology.getAnnotationPropertiesInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }
      for (OWLDatatype aEntity : ontology.getDatatypesInSignature()) {
        entityAnnotations.put(aEntity, aEntity.getAnnotationAssertionAxioms(ontology));
      }

      manager.removeOntology(ontology);
      OWLOntology inferred = manager.createOntology(id);
      iog.fillOntology(manager, inferred);

      for (OWLImportsDeclaration decl : declarations) {
        manager.applyChange(new AddImport(inferred, decl));
      }
      for (OWLAnnotation ann : annotations) {
        manager.applyChange(new AddOntologyAnnotation(inferred, ann));
      }
      for (OWLClass aEntity : inferred.getClassesInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }
      for (OWLObjectProperty aEntity : inferred.getObjectPropertiesInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }
      for (OWLDataProperty aEntity : inferred.getDataPropertiesInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }
      for (OWLNamedIndividual aEntity : inferred.getIndividualsInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }
      for (OWLAnnotationProperty aEntity : inferred.getAnnotationPropertiesInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }
      for (OWLDatatype aEntity : inferred.getDatatypesInSignature()) {
        applyAnnotations(aEntity, entityAnnotations, manager, inferred);
      }

      return inferred;
    } catch (FileNotFoundException e1) {
      return ontology;
    } catch (MalformedURLException e1) {
      return ontology;
    } catch (IOException e1) {
      return ontology;
    } catch (OWLOntologyCreationException e) {
      return ontology;
    }
  }
Esempio n. 9
0
 @Override
 protected void writeAnnotationPropertyComment(OWLAnnotationProperty prop) {
   writeComment(prop.getIRI().toString());
 }
Esempio n. 10
0
 @Override
 public void visit(OWLAnnotationProperty property) {
   write("AnnotationProperty");
   property.getIRI().accept(this);
 }