|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectIndividualWrapper
public class IndividualWrapper
The instances of this class maintain the correspondences between Java-objects and OWL-individuals.
If OWL-individuals are created from Java-objects then there is a one-to-one correspondence between the two. If, however, Java-objects are created from OWL-individuals then, due to multi-inheritance of OWL and mono-inheritance of Java, a particular OWL-individual may be mapped to several Java-objects. An example is the Amphibious-vehicle as subclass of ship and surface vehicle. It would be mapped to both a Java Ship and a Java SurfaceVehicle.
All methods are thread safe. The monitor is the individual wrapper itself.
Method Summary | |
---|---|
void |
activateSynchronisation(boolean log)
activates Java <-> OWL synchronisation for all objects in the individual wrapper. |
void |
deactivateSynchronisation(boolean log)
activates Java <-> OWL synchronisation for all object in the individual wrapper. |
Set<Object> |
getDataPropertyValues(OWLDataProperty property)
gets a data property value for a data property which has no corresponding field in the objects, or null if an error occurred. |
Object |
getFirstObject()
returns the first Java object. |
OWLNamedIndividual |
getIndividual()
returns the individual. |
String |
getName()
returns a string of the kind 'individual name <-> object name_1, ..., object name_n' |
Object |
getObject(Class jcl)
returns the first object in the stored objects which is an instance of the given class. |
IndividualWrapper[] |
getObjectPropertyValues(OWLObjectProperty property)
gets object properties value for an object property which has no corresponding field in the objects. |
Object[] |
getObjects()
returns all the Java objects. |
String |
getObjectsString()
returns the objects as a |-separated string. |
boolean |
reclassify(boolean forceReclassification)
This method can reclassify the Java objects if the changed attributes puts them into another OWL-concept. |
boolean |
setDataPropertyValue(OWLDataProperty property,
Object value)
sets a data property value for a data property which has no corresponding field in the objects. |
void |
setFieldValue(String name,
Object value)
puts the value into all object's fields with the given name |
boolean |
setObjectPropertyValue(OWLObjectProperty property,
Object value)
sets an object property value for an object property which has no corresponding field in the objects. |
void |
synchroniseWithOWL()
synchronises the attributes of all objects with the properties of the individual. |
String |
toString()
returns a string representation of the individual wrapper. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public OWLNamedIndividual getIndividual()
public Object[] getObjects()
public Object getObject(Class jcl)
jcl
- a Java class
public Object getFirstObject()
public boolean setDataPropertyValue(OWLDataProperty property, Object value)
The value is forwarded to the ontology.
public boolean setObjectPropertyValue(OWLObjectProperty property, Object value)
The value is forwarded to the ontology.
public Set<Object> getDataPropertyValues(OWLDataProperty property)
The value is forwarded to the ontology.
public IndividualWrapper[] getObjectPropertyValues(OWLObjectProperty property)
property
- an OWLObjectProperty
public void setFieldValue(String name, Object value)
name
- the name of a field of some of the objects.value
- the object to be put into the field.
Objects without such a field or if the field is not accessible, are ignored.
This method can be used to put pointer-equal values into the corresponding fields of all objects.
public String getObjectsString()
The method uses the toString() method of the objects.
public void activateSynchronisation(boolean log)
log
- if 'true' then the activation is logged.
All previous changes which have not yet been synchronised get synchronised.
public void deactivateSynchronisation(boolean log)
log
- if 'true' then the deactivation is logged.public void synchroniseWithOWL()
public boolean reclassify(boolean forceReclassification)
Example: Consider a class Student with attribute semester.
Consider a subclass Freshman which are Students in their first semester.
Consider a student Paul in the second semester, which is put back into the first semester.
Now the instance Paul of the class Student should become an instance Paul of the class Freshman.
In detail:
First the OWLIndividual is realised by the OWL-reasoner,
thus getting the lowest classes in the OWL hierarchy.
Then it searches the OWL classes upwards to find the lowest classes which have corresponding
Java classes.
For all these classes C:
No change to the object is done if something goes wrong.
The reclassification has a nondeterminism in the algorithm:
Suppose the individual I has an object property P with filler F (an OWL individual)
Suppose F is mapped to two or more Java Objects o1,o2,...
If property P has a setter S with argument type T, then it is not clear which of the
objects o1,o2,... to be filled into S.
The algorithm chooses the first one whose type is T or a subtype of T.
If none of the objects has an appropriate type then an error is generated.
forceReclassification
- if this flag is false then reclassification is done only if some
attributes have been changed since the last reclassification.
public String getName()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |