예제 #1
0
 /**
  * @param entity
  * @return
  */
 public String render(OWLEntity entity) {
   for (OWLOntology ont : manager.getOntologies()) {
     for (OWLAnnotation annot : entity.getAnnotations(ont)) {
       if (annot.getAnnotationURI().equals(OWLRDFVocabulary.RDFS_LABEL.getURI())) {
         if (annot instanceof OWLConstantAnnotation) {
           return ((OWLConstantAnnotation) annot).getAnnotationValue().getLiteral();
         }
       }
     }
   }
   return entity.getURI().getFragment();
 }
  // this method retrieves all the geometric properties that have been
  // pre-designated as "house setable" or "room setable",
  // that is, if a geometric property is available for houses, it has been
  // annotated as "houseSetable", for rooms, "roomSetable" and for both it
  // has been designated with both annotations.
  public void retrieveGeometricPropertiesMaps() {
    OWLDataProperty geometricProperty =
        OWLFactory.getOWLDataProperty(":GeometricProperty", topIxPrefixManager);
    OWLAnnotationProperty propertyID =
        OWLFactory.getOWLAnnotationProperty(":propertyID", topIxPrefixManager);
    logger.info(propertyID);
    OWLAnnotationProperty houseSetable =
        OWLFactory.getOWLAnnotationProperty(":houseSetable", topIxPrefixManager);
    OWLAnnotationProperty roomSetable =
        OWLFactory.getOWLAnnotationProperty(":roomSetable", topIxPrefixManager);
    Set<OWLSubDataPropertyOfAxiom> tempGeometricDataPropertiesSet =
        topIxOnt.getDataSubPropertyAxiomsForSuperProperty(geometricProperty);

    for (OWLSubDataPropertyOfAxiom tempGeomPropAxiom : tempGeometricDataPropertiesSet) {
      OWLDataProperty tempDataProperty = tempGeomPropAxiom.getSubProperty().asOWLDataProperty();
      // the following two local vars will become an entry for geometricPropertiesMap
      String tempString = tempDataProperty.getAnnotations(topIxOnt, propertyID).toString();
      tempString = tempString.substring(tempString.indexOf('"') + 1, tempString.indexOf("^") - 1);
      IRI tempIRI = tempGeomPropAxiom.getSubProperty().asOWLDataProperty().getIRI();
      geometricPropertiesMap.put(tempString, tempIRI);

      // the following code decides whether the above entry should also be contained
      // in the houseSetableGeometricPropertiesMap
      Set<OWLAnnotation> tempDataPropAnnotationSet = tempDataProperty.getAnnotations(topIxOnt);
      for (OWLAnnotation tempDataPropAnnotation : tempDataPropAnnotationSet) {
        if (tempDataPropAnnotation.getProperty() == houseSetable
            && tempDataPropAnnotation.getValue().toString().equals("\"true\"^^xsd:boolean")) {
          houseSetableGeometricPropertiesMap.put(tempString, tempIRI);
        }
        if (tempDataPropAnnotation.getProperty() == roomSetable
            && tempDataPropAnnotation.getValue().toString().equals("\"true\"^^xsd:boolean")) {
          roomSetableGeometricPropertiesMap.put(tempString, tempIRI);
        }
      }
    }
  }