Suppose class B includes a restriction that states that a property cannot include a particular value x. An individual a may have that property with the value x. I don't understand how your suggestions would cover that case. And assume there is a reasoned involved.
-----Original Message----- From: Joshua TAYLOR [mailto:[email protected]] Sent: Friday, February 22, 2013 10:26 AM To: [email protected] Subject: Re: testing whether an instance could be associated with a class On Fri, Feb 22, 2013 at 9:38 AM, David Jordan <[email protected]> wrote: > I have a question about how to express something in Jena. Assume we have an > individual a that is of type A, where A would actually be a collection of > classes and subclasses. Also assume we have a class B that has been defined. > B may include some class restrictions that place constraints on which > resources can be instances of that class. As a simple case, B may be defined > as disjoint with A. What would be the means of asking whether individual a > can be of class B based on currently defined constraints? > > Individual.addOntClass returns void and throws no exception, so that would > not seem to work. > > Would another approach be to get the OntClasses associated with individual a > and then calling OntClass.isDisjointWith? Even using OntClass#isDisjointWith is unlikely to work except in the case of explicit disjointness declarations, unless you have a reasoner running. With a reasoner running, you could ask whether B is disjoint from A. Even so, it might not be consistent for *some particular* instance of B to be an instance of A, even if A and B aren't, in general disjoint. Once you've got a reasoner running: * You could check whether A and B are disjoint. * You could check whether a *some particular instance* of B is an instance of *the complement of A* (i.e., not A). If the reasoner can guarantee that it is, then (since it can't be an instance of A and of not A), then that instance can't be an instance of A. I know the Jena rule-based reasoners aren't complete for OWL, so I don't know whether they'll cover these cases or not. Others (e.g., Pellet) are available that should cover these cases. //JT -- Joshua Taylor, http://www.cs.rpi.edu/~tayloj/
