|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectJ2OIndividualManager
public class J2OIndividualManager
This class is for mapping Java-Objects to OWL-individuals and vice versa.
It provides the following services:
Since OWL allows for multiple inheritance, and Java does not, the system may map a single OWL-individual to several Java-objects. As an example an instance of a amphibian-vehicle (a subclass of Ship and Surface-Vehicle) would be mapped to both, a ship and a surface-vehicle. The correspondences are kept in the IndividualWrapper structure.
Method Summary | |
---|---|
void |
activateSynchronisation(boolean log,
Object... iwrps)
activates synchronisation for the objects in all given individual wrappers. |
J2OIndividualManager |
addPropertyValue(Object object,
Method getter,
Object key,
Object value)
This method forwards in an adder method the information that an object is to be added. |
void |
clear()
clears all internal data about individuals. |
J2OIndividualManager |
clearPropertyValues(Object object,
Method getter,
Object values)
This method can be called when an already mapped Java-object removes all attribute values. |
void |
deactivateSynchronisation(boolean log,
Object... iwrps)
deactivates synchronisation for the objects in all given individual wrappers. |
J2OIndividualManager |
exchangePropertyValue(Object object,
Method getter,
Object oldValue,
Object newValue)
This method can be called when an already mapped Java-object replaces an attribute value by a new one |
ArrayList<IndividualWrapper> |
getInstances(OWLClassExpression cle)
uses the reasoner to find all instances of the class expression and maps them back to the Java-objects. |
ArrayList<IndividualWrapper> |
getInstances(String cle)
uses the reasoner to find all instances of the class expression and maps them back to the Java-objects. |
IndividualWrapper |
getIWR(Object object)
|
IndividualWrapper |
getIWR(OWLNamedIndividual individual)
|
Set<IndividualWrapper> |
getIWRs(Class jcl)
return the individual wrappers stored for the given class, or null if there are none. |
J2OManager |
getJ2OManager()
returns the top manager. |
String |
getName()
returns the name of the individual manager. |
IndividualWrapper |
individual2Java(OWLNamedIndividual individual)
maps an OWL-individual to corresponding Java-objects. |
static void |
main(String[] args)
|
IndividualWrapper |
object2OWL(Object object)
generates for a Java-object the corresponding OWL-individual. |
void |
reclassify(boolean forceReclassification,
Object... iwrds)
reclassifies all objects in the given individual wrappers. |
J2OIndividualManager |
removePropertyValue(Object object,
Method getter,
Object key,
Object value)
This method can be called when an already mapped Java-object removes an attribute value. |
void |
synchroniseWithOWL(Object... iwrps)
synchronises the objects in the given individual wrappers with the corresponding OWL-individual. |
String |
toString()
|
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public J2OManager getJ2OManager()
public String getName()
public Set<IndividualWrapper> getIWRs(Class jcl)
jcl
- a Java class
public IndividualWrapper getIWR(Object object)
public IndividualWrapper getIWR(OWLNamedIndividual individual)
public void activateSynchronisation(boolean log, Object... iwrps)
iwrps
- are single individual wrappers or arrays or collections of individual wrappers.log
- if 'true' then the activation is logged.public void deactivateSynchronisation(boolean log, Object... iwrps)
iwrps
- are single individual wrappers or arrays or collections of individual wrappers.log
- if 'true' then the deactivation is logged.public void clear()
public IndividualWrapper object2OWL(Object object)
object
- an atomic Java object (no array or collection)
All attributes of the object, which are accessible by the annotated getter methods are also mapped to OWL-individuals. The axioms specifying the new OWL-individuals are generated, but not yet made effective. Therefore you can generate mappings for several Java-objects first and then call applyChanges. If the generation of the mapping fails at some point, no axioms are inserted into the ontology manager.
public J2OIndividualManager addPropertyValue(Object object, Method getter, Object key, Object value)
object
- a Java-object whose attribute value is to be inserted/removedgetter
- the name of the getter methodvalue
- the atomic value to be inserted.
This method is called by the injected synchroniser code in add-methods for attribute values and updates the extension ontology.
public J2OIndividualManager removePropertyValue(Object object, Method getter, Object key, Object value)
object
- a Java-object whose attribute value is to be inserted/removedgetter
- the name of the getter methodvalue
- either the atomic value to be removed, or the key if the property is a functional mapper.
This method is called by the injected synchroniser code in remove-methods for attribute values and updates the extension ontology.
If the property is relational and not a mapper, then the method is called within a remove method: removeItem(item).
If the property is a functional mapper then the method is called within a remove method removeItem(key),
where the actual object to be removed is getter().get(key).
public J2OIndividualManager clearPropertyValues(Object object, Method getter, Object values)
object
- a Java-object whose attribute values are to be removed.getter
- the name of the getter methodvalues
- the values to be removed.
This method is called by the injected synchroniser code in clearer methods for attribute values and updates the extension ontology.
public J2OIndividualManager exchangePropertyValue(Object object, Method getter, Object oldValue, Object newValue)
object
- a Java-object whose attribute value is to be inserted/removedgetter
- a getter-method in the Java-class which is mapped to an OWL-property.oldValue
- the value to be removed.newValue
- the value to be inserted.
This method is called by the injected synchroniser code in setter methods for attribute values. The given method, however, should be the annotated getter-method.
public void synchroniseWithOWL(Object... iwrps)
This method can be called if the object synchronisation has been turned off for a while.
iwrps
- are single individual wrappers, arrays or collection of individual wrappers.
ClassClastException
- if the objects are not individual wrappers.public IndividualWrapper individual2Java(OWLNamedIndividual individual)
individual
- an OWLNamedIndividual
public void reclassify(boolean forceReclassification, Object... iwrds)
iwrds
- single individual wrappers, arrays or collections of individual wrappers.forceReclassification
- if this flag is false then reclassification is done only if some
attributes have been changed since the last reclassification.
ClassCastException
- if the objects are not IndividualWrappers.public ArrayList<IndividualWrapper> getInstances(OWLClassExpression cle)
cle
- an OWLClassExpression.
public ArrayList<IndividualWrapper> getInstances(String cle) throws ParserException
cle
- an OWLClassExpression in Manchester Syntax
ParserException
public String toString()
toString
in class Object
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |