Skip to content

Commit

Permalink
Add dynamic configuration for OAILoader and OntologyMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph6x committed Aug 4, 2017
1 parent f21dfe8 commit 89fe693
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 17 deletions.
7 changes: 7 additions & 0 deletions modeling/GetPropertiesOWL/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@
<artifactId>misctools</artifactId>
<version>${project.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.6</version>
</dependency>

</dependencies>
<name>GetPropertiesOWL-Plugin</name>
</project>
7 changes: 7 additions & 0 deletions modeling/ontology-mapping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@
<artifactId>misctools</artifactId>
<version>${project.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.6</version>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

import com.ucuenca.misctools.DatabaseLoader;
import com.ucuenca.pentaho.plugin.step.r2rml.DataTypeProcessor;
import org.pentaho.di.ui.core.widget.TextVar;

/**
* This class is part of the demo step plug-in implementation.
Expand Down Expand Up @@ -128,7 +129,7 @@ public class OntoMapDialog extends BaseStepDialog implements StepDialogInterface
private FormData fdlStep2, fdStep2;

private Label wlBaseURI;
private Text wBaseURI;
private TextVar wBaseURI;
private FormData fdlBaseURI, fdBaseURI;

private Label wlOutputDir;
Expand Down Expand Up @@ -350,7 +351,7 @@ public void handleEvent( Event e ) {
fdlBaseURI.right = new FormAttachment( middle, -margin );
fdlBaseURI.top = new FormAttachment( wStep2, margin );
wlBaseURI.setLayoutData( fdlBaseURI );
wBaseURI = new Text( shell, SWT.SINGLE | SWT.LEFT | SWT.MEDIUM | SWT.BORDER );
wBaseURI = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.MEDIUM | SWT.BORDER );
wBaseURI.setText( "http://" );
props.setLook( wBaseURI );
wBaseURI.addModifyListener( lsMod );
Expand All @@ -359,7 +360,7 @@ public void handleEvent( Event e ) {
fdBaseURI.top = new FormAttachment( wStep2, margin );
fdBaseURI.right = new FormAttachment( 80, 0 );
wBaseURI.setLayoutData( fdBaseURI );
wBaseURI.addSelectionListener(inputStepLs);
//wBaseURI.addSelectionListener(inputStepLs);

wlOutputDir=new Label(shell, SWT.RIGHT | SWT.MEDIUM);
wlOutputDir.setText( BaseMessages.getString( PKG, "OntologyMapping.OutputDir.Label" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ public class OntoMapMeta extends BaseStepMeta implements StepMetaInterface {
private String outputDir;
private List<String> sqlStack = new ArrayList<String>();
private String outFileName;

private OntoMap Environment;

public OntoMap getEnvironment() {
return Environment;
}

public void setEnvironment(OntoMap Environment) {
this.Environment = Environment;
}


public String getOutFileName() {
Expand Down Expand Up @@ -125,7 +135,11 @@ public void setSqlStack(List<String> sqlStack) {
public String getMapBaseURI() {
return mapBaseURI;
}
public String getEnvMapBaseURI() {
return Environment.environmentSubstitute(mapBaseURI);
}


public void setMapBaseURI(String mapBaseURI) {
this.mapBaseURI = mapBaseURI;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public R2RMLGenerator(StepMetaInterface smi, StepDataInterface sdi) throws Kettl
try {
meta = (OntoMapMeta) smi;
data = (OntoMapData) sdi;
baseURI = meta.getMapBaseURI();
baseURI = meta.getEnvMapBaseURI();
sqlClassificationRows += data.CLASSIFICATIONTABLE + " WHERE TRANSID = ? AND STEPID = ?";
sqlAnnotationRows += data.ANNOTATIONTABLE + " WHERE TRANSID = ? AND STEPID = ? AND ENTITY_CLASSID = ?";
sqlRelationRows += data.RELATIONTABLE + " WHERE TRANSID = ? AND STEPID = ?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void init_ResumptionToken(StepMetaInterface smi, StepDataInterface sdi) t
public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
// Casting to step-specific implementation classes is safe
OAILoaderMeta meta = (OAILoaderMeta) smi;
meta.setTransEnvironment(this);
OAILoaderData data = (OAILoaderData) sdi;
data.getDataLoader().setBaseStep(this);
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ public void initOAIHarvester(OAILoaderMeta meta, OAILoaderData data,
data.resumptionToken = data.initialResumptionToken;
dataLoader.logBasic("Resuming harvesting from "
+ data.resumptionToken); // Some basic logging
data.listRecords = new ListRecords(meta.getInputURI(),
data.listRecords = new ListRecords(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken, data.schema);
data.listSet = new ListSets(meta.getInputURI(),
data.listSet = new ListSets(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
} else {
data.resumptionToken = "";
data.listRecords = new ListRecords(meta.getInputURI(),
data.listRecords = new ListRecords(meta.getEnvironmentSubstituteInputURI(),
data.fromDate, data.untilDate, data.set,
meta.getPrefix(), data.schema);
data.listSet = new ListSets(meta.getInputURI());
data.listSet = new ListSets(meta.getEnvironmentSubstituteInputURI());
}
this.loadListSets(meta, data);
this.databaseLoad = databaseLoad;
Expand Down Expand Up @@ -204,23 +204,23 @@ private void loadListSets(OAILoaderMeta meta, OAILoaderData data)
try {
// listRecords = new ListRecords(url_str,
// resumptionToken);
listSet = new ListSets(meta.getInputURI(),
listSet = new ListSets(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
} catch (IOException e) {
dataLoader
.logBasic("IOException while trying to resume from "
+ resumptionToken + ", trying again.");
// listRecords = new ListRecords(url_str,
// resumptionToken);
listSet = new ListSets(meta.getInputURI(),
listSet = new ListSets(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
} catch (SAXException e) {
dataLoader
.logBasic("SAXException while trying to resume from "
+ resumptionToken + ", trying again.");
// listRecords = new ListRecords(url_str,
// resumptionToken);
listSet = new ListSets(meta.getInputURI(),
listSet = new ListSets(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
}
}
Expand Down Expand Up @@ -380,7 +380,7 @@ public Boolean getData(StepMetaInterface smi, StepDataInterface sdi)
dataLoader.logBasic("Resuming harvesting from "
+ data.resumptionToken);
try {
data.listRecords = new ListRecords(meta.getInputURI(),
data.listRecords = new ListRecords(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
this.header = null;
} catch (IOException e) {
Expand All @@ -401,7 +401,7 @@ public Boolean getData(StepMetaInterface smi, StepDataInterface sdi)
+ data.resumptionToken
+ ", trying again.");

data.listRecords = new ListRecords(meta.getInputURI(),
data.listRecords = new ListRecords(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);
this.header = null;
}
Expand All @@ -411,7 +411,7 @@ public Boolean getData(StepMetaInterface smi, StepDataInterface sdi)
+ data.resumptionToken
+ ", trying again.");

data.listRecords = new ListRecords(meta.getInputURI(),
data.listRecords = new ListRecords(meta.getEnvironmentSubstituteInputURI(),
data.resumptionToken);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.pentaho.di.ui.core.widget.TextVar;
import org.pentaho.di.core.Const;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.i18n.BaseMessages;
Expand Down Expand Up @@ -91,7 +92,7 @@ public class OAILoaderDialog extends BaseStepDialog implements

// componentes de la interface
private Label lbURI;
private Text txtURI;
private TextVar txtURI;

private Label lbResponseDateField;
private Text txtResponseDateField;
Expand Down Expand Up @@ -294,7 +295,7 @@ public void widgetSelected(SelectionEvent e) {
fdlbURI.top = new FormAttachment(txtResponseDateField, margin);
lbURI.setLayoutData(fdlbURI);

txtURI = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
txtURI = new TextVar(transMeta,shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
txtURI.setText(meta.getInputURI());
props.setLook(txtURI);
txtURI.addModifyListener(lsMod);
Expand Down Expand Up @@ -571,7 +572,6 @@ public void run() {
*/
private void populateDialog() {
wStepname.selectAll();

if (!meta.getInputURI().equals("Input URI")) {
prefix = meta.getPrefix();
listPrefix(meta.getInputURI());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public class OAILoaderMeta extends BaseStepMeta implements StepMetaInterface {
private String stepName;

private String ResponseDateField;

private OAILoader TransEnvironment;

/**
* Constructor should call super() to make sure the base class has a chance
Expand Down Expand Up @@ -328,6 +330,24 @@ public void check(List<CheckResultInterface> remarks, TransMeta transmeta, StepM
}

//get and set

public OAILoader getTransEnvironment() {
return TransEnvironment;
}

public void setTransEnvironment(OAILoader TransEnviroment) {
this.TransEnvironment = TransEnviroment;
}



public String getEnvironmentSubstituteInputURI() {
return TransEnvironment.environmentSubstitute(inputURI);
}




public String getInputURI() {
return inputURI;
}
Expand Down

0 comments on commit 89fe693

Please sign in to comment.