org.umu.jasb.convert
Class ConvertFactory

java.lang.Object
  extended by org.umu.jasb.convert.ConvertFactory

public class ConvertFactory
extends java.lang.Object

This class contains all the mapping processes used into the architecture and could be seen as the real brigde among the languages offering all the translation primitives.

Author:
Jose Maria Alcaraz-Calero jmalcaraz@um.es - University of Murcia

Field Summary
static boolean ADD_ALL_DIFFERENT
          This configurable constant is for determine if the OWL resultants in the conversion from object instances to the ABox will contains the tag all different or not (if true the performance could be reduced)
 
Constructor Summary
ConvertFactory()
           
 
Method Summary
static java.lang.String convertToOWLABox(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals, java.lang.String ontologyURL)
          This method obtain the dynamic representation of the ontology (the ABox component) from all the object-instances which corforms the domain.
static java.lang.String convertToOWLTBox(java.util.Collection<java.lang.Class> Allclasses, java.lang.String ontologyURL)
          This method obtain the statical representation of the ontology (the TBox component) from all the object-classes which corforms the domain.
private static boolean couldBe(java.util.Collection<java.lang.String> classes, java.lang.Class c)
          This auxiliar method return if a class could be any of the given classes
private static java.lang.String getDatatypeURI(java.lang.reflect.Field field, boolean isObjectProperty, java.lang.String ontologyURL)
          This auxiliar method obtain the OWL Data type URL used for represent the type of the given java class attribute.
private static java.lang.Object getIndividualByURI(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals, java.lang.String individualURI, com.hp.hpl.jena.rdf.model.StmtIterator types, java.util.HashMap<java.lang.String,java.lang.Object> newObject)
          This auxiliar method return the java instance from a given OWL individual URL.
private static java.lang.String getIndividualURI(java.lang.Object individual, java.lang.String ontologyURI)
          This auxiliar method return the OWL individual URL from a given java instance.
static void updateFromOWLABox(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals, com.hp.hpl.jena.rdf.model.Model newFacts)
          This method produce the enforcing of the given set of facts into the java instances.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADD_ALL_DIFFERENT

public static boolean ADD_ALL_DIFFERENT
This configurable constant is for determine if the OWL resultants in the conversion from object instances to the ABox will contains the tag all different or not (if true the performance could be reduced)

Constructor Detail

ConvertFactory

public ConvertFactory()
Method Detail

convertToOWLTBox

public static java.lang.String convertToOWLTBox(java.util.Collection<java.lang.Class> Allclasses,
                                                java.lang.String ontologyURL)
                                         throws ConvertionException
This method obtain the statical representation of the ontology (the TBox component) from all the object-classes which corforms the domain.

Parameters:
Allclasses - This is an array with all the classes that conform the domain
ontologyURL - This is the URL that will be used in the generated OWL
Returns:
Is the OWL representation of the given classes
Throws:
ConvertionException - In the case of any exception during the conversion

convertToOWLABox

public static java.lang.String convertToOWLABox(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals,
                                                java.lang.String ontologyURL)
                                         throws ConvertionException
This method obtain the dynamic representation of the ontology (the ABox component) from all the object-instances which corforms the domain.

Parameters:
Allindividuals - All the registered instances into the architecture which will be transformed to the ABox component.
ontologyURL - This is the URL of the ontology that will be converted
Returns:
The OWL representation of the given instancess
Throws:
ConvertionException - In the case of any exception during the conversion

updateFromOWLABox

public static void updateFromOWLABox(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals,
                                     com.hp.hpl.jena.rdf.model.Model newFacts)
                              throws ConvertionException
This method produce the enforcing of the given set of facts into the java instances. This method makes a real translation of the infered results from reasoning engines to the java instances.

Parameters:
Allindividuals - All the registered instances into the architecture which will be transformed to the ABox component.
newFacts - This is the set of the facts that will be enforcing into the java instances.
Throws:
ConvertionException - In the case of any exception during the conversion

getIndividualByURI

private static java.lang.Object getIndividualByURI(java.util.HashMap<java.lang.Class,java.util.Collection<?>> Allindividuals,
                                                   java.lang.String individualURI,
                                                   com.hp.hpl.jena.rdf.model.StmtIterator types,
                                                   java.util.HashMap<java.lang.String,java.lang.Object> newObject)
This auxiliar method return the java instance from a given OWL individual URL.

Parameters:
Allindividuals - This is the data structure with all the registered instances into the architecture
individualURI - This is the URL that represent the OWL individual that we want to obtain in java instance
types - This iterator contain all the possible classes that could be associated to the given instance
Returns:
Is the java individual of the given OWL individual URL.

couldBe

private static boolean couldBe(java.util.Collection<java.lang.String> classes,
                               java.lang.Class c)
This auxiliar method return if a class could be any of the given classes

Parameters:
classes - This is the list of the classes that we want to check
c - This is the class for which we want to know if is capable to be one of the given classes
Returns:
true if the class could be of some of the given classes or false in otherwise.

getIndividualURI

private static java.lang.String getIndividualURI(java.lang.Object individual,
                                                 java.lang.String ontologyURI)
This auxiliar method return the OWL individual URL from a given java instance.

Parameters:
individual - Is a Java instance for which we want to obtain the URL representation in OWL
ontologyURI - This is the URL that represent the ontology given
Returns:
Is the OWL individual URL representation of the given instance.

getDatatypeURI

private static java.lang.String getDatatypeURI(java.lang.reflect.Field field,
                                               boolean isObjectProperty,
                                               java.lang.String ontologyURL)
                                        throws ConvertionException
This auxiliar method obtain the OWL Data type URL used for represent the type of the given java class attribute.

Parameters:
field - This is the field which we want to know the URL for represent its type
isObjectProperty - true if is an objectProperty or falta in otherwise (Dataproperty)
ontologyURL - This is the URL of the ontology for which the URL is required
Returns:
Is the URL representation of the type of the given java class attribute
Throws:
ConvertionException