You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Elements of core language often represent concepts from application domain or another languages, yet there's no easy way to map them back. For example, after translation from Argumentation Frameworks to Alpha I have to maintain clumsy mappings from Alpha's atoms back to domain objects. Synthetic predicates also need mapping especially for 1-to-many translations to recover meaning of answer set elements. Ideally, I would attach arbitrary object or hash map.
Note that this is not the same functionality as provided by ConstantTerm.getObject() which references representation e.g. a string from textual file after parsing. I need to resolve that string into some domain object and have the constant still refer both.
Rules, Predicates, Atoms and Terms could implement sth like:
interface Taggable {
public void setTag(Object tag);
public Object getTag();
}
The text was updated successfully, but these errors were encountered:
Could you please share more code, just so that I can understand the problem better? Ideally your "real" code base or, if that's not possible, an example.
I am asking for this, in order to understand why objects wrapped in ConstantTerms are not suitable. Not only strings but arbitrary domain objects can be wrapped.
Also note that #274 will likely improve Alpha's API.
@jblaszczyk from your description I'm assuming you were thinking of some "hibernate-esque" way of automatic mapping such as tagging classes with an annotation like @Entity and having the actual atom <-> object conversion done automagically using reflection or some such.
e.g.:
// Java
@Predicate(name="mapped_thing")
class MappedThing {
@Argument(1)
private String property1;
@Argument(2)
private String property2;
}
%% ASP
mapped_thing("prop1_value", "prop2_value").
I've thought about this a bit because I'd also like to get rid of those repetitive manual approaches, but I could see something as outlined above become complicated and intransparent pretty fast.
I introduced the interface AnswerSetToObjectMapper a while back as a first baby-step towards standardizing these kinds of mappings. Right now there are no generic implementations (and unfortunately nothing for the "Object -> Set of Facts" direction), but you might be able to do an implementation using for example Dozer that can handle simple objects relatively easily.
Elements of core language often represent concepts from application domain or another languages, yet there's no easy way to map them back. For example, after translation from Argumentation Frameworks to Alpha I have to maintain clumsy mappings from Alpha's atoms back to domain objects. Synthetic predicates also need mapping especially for 1-to-many translations to recover meaning of answer set elements. Ideally, I would attach arbitrary object or hash map.
Note that this is not the same functionality as provided by ConstantTerm.getObject() which references representation e.g. a string from textual file after parsing. I need to resolve that string into some domain object and have the constant still refer both.
Rules, Predicates, Atoms and Terms could implement sth like:
The text was updated successfully, but these errors were encountered: