Esempio n. 1
0
  public boolean isDomainOrRangeOfObjectProperty(OWLClass clase, OWLObjectProperty prop) {

    for (OWLClass owlClass1 : _reasoner.getObjectPropertyDomains(prop, false).getFlattened()) {
      if (owlClass1.getIRI().equals(clase.getIRI())) {
        Log.d(
            TAG,
            "<isDomainOrRangeOfObjectProperty> "
                + clase.getIRI().getRemainder().get()
                + " dominio o rango de "
                + prop.getIRI().getRemainder().get()
                + "? SI!");
        return true;
      }
    }
    for (OWLClass owlClass1 : _reasoner.getObjectPropertyRanges(prop, false).getFlattened()) {
      if (owlClass1.getIRI().equals(clase.getIRI())) {
        Log.d(
            TAG,
            "<isDomainOrRangeOfObjectProperty> "
                + clase.getIRI().getRemainder().get()
                + " dominio o rango de "
                + prop.getIRI().getRemainder().get()
                + "? SI!");
        return true;
      }
    }
    Log.d(
        TAG,
        "<isDomainOrRangeOfObjectProperty> "
            + clase.getIRI().getRemainder().get()
            + " dominio o rango de "
            + prop.getIRI().getRemainder().get()
            + "? NO");
    return false;
  }
Esempio n. 2
0
 public Set<OWLDataProperty> getDataPropertiesByDomainExtended(OWLClass domain) {
   Log.d(
       TAG,
       "<getDataPropertiesByDomainExtended> Buscando DataProperties con dominio "
           + domain.getIRI().toString());
   Set<OWLDataProperty> propSet = new HashSet<OWLDataProperty>();
   for (OWLDataProperty prop : _ontology.getDataPropertiesInSignature()) {
     if (isDomainOfDataProperty(domain, prop)) {
       propSet.add(prop);
     }
   }
   return propSet;
 }
Esempio n. 3
0
 private OntologyManager() {
   _manager = OWLManager.createOWLOntologyManager();
   try {
     _ontology = _manager.loadOntology(IRI.create(getClass().getResource(ONTOLOGY_RESOURCE_PATH)));
     for (OWLAnnotation anon : _ontology.getAnnotations()) {
       if (anon.getProperty().getIRI().toString().equals(DomainOntology.taxonomyDefinedBy)) {
         _taxonomyType = anon.getValue().toString().replace("\"", "");
         break;
       }
     }
     _reasoner = new StructuralReasonerFactory().createReasoner(_ontology);
   } catch (OWLOntologyCreationException ex) {
     Log.e(TAG, "Error while loading the domain ontology");
     _taxonomyType = null;
   }
 }
Esempio n. 4
0
  public static void main(String[] args) {

    OntologyManager om = OntologyManager.getInstance();

    OWLClass aClass = new OWLDataFactoryImpl().getOWLClass(IRI.create(DomainOntology.Articulo));
    for (PropAndDir propAndDir : om.getPropertiesToRetrieve(aClass)) {
      Log.i(TAG, propAndDir.toString());
    }

    /* FUNCIONA
     * OWLObjectProperty prop = new OWLDataFactoryImpl().getOWLObjectProperty(IRI.create(DomainOntology.label));
     * Log.i(TAG, prop.toString()); Log.i(TAG, om.isDataRetrievable(prop) ? "yes" : "no"); Log.i(TAG, "=="); prop =
     * new OWLDataFactoryImpl().getOWLObjectProperty(IRI.create(DomainOntology.dataRetrievable)); Log.i(TAG,
     * prop.toString()); Log.i(TAG, om.isDataRetrievable(prop) ? "yes" : "no"); Log.i(TAG, "=="); prop = new
     * OWLDataFactoryImpl().getOWLObjectProperty(IRI.create(DomainOntology.abstractt)); Log.i(TAG, prop.toString());
     * Log.i(TAG, om.isDataRetrievable(prop) ? "yes" : "no");
     */

  }