1

I have an ontology made with protègè, I defined an ObjectProperty named part-Of. enter image description here

I'm parsing an OWLClass trying to find out whether or not the subclasses are part-Of the parsed class. In this case, I am parsing At_Home when the subclasses, ANA and PHE, have the following subclass of signature as in this picture enter image description here I've already tried with:

OWLDataFactory df = manager.getOWLDataFactory();
    OWLObjectProperty partOf = df.getOWLObjectProperty("part-Of");
    OWLClassExpression c = df.getOWLObjectSomeValuesFrom(partOf, target);
    NodeSet<OWLClass> subClasses = hermit.getSubClasses(c, true);
    if(subClasses.isEmpty()) {
        //System.out.println("\tQuesta classe non ha parti");
        res[0] = null;
    }
    else {
        for(Node<OWLClass> parte : subClasses) {
            risultato.add(parte.getRepresentativeElement().getIRI().getFragment());
        }
        res[0] = risultato;
    }

where target is the At_Home OWLClass, but the method continues to return an empty NodeSet, so it means that At_Home has no parts even if ANA and PHE are its parts.
The wanted result should be a NodeSet with the OWLClass "ANA" and "PHE"

DiegLuthor
  • 195
  • 1
  • 14

1 Answers1

1

df.getOWLObjectProperty("part-Of");

This is the problem. You need to use the full IRI of your property, not just the fragment; this won't match the property as stated in your ontology.

Ignazio
  • 10,504
  • 1
  • 14
  • 25
  • so adding the full IRI "semanticweb.org/diego/ontologies/2019/2/…" should do the trick, but how can I get it from ontology that I didn't create myself? I mean, in the IRI there is "diego" and parts like "2019/2" which are variable, how can I find the right ObjectProperty with only the fragment name? is there a way? @Ignazio – DiegLuthor Mar 16 '19 at 08:48
  • I don't really understand the question. In any ontology, whether created by you or imported from some other site, the properties are identified by absolute IRIs, not relative ones. In which scenario do you only have the fragment name? – Ignazio Mar 18 '19 at 20:58