Jena is primarily an RDF library, thus, it's working on the concept of nodes and triples.
The RDF-based notation of OWL axioms and also OWL class expressions can be found here [1] . You can see that n triples encode on OWL construct, thus, blank nodes are used as you already discovered. For example, the encoding of the existential restriction (:hasAuthor some :Author) would be similar to _:x rdf:type owl:Restriction . _:x owl:onProperty :hasAuthor . _:x owl:someValuesFrom :Author . The problem now is, that for instance OWL class expression can be arbitrarily deep nested which makes the corresponding RDF even more complex. Of course, if you know that superclasses follow a particular schema/template, then you could resolve the blank nodes and get it's triples. In your example you could ask for all outgoing statements of the object node, e.g. model.listStatements(thisProperty.getObject(), null, (RDFNode) null); // untested! For the "author" example, you should get the statements back. Note that if the superclass is more complex, this would have to be done recursively for each blank node that occurs in object position Nevertheless, the ontology layer of Jena has some support for OWL 1 complex classes and restrictions [2] . Having a more deep look at the OntClass [3], there is a method asRestriction() which could be used to cast the object to a Restriction object [4] which itself has a bunch of methods to check for/convert to the corresponding type of restriction. Maybe this is already enough for you, otherwise I think Dave Reynolds is the developer of the ontology layer, so he'll probably give you a better answer. [1] https://www.w3.org/TR/owl2-mapping-to-rdf/ [2] https://jena.apache.org/documentation/ontology/#more-complex-class-expressions [3] https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/OntClass.html [4] https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/ontology/Restriction.html Cheers, Lorenz > Hi there > > I would like to list subclass assertions *completely*, i.e., also including > object properties with their restrictions. > > At the moment I am getting a mixed bag: > > - Subclass assertions proper return output like [1] or [2] in MY OUTPUT below > (*that's OK*); > > - Subclass assertions that use anonymous classes (i.e. a property + > restriction + range) return output like [3] in MY OUTPUT below (*not OK*); > > How should I change MY CODE below to see what's inside > -7d9d6f3d:15a658d8bb4:-7f27 (in terms of object property, restriction and > range of restriction for the particular class at hand) ? > > > Thanks, Jos > > > MY CODE > > ExtendedIterator classes = model.listClasses(); > while (classes.hasNext()) { > OntClass thisClass = (OntClass) classes.next(); > ExtendedIterator properties = thisClass.listProperties(); > while (properties.hasNext()){ > Statement thisProperty = (Statement) properties.next(); > if (thisProperty.getPredicate().toString().contains("sub")) { > > System.out.println("Contains sub_P: " + > thisProperty.getPredicate() + " Contains sub_O: " + > thisProperty.getObject()); > } > > } > } > > > MY OUTPUT > > [1] Contains sub_P: http://www.w3.org/2000/01/rdf-schema#subClassOf Contains > sub_O: http://www.bauhaus-luftfahrt.net/ontologies/2016/Ls_Ontology.owl#XXX > [2] Contains sub_P: http://www.w3.org/2000/01/rdf-schema#subClassOf Contains > sub_O: http://www.bauhaus-luftfahrt.net/ontologies/2016/Ls_Ontology.owl#YYY > [3] Contains sub_P: http://www.w3.org/2000/01/rdf-schema#subClassOf Contains > sub_O: -7d9d6f3d:15a658d8bb4:-7f27 > > > > -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center