> -----Original Message----- > From: Joshua TAYLOR [mailto:[email protected]] > Sent: Tuesday, April 23, 2013 3:11 PM > To: [email protected] > Subject: Re: OntClass.listDeclaredProperties > > On Tue, Apr 23, 2013 at 2:45 PM, David Jordan <[email protected]> wrote: >> When I call listDeclaredProperties with a direct parameter value of false, I >> get a list of properties associated with a class. But when I pass a value of >> true, I don’t get any values, yet there are properties directly associated >> with the class. I do run this with a reasoner, using OWL_MEM_MICRO_RULE_INF. >> I am using the latest TDB release. Any idea why they are not being returned? > > Until now, I hadn't looked closely enough at the doc to know what > listDeclaredProperties was supposed to return. It returns an > iterator over "properties associated with a frame-like view of this class", > but I wasn't sure what "associated with" meant there. Looking at the > implementation in OntClassImpl, a property is associated with a class if > class is one of the property's domains. Is that the same meaning of > "associated with a class" that you're operating under? (I ask this not > because your question suggested any misunderstanding, but because I, not > having used listDeclaredProperties, assumed it might return properties in > restrictions on classes and the like, and that doesn't appear to the be the > case.)
On Tue, Apr 23, 2013 at 3:18 PM, David Jordan <[email protected]> wrote: > Actually, no it is not. What I really want is those properties included in > the definition of the class. I guess the better way to do this is to call > model.listStatements for the class and get the set of properties. > > Thanks for looking in the code. It's always a handy idea to keep a copy of the source around and to keep your grep ready. :) Do be aware that you'll have to do a bit more digging even with model.listStatements because restrictions used in class "definitions" are typically declared as superclasses (or, less commonly, equivalent classes) of the class being "defined". I put "definition" and "defined" in quotes, because typically the class "definition" is a set of necessary conditions, but not always sufficient. At any rate, you'll have to examine those superclasses and equivalent classes, and you might want to recurse up the other superclasses of the class too, if, in a case like Vehicle subClassOf (hasWheel min 2) MotorVehicle subClassOf Vehicle MotorVehicle subClassOf (hasMotor min 1) you want to say that hasWheel is used in the definition of MotorVehicle. //JT -- Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
