Java2OWL
Class PropertyWrapper

Object
  extended by PropertyWrapper
Direct Known Subclasses:
PropertyWrapperMappingRelational

public abstract class PropertyWrapper
extends Object

This class represents the correspondences between Java accessor groups and OWL-Properties.

This is an abstract superclass for several classes specific for accessor group types.

Methods in several Java class can be mapped to the same OWL-Property. An example is a "has-part"-property which may occur in different Java classes, but is mapped to a single OWL-Property. Different methods in the same class, however, cannot be mapped to same OWL-property. Properties may be data properties and object properties.

Typical application:
A new PropertyWrapper is created for the first occurrence of a getter-method to be mapped to OWL. Further getter-methods in other classes to be mapped to the same OWL-property are added by the join-method. As soon as all methods have been processed, getInconsistencies() can be called to check for internal inconsistencies. If there are no inconsistencies, createOWLAxioms can be called to get the corresponding OWL-Axioms for the OWL-Property.

Notice that a PropertyWrapper need not analyse and store all setter, adder and remover methods, because the J2OSynchroniser analyses the annotations separately. A PropertyWrapper needs only store the information which is necessary for the compilation of Java to OWL.


Field Summary
protected  boolean addRangeAxiom
          controls whether range axioms should be added to the OWL-axioms
protected  boolean asymmetric
           
protected  Class currentClass
          is only used during construction of join.
protected  PropertyWrapperComponent currentPWC
          is only used during construction of join.
protected  boolean irreflexive
           
protected  boolean isFunctional
          indicates a functional property.
protected  Map<Object,OWLProperty> key2Property
          for Mapping properties: maps keys to OWL properties
protected  Logging logger
          for logging messages.
protected  J2OManager manager
          the top manager.
protected  String name
          the OWL-name of the property.
protected  OWLProperty property
          the corresponding OWL-property.
protected  Map<Class,PropertyWrapperComponent> pwComponents
          maps the owner class to the component.
protected  boolean reflexive
           
protected  boolean symmetric
           
protected  boolean transitive
           
 
Method Summary
protected abstract  boolean determineClasses(StringBuffer errors)
          determines the key class and the range class of the getter method
protected  Method findAccessor(String accessorType, String annotation, boolean required, StringBuffer errors, StringBuffer warnings)
          Searches for a method of the given accessor type.
protected abstract  void findAccessors(J2OWLProperty annotation, StringBuffer errors, StringBuffer warnings)
          finds all setter, getter, adder, remover, clearer, getKey methods.
 String toString()
          returns a description of the PropertyWrapper
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

manager

protected J2OManager manager
the top manager.


logger

protected Logging logger
for logging messages.


name

protected String name
the OWL-name of the property.


property

protected OWLProperty property
the corresponding OWL-property.


pwComponents

protected Map<Class,PropertyWrapperComponent> pwComponents
maps the owner class to the component.

Different getter methods in different classes can be mapped to the same OWL proprty. Therefore we need a data structure for each occurrence.


currentPWC

protected PropertyWrapperComponent currentPWC
is only used during construction of join.


currentClass

protected Class currentClass
is only used during construction of join.


isFunctional

protected boolean isFunctional
indicates a functional property.


symmetric

protected boolean symmetric

asymmetric

protected boolean asymmetric

reflexive

protected boolean reflexive

irreflexive

protected boolean irreflexive

transitive

protected boolean transitive

addRangeAxiom

protected boolean addRangeAxiom
controls whether range axioms should be added to the OWL-axioms


key2Property

protected Map<Object,OWLProperty> key2Property
for Mapping properties: maps keys to OWL properties

Method Detail

findAccessor

protected Method findAccessor(String accessorType,
                              String annotation,
                              boolean required,
                              StringBuffer errors,
                              StringBuffer warnings)
Searches for a method of the given accessor type.

Parameters:
accessorType - the type of the accessor.
annotation - the annotation for the accessorType, a comma separated names of the accessor methods.
required - if true then an accessor of the type is required.
errors - for collecting error messages.
warnings - the collection of warnings.
Returns:
the accessor method or null if none could be found.

All accessor methods are type checked, but only one is returned.


determineClasses

protected abstract boolean determineClasses(StringBuffer errors)
determines the key class and the range class of the getter method

Parameters:
errors - collects error messages.
Returns:
true if the classes are okay.

findAccessors

protected abstract void findAccessors(J2OWLProperty annotation,
                                      StringBuffer errors,
                                      StringBuffer warnings)
finds all setter, getter, adder, remover, clearer, getKey methods.


toString

public String toString()
returns a description of the PropertyWrapper

Overrides:
toString in class Object