问题
Let's consider a
(1) P Domain CSuper
(2) CSub subClassOf CSuper
Using Jena, I'm trying to list the declared properties for CSub
. What I believe is that P
mustn't be listed as a declared property for CSub
. My justification: P
is a declared property for CSub
, iff CSub
is a domain for P
, from (1) CSuper
is a domain for P
which doesn't imply that CSub
is also a domain; (1) means that if (x, y)
is P
, then x
is CSuper
, clearly x
may (not) be CSub
.
The surprising thing is that Jena is listing P
as a declared property for CSub
when using listDeclaredProperties
method even using OntModelSpec.OWL_DL_MEM_RULE_INF or Pellet! Am I missing something?
Update: What does a declared property for some class mean? Does it mean the classes that the property is a domain of them!
回答1:
You want:
theClass.listDeclaredProperties(false);
From the documentation:
listDeclaredProperties()
Equivalent to calling listDeclaredProperties(boolean) with default value direct = false.
direct
- If true, restrict the properties returned to those directly associated with this class. If false, the properties of super-classes of this class will not be listed among the declared properties of this class.
I think you've misunderstood declared properties. This returns properties that a class may (or must) have. Suppose we have a class hierarchy:
A > B > C
and also:
P domain B
All Bs
and Cs
may have property P
-- no contradiction there. However it's not true that all As
may have property P
-- the not-Bs
are the problem.
来源:https://stackoverflow.com/questions/28841701/jena-listdeclaredproperties-semantics