public void visit(OWLAnnotationAssertionAxiom anno) {
   if (lastLangMatchIndex > 0
       && // a perfect match - no need to carry on search
       anno.getProperty().equals(prop)) {
     anno.getValue().accept(this);
   }
 }
Example #2
0
  public static boolean isDeprecated(OWLModelManager p4Manager, OWLObject o) {
    if (!(o instanceof OWLEntity)) {
      return false;
    }
    for (OWLOntology ontology : p4Manager.getActiveOntologies()) {
      for (OWLAnnotationAssertionAxiom assertion :
          ontology.getAnnotationAssertionAxioms(((OWLEntity) o).getIRI())) {

        if (!assertion.getProperty().isDeprecated()) {
          continue;
        }
        if (!(assertion.getValue() instanceof OWLLiteral)) {
          continue;
        }
        OWLLiteral value = (OWLLiteral) assertion.getValue();
        if (!value.isBoolean()) {
          continue;
        }
        if (value.parseBoolean()) {
          return true;
        }
      }
    }
    return false;
  }
  public Map<String, OWLIndividual> returnSitesInOntology() {
    // map that contains the correspondance between the names of the sites
    // and their OWLIndividual representations.
    Map<String, OWLIndividual> returnMap = new HashMap<>();
    List<OWLIndividual> returnList = new ArrayList<>();
    OWLAnnotationProperty hasNameAnnotationProperty =
        OWLFactory.getOWLAnnotationProperty(":individualName", topIxPrefixManager);

    OWLClassExpression tempSiteClassExpression =
        OWLFactory.getOWLClass(":Site", topIxPrefixManager);
    for (OWLClassAssertionAxiom tempClassAssAx :
        topIxOnt.getClassAssertionAxioms(tempSiteClassExpression)) {
      returnList.add(tempClassAssAx.getIndividual());

      Set<OWLAnnotationAssertionAxiom> tempSiteAnnotationsSet =
          topIxOnt.getAnnotationAssertionAxioms(
              tempClassAssAx.getIndividual().asOWLNamedIndividual().getIRI());
      for (OWLAnnotationAssertionAxiom tempAnnotationAssertionAxiom : tempSiteAnnotationsSet) {
        if (tempAnnotationAssertionAxiom.getProperty().equals(hasNameAnnotationProperty)) {
          String tempString = tempAnnotationAssertionAxiom.getValue().toString();
          logger.info(tempString);
          tempString =
              tempString.substring(tempString.indexOf('"') + 1, tempString.indexOf('^') - 1);
          logger.info(tempString);
          logger.info(tempClassAssAx.getIndividual().toString());
          returnMap.put(tempString, tempClassAssAx.getIndividual());
        }
      }
    }
    return returnMap;
  }
  public void retrieveRoomsMap() {
    // this method retrieves the rooms to be insserted in the two rooms lists.
    // it deposits the retrieved data in a map where the key is the room name (String) and the value
    // is the corresponding entity IRI.
    // the above data structure will be used in passing the entity IRIs in the jess working memory
    // when constructing the facts
    // when the respective room name (String) is selected in the rooms list combo box.

    for (OWLSubClassOfAxiom scoAx :
        topIxOnt.getSubClassAxiomsForSuperClass(
            OWLFactory.getOWLClass(
                IRI.create(
                    "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#Room")))) {
      String tmpS = scoAx.getSubClass().toString();

      Set<OWLAnnotationAssertionAxiom> tmpAnnSet =
          topIxOnt.getAnnotationAssertionAxioms(
              IRI.create(tmpS.substring(tmpS.indexOf('<') + 1, tmpS.indexOf('>'))));
      for (OWLAnnotationAssertionAxiom aaAx : tmpAnnSet) {
        if (aaAx.getProperty()
            .toString()
            .equals(
                "<http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#classID>")) {
          roomToIRI.put(
              aaAx.getValue().toString().substring(1, aaAx.getValue().toString().indexOf('^') - 1),
              tmpS.substring(tmpS.indexOf('<') + 1, tmpS.indexOf('>')));
        }
      }
    }
  }
Example #5
0
 public boolean isDataRetrievable(OWLProperty prop) {
   for (OWLAnnotationAssertionAxiom aaa : _ontology.getAnnotationAssertionAxioms(prop.getIRI())) {
     if (aaa.getProperty().getIRI().toString().equals(DomainOntology.dataRetrievable)) {
       return true;
     }
   }
   return false;
 }
 @Override
 public void visit(OWLAnnotationAssertionAxiom axiom) {
   write("Annotation");
   axiom.getSubject().accept(this);
   writeSpace();
   axiom.getProperty().accept(this);
   writeSpace();
   axiom.getValue().accept(this);
 }
 @Override
 public void visit(OWLAnnotationAssertionAxiom axiom) {
   axiom.getSubject().accept(this);
   OWLAnnotationSubject subject = (OWLAnnotationSubject) obj;
   axiom.getProperty().accept(this);
   OWLAnnotationProperty prop = (OWLAnnotationProperty) obj;
   axiom.getValue().accept(this);
   OWLAnnotationValue value = (OWLAnnotationValue) obj;
   obj =
       dataFactory.getOWLAnnotationAssertionAxiom(
           prop, subject, value, duplicateAxiomAnnotations(axiom));
 }
 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;
 }
 public Set<OWLAnnotationAssertionAxiom> writeAnnotations(OWLAnnotationSubject subject) {
   Set<OWLAnnotationAssertionAxiom> axioms = new HashSet<OWLAnnotationAssertionAxiom>();
   if (!isFiltered(AxiomType.ANNOTATION_ASSERTION)) {
     for (OWLOntology ontology : getOntologies()) {
       SectionMap sectionMap = new SectionMap();
       // Set<OWLAnnotation> annos = new TreeSet<OWLAnnotation>();
       for (OWLAnnotationAssertionAxiom ax : ontology.getAnnotationAssertionAxioms(subject)) {
         if (isDisplayed(ax)) {
           axioms.add(ax);
           sectionMap.add(ax.getAnnotation(), ax);
         }
       }
       writeSection(ANNOTATIONS, sectionMap, ",", true, ontology);
     }
   }
   return axioms;
 }
 @Override
 protected Object getValueKey(Object value) {
   OWLAnnotation annotation = null;
   if (value instanceof OWLAnnotationAssertionAxiom) {
     OWLAnnotationAssertionAxiom axiom = (OWLAnnotationAssertionAxiom) value;
     if (axiom.getAnnotations().isEmpty()) {
       return axiom.getAnnotation();
     } else {
       return axiom;
     }
   } else if (value instanceof AbstractAnnotationsList.AnnotationsListItem) {
     annotation = ((AbstractAnnotationsList.AnnotationsListItem) value).getAnnotation();
   } else if (value instanceof OWLAnnotation) {
     annotation = (OWLAnnotation) value;
   }
   return annotation;
 }
  public String getShortForm(OWLEntity entity) {

    for (OWLAnnotationProperty prop :
        annotationProperties) { // visit the properties in order of preference
      AnnotationLanguageFilter checker =
          new AnnotationLanguageFilter(prop, preferredLanguageMap.get(prop));

      for (OWLOntology ontology : ontologySetProvider.getOntologies()) {
        for (OWLAnnotationAssertionAxiom ax : entity.getAnnotationAssertionAxioms(ontology)) {
          ax.accept(checker);
        }
      }
      if (checker.getMatch() != null) {
        return getRendering(checker.getMatch());
      }
    }

    return alternateShortFormProvider.getShortForm(entity);
  }
  public void retrieveSubObjectPropertyAxioms() {
    // this method is to perform a dual operation; it shall retrieve all the declarative object
    // properties categories' annotations,
    // thus filling the objPropCategories Set, while parallelly will, for each category entry
    // retrieve the object properties themselves
    // and adding their entries in the objPropEntries Set.
    Set<OWLSubObjectPropertyOfAxiom> tmpSet;
    OWLObjectPropertyExpression tempDeclarativePropertyClass =
        OWLFactory.getOWLObjectProperty(":DeclarativeProperty", topIxPrefixManager);
    tmpSet =
        topIxOnt.getObjectSubPropertyAxiomsForSuperProperty(
            tempDeclarativePropertyClass); // OWLFactory.getOWLObjectProperty(IRI.create("http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl#DeclarativeProperty")));
    Set<OWLSubObjectPropertyOfAxiom> tmpSet2;

    Set<OWLAnnotationAssertionAxiom> tmpAnnSet1;
    Set<OWLAnnotationAssertionAxiom> tmpAnnSet2;
    // to become class variables.

    for (OWLSubObjectPropertyOfAxiom sopAx : tmpSet) {
      String tmpS = sopAx.getSubProperty().toString();
      // categories...
      tmpAnnSet1 =
          topIxOnt.getAnnotationAssertionAxioms(
              IRI.create(
                  tmpS.substring(
                      1, tmpS.indexOf('>')))); // this set only contains one annotation per entry
      for (OWLAnnotationAssertionAxiom aaAx : tmpAnnSet1) {
        String currentObjPropCatName =
            aaAx.getValue().toString().substring(1, aaAx.getValue().toString().indexOf('^') - 1);

        tmpSet2 =
            topIxOnt.getObjectSubPropertyAxiomsForSuperProperty(
                OWLFactory.getOWLObjectProperty(IRI.create(tmpS.substring(1, tmpS.length() - 1))));
        for (OWLSubObjectPropertyOfAxiom sopAx2 : tmpSet2) {
          String tmpS2 = sopAx2.getSubProperty().toString();
          tmpAnnSet2 =
              topIxOnt.getAnnotationAssertionAxioms(
                  IRI.create(tmpS2.substring(1, tmpS2.length() - 1)));

          for (OWLAnnotationAssertionAxiom aaAx2 : tmpAnnSet2) {
            String currentObjPropEntryName =
                aaAx2
                    .getValue()
                    .toString()
                    .substring(1, aaAx2.getValue().toString().indexOf('^') - 1);
            propEntryNameToPropCatName.put(currentObjPropEntryName, currentObjPropCatName);
            propEntryNametoPropEntryIRI.put(
                currentObjPropEntryName, tmpS2.substring(1, tmpS2.length() - 1));
          }
        }
      }
    }
  }
 @Override
 public void visit(OWLAnnotationAssertionAxiom axiom) {
   handleObject(axiom);
   axiom.getSubject().accept(this);
   axiom.getAnnotation().accept(this);
 }
 public void visit(OWLAnnotationAssertionAxiom axiom) {
   type = AXIOM_TYPE_INDEX_BASE + axiom.getAxiomType().getIndex();
 }
 public void visit(OWLAnnotationAssertionAxiom axiom) {
   axiom.getProperty().accept(this);
   axiom.getValue().accept(this);
   processAxiomAnnotations(axiom);
 }