use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence in project hale by halestudio.
the class ModelAlignmentToModelRifTranslator method buildModelSentance.
private ModelSentence buildModelSentance(ModelClassMappingCell classMapping, List<ModelAttributeMappingCell> attributeMappings, List<ModelStaticAssignmentCell> staticAssignments) {
ModelSentence sentence = new ModelSentence();
sentence.setSourceClass(// $NON-NLS-1$
classMapping.getSourceClass().getElementName().getLocalPart().toLowerCase() + "-instance", getName(classMapping.getSourceClass().getElementName()));
sentence.setTargetClass(// $NON-NLS-1$
classMapping.getTargetClass().getElementName().getLocalPart().toLowerCase() + "-instance", getName(classMapping.getTargetClass().getElementName()));
for (ModelMappingCondition condition : classMapping.getMappingConditions()) {
sentence.addMappingCondition(buildRifMappingCondition(sentence, (AbstractFilterNode) condition.getRoot()));
}
for (ModelAttributeMappingCell attributeMapping : attributeMappings) {
buildPropertyMapping(sentence, attributeMapping);
}
for (ModelStaticAssignmentCell staticAssigment : staticAssignments) {
buildStaticAssignment(sentence, staticAssigment);
}
return sentence;
}
use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence in project hale by halestudio.
the class ModelRifToRifTranslator method buildSentence.
private Sentence buildSentence(ModelSentence s) {
// sort variables within sentence
final Sentence sentence = factory.createSentence();
final Implies implies = factory.createImplies();
sentence.setImplies(implies);
final If if1 = factory.createIf();
implies.setIf(if1);
final Exists exists = factory.createExists();
if1.setExists(exists);
ThenPart then = factory.createThenPart();
implies.setThen(then);
Do do1 = factory.createDo();
then.setDo(do1);
processChildren(s, exists, do1);
return sentence;
}
use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence in project hale by halestudio.
the class ModelRifToRifTranslator method translate.
/**
* @see com.onespatial.jrc.tns.oml_to_rif.api.Translator#translate(Object)
* which this method implements.
* @param source
* {@link ModelRifDocument}
* @return {@link Document}
* @throws TranslationException
* if any exceptions are thrown during translation.
*/
@Override
public Document translate(ModelRifDocument source) throws TranslationException {
final Document document = factory.createDocument();
Payload payload = factory.createPayload();
document.setPayload(payload);
GroupContents group = factory.createGroupContents();
payload.setGroup(group);
for (ModelSentence s : source.getSentences()) {
group.getSentence().add(buildSentence(s));
}
return document;
}
Aggregations