JavaClassTransformator.java revision 31
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainenpackage impl.owls.grounding;
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenimport org.mindswap.owl.OWLClass;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenimport org.mindswap.owl.OWLIndividual;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenimport org.mindswap.owl.OWLKnowledgeBase;
503a863a317acba125a4e46435694e35fad769e4Timo Sirainenimport org.mindswap.owl.OWLTransformator;
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainenimport org.mindswap.owl.OWLValue;
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen/**
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen *
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen * @author Michael D�nzer, University of Zurich
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen * @date 20.03.2007
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen */
ef174bf5299348e8c0662d235341869f319cfe54Timo Sirainenpublic abstract class JavaClassTransformator implements OWLTransformator {
86bde2c1838d1ce967fa2b394bb952004a4adcb7Timo Sirainen protected OWLClass owlClass;
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen protected Class javaClass;
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen protected OWLKnowledgeBase kb;
86bde2c1838d1ce967fa2b394bb952004a4adcb7Timo Sirainen
86bde2c1838d1ce967fa2b394bb952004a4adcb7Timo Sirainen public JavaClassTransformator(OWLKnowledgeBase kb) {
86bde2c1838d1ce967fa2b394bb952004a4adcb7Timo Sirainen super();
86bde2c1838d1ce967fa2b394bb952004a4adcb7Timo Sirainen setKB(kb);
605eca549c08af753e05c25937bcccd66079c321Timo Sirainen }
605eca549c08af753e05c25937bcccd66079c321Timo Sirainen
6646bd844c85d5b27451199d8868b6d2357cd293Timo Sirainen public void setKB(OWLKnowledgeBase kb) {
6646bd844c85d5b27451199d8868b6d2357cd293Timo Sirainen this.kb = kb;
4fb98a31d0e4f67978a98a83a5895472b2da0401Timo Sirainen }
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen public void setOWLClass(OWLClass owlClass) {
ef174bf5299348e8c0662d235341869f319cfe54Timo Sirainen this.owlClass = owlClass;
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen }
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen public void setJavaClass(Class javaClass) {
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen this.javaClass = javaClass;
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen }
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen
e34d170f8f0e084bd94bfbc1a7085ece67e508dfTimo Sirainen public OWLClass getOWLClass() {
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen return owlClass;
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen }
461ffead9720d1e516b959d5e41f049c73d38c7cTimo Sirainen
ef174bf5299348e8c0662d235341869f319cfe54Timo Sirainen public Class getJavaClass() {
68a4946b12583b88fa802e52ebee45cd96056772Timo Sirainen return javaClass;
68a4946b12583b88fa802e52ebee45cd96056772Timo Sirainen }
e4cebacdec9c9e5b685dde5f7cbf7a5cf7e1d248Timo Sirainen
e4cebacdec9c9e5b685dde5f7cbf7a5cf7e1d248Timo Sirainen public abstract Object transformFromOWL(OWLValue ind);
68a4946b12583b88fa802e52ebee45cd96056772Timo Sirainen
9905ec03fb2011419caeac4cd5a1b6c28ab50a73Timo Sirainen public abstract OWLValue transformToOWL(Object object);
68a4946b12583b88fa802e52ebee45cd96056772Timo Sirainen
503a863a317acba125a4e46435694e35fad769e4Timo Sirainen protected OWLIndividual getIndividual(OWLValue value) {
90b50df264b57e0f63cd8cc6aea1ce3bb7cf5f64Timo Sirainen if (value.isDataValue())
90b50df264b57e0f63cd8cc6aea1ce3bb7cf5f64Timo Sirainen return null;
90b50df264b57e0f63cd8cc6aea1ce3bb7cf5f64Timo Sirainen else
90b50df264b57e0f63cd8cc6aea1ce3bb7cf5f64Timo Sirainen return (OWLIndividual) value.castTo(OWLIndividual.class);
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen }
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen}
5fdeff082e329e4a85bb7e74aaec2c35e2288557Timo Sirainen