use of org.w3._2007.rif.Do.Actions in project hale by halestudio.
the class ModelRifToRifTranslator method createTargetInstanceMembershipFormula.
private Assert createTargetInstanceMembershipFormula(Actions actions, ModelSentence sentence, RifVariable instanceVariable) {
Assert assert1 = factory.createAssert();
Target target = factory.createAssertTarget();
Member member = factory.createMember();
Instance instance = factory.createInstance();
Var var = factory.createVar();
var.getContent().add(instanceVariable.getName());
instance.setVar(var);
member.setInstance(instance);
org.w3._2007.rif.Class clazz = factory.createClass();
Const const1 = factory.createConst();
// $NON-NLS-1$
const1.setType("rif:iri");
const1.getContent().add(instanceVariable.getClassName());
clazz.setConst(const1);
member.setClazz(clazz);
target.setMember(member);
assert1.setTarget(target);
return assert1;
}
use of org.w3._2007.rif.Do.Actions in project hale by halestudio.
the class ModelRifToRifTranslator method processChildren.
private void processChildren(ModelSentence s, final Exists exists, Do do1) {
Formula existsFormula = factory.createFormula();
And and = factory.createAnd();
existsFormula.setAnd(and);
exists.setFormula(existsFormula);
Actions actions = factory.createDoActions();
do1.setActions(actions);
for (RifVariable instanceVariable : s.getVariables(Type.INSTANCE)) {
// source instance variables
if (!instanceVariable.isActionVar()) {
recurseChildren(exists, do1, instanceVariable, s, true);
} else // target instance variables
{
recurseChildren(exists, do1, instanceVariable, s, false);
}
}
Map<RifVariable, Frame> map = new LinkedHashMap<RifVariable, Frame>();
for (PropertyMapping mapping : s.getPropertyMappings()) {
RifVariable contextVariable = mapping.getTarget().getContextVariable();
Frame match = map.get(contextVariable);
if (match == null) {
map.put(contextVariable, initialiseFrame(contextVariable));
}
}
for (StaticAssignment staticAssignment : s.getStaticAssignments()) {
RifVariable contextVariable = staticAssignment.getTarget().getContextVariable();
Frame match = map.get(contextVariable);
if (match == null) {
map.put(contextVariable, initialiseFrame(contextVariable));
}
}
for (PropertyMapping mapping : s.getPropertyMappings()) {
Frame frame = map.get(mapping.getTarget().getContextVariable());
createAssignmentSlot(mapping, frame);
}
for (StaticAssignment staticAssignment : s.getStaticAssignments()) {
Frame frame = map.get(staticAssignment.getTarget().getContextVariable());
createStaticAssignmentSlot(staticAssignment, frame);
}
for (ModelRifMappingCondition mappingCondition : s.getMappingConditions()) {
createFilter(exists.getFormula().getAnd().getFormula(), mappingCondition);
}
for (Frame frame : map.values()) {
Assert assert1 = factory.createAssert();
Target target = factory.createAssertTarget();
target.setFrame(frame);
assert1.setTarget(target);
actions.getACTION().add(assert1);
}
}
Aggregations