Search in sources :

Example 1 with ModelSentence

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;
}
Also used : ModelSentence(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence) AbstractFilterNode(com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.AbstractFilterNode) ModelAttributeMappingCell(com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelAttributeMappingCell) ModelStaticAssignmentCell(com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelStaticAssignmentCell) ModelMappingCondition(com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelMappingCondition)

Example 2 with ModelSentence

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;
}
Also used : Implies(org.w3._2007.rif.Implies) Exists(org.w3._2007.rif.Exists) ThenPart(org.w3._2007.rif.ThenPart) Do(org.w3._2007.rif.Do) ModelSentence(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence) Sentence(org.w3._2007.rif.Sentence) If(org.w3._2007.rif.If)

Example 3 with ModelSentence

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;
}
Also used : ModelSentence(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence) Payload(org.w3._2007.rif.Payload) Document(org.w3._2007.rif.Document) ModelRifDocument(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument) GroupContents(org.w3._2007.rif.GroupContents)

Aggregations

ModelSentence (com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence)3 ModelAttributeMappingCell (com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelAttributeMappingCell)1 ModelMappingCondition (com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelMappingCondition)1 ModelStaticAssignmentCell (com.onespatial.jrc.tns.oml_to_rif.model.alignment.ModelStaticAssignmentCell)1 ModelRifDocument (com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument)1 AbstractFilterNode (com.onespatial.jrc.tns.oml_to_rif.model.rif.filter.nonterminal.AbstractFilterNode)1 Do (org.w3._2007.rif.Do)1 Document (org.w3._2007.rif.Document)1 Exists (org.w3._2007.rif.Exists)1 GroupContents (org.w3._2007.rif.GroupContents)1 If (org.w3._2007.rif.If)1 Implies (org.w3._2007.rif.Implies)1 Payload (org.w3._2007.rif.Payload)1 Sentence (org.w3._2007.rif.Sentence)1 ThenPart (org.w3._2007.rif.ThenPart)1