As far as I know, Java reflection works with methods. So I need to declare that method with some params, like:
method.invoke(obj, arg1, arg2,...);
I use OWLAPI, so an expression is compositional and I cannot predict the number of args in input (that in some case are recursively nested object). It is something like:
OWLClassExpression a = factory.getOWLClass("A");
OWLClassExpression b = factory.getOWLObjectUnionOf("x", "y", "z");
OWLClassExpression exp = factory.getOWLObjectIntersectionOf(a, b);
As you can see, I cannot predict the number of args and nested expression, but I can generate the whole compositional string I need like:
" OWLClassExpression myexpression = factory.getOWLObjectIntersectionOf(factory.getOWLClass("A"), factory.getOWLObjectUnionOf("x", "y", "z")); "
I just want to execute those arbitrary strings in Java. Any suggestion? Is the Java reflection enough to do this?
Aucun commentaire:
Enregistrer un commentaire