Skip to content

Commit

Permalink
Fix: prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
mosoriob committed Jul 9, 2019
1 parent ac49ad4 commit eaa50b2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/edu/isi/wings/opmm/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public class Constants {
//new props
public static final String OPMW_DATA_PROP_HAS_RUN_ID = PREFIX_OPMW + "hasRunID";
public static final String OPMW_DATA_PROP_HAD_INVOCATION_COMMAND = PREFIX_OPMW + "hadInvocationCommand";
public static final String OPMW_DATA_PROP_HAD_START_TIME = PREFIX_OPMW + "hadStarTime";
public static final String OPMW_DATA_PROP_HAD_START_TIME = PREFIX_OPMW + "hadStartTime";
public static final String OPMW_DATA_PROP_HAD_END_TIME = PREFIX_OPMW + "hadEndTime";
public static final String OPMW_DATA_PROP_RELEASE_VERSION= PREFIX_OPMW + "releaseVersion";

Expand Down
14 changes: 10 additions & 4 deletions src/main/java/edu/isi/wings/opmm/WorkflowExecutionExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class WorkflowExecutionExport {
private final String exportName;//needed to pass it on to template exports
private String transformedExecutionURI;
private WorkflowTemplateExport concreteTemplateExport;

public boolean isExecPublished() {
return isExecPublished;
}

private boolean isExecPublished;

public void setUploadURL(String uploadURL) {
Expand Down Expand Up @@ -176,7 +181,7 @@ private String convertExecutionToOPMW(Individual wingsExecution) {
expandedTemplateURI = rs.next().getResource("?expTemplate").getNameSpace();//the namespace is better for later.
System.out.println("Execution expanded template " + expandedTemplateURI + " loaded successfully");
//publish expanded template. The expanded template will publish the template if necessary.
concreteTemplateExport = new WorkflowTemplateExport(expandedTemplateURI, this.componentCatalog, this.exportName, this.endpointURI, this.domain);
concreteTemplateExport = new WorkflowTemplateExport(expandedTemplateURI, this.componentCatalog, this.exportName, this.endpointURI, this.domain,true);
concreteTemplateExport.transform();
System.out.println(concreteTemplateExport.getTransformedTemplateIndividual());
} else {
Expand Down Expand Up @@ -359,17 +364,18 @@ private String uploadFile(String filePath) {
* Function that exports the transformed template in OPMW. This function should be called after
* "transform". If not, it will call transform() automatically.
*
* @param outFilePath path where to write the serialized model
* @param filepath path where to write the serialized model
* @param serialization serialization of choice: RDF/XML, TTL, etc.
*/
public void exportAsOPMW(String outFilePath, String serialization) {
public String exportAsOPMW(String filepath, String serialization) {
if (transformedExecutionURI == null) {
this.transform();
}
if (!isExecPublished) {
//opmwModel.write(System.out, "TTL");
ModelUtils.exportRDFFile(outFilePath + File.separator + opmwModel.getResource(transformedExecutionURI).getLocalName(), opmwModel, serialization);
ModelUtils.exportRDFFile(filepath, opmwModel, serialization);
}
return transformedExecutionURI;
}

/**
Expand Down
23 changes: 17 additions & 6 deletions src/main/java/edu/isi/wings/opmm/WorkflowTemplateExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ public boolean isTemplatePublished() {

private boolean isTemplatePublished;//boolean value to know if the template has already been published on the repository
private final String exportName;//needed to pass it on to template exports

public WorkflowTemplateExport getAbstractTemplateExport() {
return abstractTemplateExport;
}

private WorkflowTemplateExport abstractTemplateExport;//a template may implement a template, and therefore publish its abstract template (on a separate file)
private String domain;
private boolean isConcreteTemplate;
private String filepath;
//private OntModel PplanModel;//TO IMPLEMENT AT THE END. Can it be done with constructs?


Expand All @@ -49,7 +56,7 @@ public boolean isTemplatePublished() {
* @param exportName name of the dataset to export (will be part of the URI)
* @param endpointURI
*/
public WorkflowTemplateExport(String templateFile, Catalog catalog, String exportName, String endpointURI, String domain) {
public WorkflowTemplateExport(String templateFile, Catalog catalog, String exportName, String endpointURI, String domain, boolean isConcrete) {
this.wingsTemplateModel = ModelUtils.loadModel(templateFile);
this.opmwModel = ModelUtils.initializeModel(opmwModel);
this.componentCatalog = catalog;
Expand All @@ -58,6 +65,7 @@ public WorkflowTemplateExport(String templateFile, Catalog catalog, String expor
isTemplatePublished = false;
this.exportName = exportName;
this.domain = domain;
this.isConcreteTemplate = isConcrete;
}

/**
Expand Down Expand Up @@ -210,7 +218,7 @@ private String convertTemplateToOPMW(Individual wingsTemplate, int versionNumber
if(rsD.hasNext()){
//publish abstract template with the URI taken from derivation
QuerySolution qs = rsD.next();
this.abstractTemplateExport = new WorkflowTemplateExport(qs.getResource("?dest").getURI(), componentCatalog, exportName, endpointURI, domain);
this.abstractTemplateExport = new WorkflowTemplateExport(qs.getResource("?dest").getURI(), componentCatalog, exportName, endpointURI, domain,false);
abstractTemplateExport.transform();
abstractTemplateInstance = abstractTemplateExport.getTransformedTemplateIndividual();
System.out.println("Abstract template: "+abstractTemplateInstance.getURI());
Expand Down Expand Up @@ -365,17 +373,20 @@ private String convertTemplateToOPMW(Individual wingsTemplate, int versionNumber
/**
* Function that exports the transformed template in OPMW. This function should be called after
* "transform". If not, it will call transform() automatically.
* @param outFileDirectory path where to write the serialized model
* @param filepath path of the file where to write the template
* @param serialization serialization of choice: RDF/XML, TTL, etc.
* @return
*/
public String exportAsOPMW(String outFileDirectory, String serialization){
public String exportAsOPMW(String filepath, String serialization){
if(transformedTemplate == null){
this.transform();
}
if(!isTemplatePublished){
//opmwModel.write(System.out, "TTL");
ModelUtils.exportRDFFile(outFileDirectory+File.separator+transformedTemplate.getLocalName()+"_opmw", opmwModel, serialization);
if(this.abstractTemplateExport!=null){
abstractTemplateExport.exportAsOPMW(filepath,serialization);
}
ModelUtils.exportRDFFile(filepath, opmwModel, serialization);
}
return transformedTemplate.getURI();
}
Expand Down Expand Up @@ -430,7 +441,7 @@ public static void main(String[] args){
String templatePath = "http://datascience4all.org/wings-portal/export/users/admin/mint/workflows/storyboard_isi_cag_64kpzcza7.owl";
String domain = "mint";
Catalog c = new Catalog(domain, "testExport", "domains", taxonomyURL);
WorkflowTemplateExport w = new WorkflowTemplateExport(templatePath, c, "exportTest", "http://localhost:3030/test/query", domain);
WorkflowTemplateExport w = new WorkflowTemplateExport(templatePath, c, "exportTest", "http://localhost:3030/test/query", domain,true);
w.exportAsOPMW(".", "TTL");
c.exportCatalog(null, "RDF/XML");
}
Expand Down

0 comments on commit eaa50b2

Please sign in to comment.