Hi Steve,
In the documentation you referred to, the important statement is at the
bottom:
Global properties listDeclaredProperties will treat properties with no
specified domain as global, and regard them as properties of all
classes. The use of the direct flag can hide global properties from
non-root classes.
The general idea is, that if no domain is defined for the property, then
we cannot assume it doesn't "belong" to any class A - indeed, using
cls.listDeclaredProperties(true)
would avoid that assumption, and only return all those properties
without a domain for the root class only.
Cheers,
Lorenz
On 29.12.22 15:31, Steve Vestal wrote:
Below is an example from
https://jena.apache.org/documentation/notes/rdf-frames.html (rewritten
in ofn due to minor syntax error in example and my greater familiarity
with ofn), with one minor addition. I declared an object property
that is not used anywhere else.
Prefix(purl:=<http://purl.org/dc/elements/1.1#>)
Prefix(rf:=<http://www.adventium.com/rdf_frame_ofn#>)
Ontology( <http://www.galois.com/rdf_frame_ofn>
Annotation( purl:title "Test RDF Frames" )
Declaration( Class( rf:LivingThing ) )
Declaration( Class( rf:Animal ) )
SubClassOf(rf:Animal rf:LivingThing )
Declaration( Class( rf:Mammal ) )
SubClassOf(rf:Mammal rf:Animal )
Declaration( ObjectProperty ( rf:hasSkeleton ) )
ObjectPropertyDomain( rf:hasSkeleton rf:Animal )
Declaration( ObjectProperty ( rf:unused ) ) # added to example
)
When I call OntClass.listDeclaredProperties, the rf:unused property
appears in the list for all the classes in the ontology. Otherwise it
behaves as in the example. I have done some other simple tests, and
it seems to list almost all the properties in the ontology for all
classes. What I would like to do is have it list for a class only the
properties that are known (can be proven) to be used in the definition
of that class, e.g., where removal of that property might change what
appears in the ABox for a particular knowledge base. I would
appreciate help understanding this behavior and how I might get
something closer to the desired list. Where am I getting bitten by
the open world assumption?