Search in sources :

Example 1 with ModelRifDocument

use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument in project hale by halestudio.

the class TestModelAlignmentToModelRif method testTranslateFilter.

/**
 * Tests that it is possible to run a translation using the example 3 CP
 * source dataset and a predicate filter on the mapping of source classes to
 * the target logical schema.
 *
 * @throws TranslationException
 *             if any errors occurred during the translation
 */
@Test
public void testTranslateFilter() throws TranslationException {
    ModelRifDocument result = translator.translate(getClass().getClassLoader().getResource(// $NON-NLS-1$
    "com/onespatial/jrc/tnstg/proto/oml_to_rif/alignments/example3_cp_filter.goml"));
    assertNotNull(result);
    assertNotNull(result.getSentences());
    assertThat(result.getSentences().size(), is(1));
}
Also used : ModelRifDocument(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument) Test(org.junit.Test)

Example 2 with ModelRifDocument

use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument 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)

Example 3 with ModelRifDocument

use of com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument in project hale by halestudio.

the class TestModelAlignmentToModelRif method testTranslateNegationFilter.

/**
 * Tests that it is possible to run a translation using the example 3 CP
 * source dataset and a logical negation predicate filter on the mapping of
 * source classes to the target logical schema.
 *
 * @throws TranslationException
 *             if any errors occurred during the translation
 */
@Test
public void testTranslateNegationFilter() throws TranslationException {
    ModelRifDocument result = translator.translate(getClass().getClassLoader().getResource(// $NON-NLS-1$
    "com/onespatial/jrc/tnstg/proto/oml_to_rif/alignments/example1_tn_road.goml"));
    assertNotNull(result);
    assertNotNull(result.getSentences());
    // CHECKSTYLE:OFF
    assertThat(result.getSentences().size(), is(3));
// CHECKSTYLE:ON
}
Also used : ModelRifDocument(com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument) Test(org.junit.Test)

Aggregations

ModelRifDocument (com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelRifDocument)3 Test (org.junit.Test)2 ModelSentence (com.onespatial.jrc.tns.oml_to_rif.model.rif.ModelSentence)1 Document (org.w3._2007.rif.Document)1 GroupContents (org.w3._2007.rif.GroupContents)1 Payload (org.w3._2007.rif.Payload)1