Skip to content
Snippets Groups Projects
Commit e1317b7f authored by Bernhard Johannes Berger's avatar Bernhard Johannes Berger
Browse files

Implementing #3. The conversion is successfully tested. A practical test with...

Implementing #3. The conversion is successfully tested. A practical test with reading the Arff directly in the training is still missing.
parent 2fe39c46
No related branches found
No related tags found
No related merge requests found
Pipeline #243450 failed
#!/bin/bash
source $( cd -- "$(dirname $0)/" >/dev/null 2>&1 ; pwd -P)/paths.env
if [ "$#" -ne 4 ]; then
echo "Usage: $0 <execution-folder> <input.arff> <specification.ddl> <output.json>"
exit 1
fi
cd $1
set -x
java -Dorg.jboss.logging.provider=slf4j\
--module-path "${EVOALPATH}/modules/:$PLUGIN_PATHS" \
--add-modules ALL-MODULE-PATH \
--add-opens java.base/java.lang=guice \
-m de.evoal.core/de.evoal.core.main.Evoal \
-Bcore:main=convert-arff-to-json \
-Barff:input=$2 \
-Barff:ddl-specification=$3 \
-Barff:output=$4
......@@ -15,6 +15,7 @@ import weka.core.converters.ConverterUtils;
import javax.enterprise.context.Dependent;
import javax.inject.Named;
import java.io.File;
import java.util.Arrays;
@Slf4j
@Dependent
......@@ -77,6 +78,10 @@ public class ArffPropertiesReader implements PropertiesReader {
if(RepresentationType.REAL.equals(rType)) {
toProperties = (instance, template, builder) -> {
if(instance.isMissing(index)) {
return decoratee.apply(instance, template, builder);
}
// add current specification to builder and let the chain complete it
builder.add(pSpec);
final Properties properties = decoratee.apply(instance, template, builder);
......@@ -87,6 +92,10 @@ public class ArffPropertiesReader implements PropertiesReader {
};
} else if(RepresentationType.INTEGER.equals(rType)) {
toProperties = (instance, template, builder) -> {
if(instance.isMissing(index)) {
return decoratee.apply(instance, template, builder);
}
// add current specification to builder and let the chain complete it
builder.add(pSpec);
final Properties properties = decoratee.apply(instance, template, builder);
......
......@@ -10,6 +10,7 @@ import de.evoal.core.api.properties.io.PropertiesWriter;
import de.evoal.core.arff.cdi.ArffBlackboardEntry;
import de.evoal.languages.model.ddl.DataDescriptionModel;
import de.evoal.languages.model.ddl.dsl.DataDescriptionLanguageStandaloneSetup;
import de.evoal.languages.model.ddl.impl.DdlPackageImpl;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
......@@ -73,6 +74,8 @@ public class ConvertArff implements MainClass {
}
// init EMF + Xtext
DdlPackageImpl.init();
DataDescriptionLanguageStandaloneSetup.doSetup();
final Injector dlInjector = new DataDescriptionLanguageStandaloneSetup().createInjectorAndDoEMFRegistration();
final XtextResourceSet resourceSet = dlInjector.getInstance(XtextResourceSet.class);
......
......@@ -2,6 +2,7 @@ package de.evoal.core.api.properties;
import de.evoal.languages.model.ddl.DataDescription;
import org.apache.commons.math3.util.Pair;
import org.slf4j.LoggerFactory;
import java.util.*;
import java.util.stream.Collectors;
......@@ -40,8 +41,9 @@ public class PropertiesSpecification {
}
public Builder add(final PropertySpecification specification) {
if (!properties.contains(specification)) {
if(!properties.contains(specification)) {
properties.add(specification);
orderedProperties.add(specification);
}
return this;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment