diff --git a/src/main/java/edu/isi/wings/opmm/WorkflowExecutionExport.java b/src/main/java/edu/isi/wings/opmm/WorkflowExecutionExport.java index bad7e61..9108431 100644 --- a/src/main/java/edu/isi/wings/opmm/WorkflowExecutionExport.java +++ b/src/main/java/edu/isi/wings/opmm/WorkflowExecutionExport.java @@ -50,7 +50,7 @@ public void setUploadMaxSize(long uploadMaxSize) { private String uploadPassword; private long uploadMaxSize; //private OntModel provModel;//TO IMPLEMENT AT THE END. Can it be done with constructs? - + private String domain; /** * Default constructor for exporting executions * @@ -59,7 +59,7 @@ public void setUploadMaxSize(long uploadMaxSize) { * @param exportName * @param endpointURI */ - public WorkflowExecutionExport(String executionFile, Catalog catalog, String exportName, String endpointURI) { + public WorkflowExecutionExport(String executionFile, Catalog catalog, String exportName, String endpointURI, String domain) { this.wingsExecutionModel = ModelUtils.loadModel(executionFile); this.opmwModel = ModelUtils.initializeModel(opmwModel); this.componentCatalog = catalog; @@ -72,6 +72,7 @@ public WorkflowExecutionExport(String executionFile, Catalog catalog, String exp this.uploadUsername = uploadUsername; this.uploadPassword = uploadPassword; isExecPublished = false; + this.domain = domain; } /** @@ -170,7 +171,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); + concreteTemplateExport = new WorkflowTemplateExport(expandedTemplateURI, this.componentCatalog, this.exportName, this.endpointURI, this.domain); concreteTemplateExport.transform(); System.out.println(concreteTemplateExport.getTransformedTemplateIndividual()); } else { diff --git a/src/main/java/edu/isi/wings/opmm/WorkflowTemplateExport.java b/src/main/java/edu/isi/wings/opmm/WorkflowTemplateExport.java index c53519a..727e0f0 100644 --- a/src/main/java/edu/isi/wings/opmm/WorkflowTemplateExport.java +++ b/src/main/java/edu/isi/wings/opmm/WorkflowTemplateExport.java @@ -32,7 +32,7 @@ public class WorkflowTemplateExport { 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 private WorkflowTemplateExport abstractTemplateExport;//a template may implement a template, and therefore publish its abstract template (on a separate file) - + private String domain; //private OntModel PplanModel;//TO IMPLEMENT AT THE END. Can it be done with constructs? @@ -43,7 +43,7 @@ public class WorkflowTemplateExport { * @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) { + public WorkflowTemplateExport(String templateFile, Catalog catalog, String exportName, String endpointURI, String domain) { this.wingsTemplateModel = ModelUtils.loadModel(templateFile); this.opmwModel = ModelUtils.initializeModel(opmwModel); this.componentCatalog = catalog; @@ -51,6 +51,7 @@ public WorkflowTemplateExport(String templateFile, Catalog catalog, String expor this.endpointURI = endpointURI; isTemplatePublished = false; this.exportName = exportName; + this.domain = domain; } /** @@ -154,10 +155,7 @@ private String convertTemplateToOPMW(Individual wingsTemplate, int versionNumber wtInstance.addLiteral(opmwModel.createProperty(Constants.OWL_VERSION_INFO), versionNumber); //template MD5 wtInstance.addLiteral(opmwModel.createProperty(Constants.OPMW_DATA_PROP_HAS_MD5), HashUtils.createMD5ForTemplate(wingsTemplate,this.wingsTemplateModel, this.componentCatalog.getWINGSDomainTaxonomy())); - //domain to which this template belongs. It can bee xtracted from the template path. - String domain = wingsTemplate.getNameSpace().split("/workflows/")[0]; - domain = domain.substring(domain.lastIndexOf("/")+1); - wtInstance.addLiteral(opmwModel.createProperty(Constants.OPMW_DATA_PROP_HAS_DOMAIN),domain); + wtInstance.addLiteral(opmwModel.createProperty(Constants.OPMW_DATA_PROP_HAS_DOMAIN),this.domain); //add the native system template as a reference. opmwModel.add(wtInstance,opmwModel.createProperty(Constants.OPMW_DATA_PROP_HAS_NATIVE_SYSTEM_TEMPLATE),wingsTemplate.getURI(),XSDDatatype.XSDanyURI); //state that the template was created in WINGS @@ -205,7 +203,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); + this.abstractTemplateExport = new WorkflowTemplateExport(qs.getResource("?dest").getURI(), componentCatalog, exportName, endpointURI, domain); abstractTemplateExport.transform(); abstractTemplateInstance = abstractTemplateExport.getTransformedTemplateIndividual(); System.out.println("Abstract template: "+abstractTemplateInstance.getURI()); @@ -423,8 +421,9 @@ public static void main(String[] args){ //set up on datascience4all String taxonomyURL = "http://datascience4all.org/wings-portal/export/users/admin/mint/components/library.owl"; String templatePath = "http://datascience4all.org/wings-portal/export/users/admin/mint/workflows/storyboard_isi_cag_64kpzcza7.owl"; - Catalog c = new Catalog("mint", "testExport", "domains", taxonomyURL); - WorkflowTemplateExport w = new WorkflowTemplateExport(templatePath, c, "exportTest", "http://localhost:3030/test/query"); + String domain = "mint"; + Catalog c = new Catalog(domain, "testExport", "domains", taxonomyURL); + WorkflowTemplateExport w = new WorkflowTemplateExport(templatePath, c, "exportTest", "http://localhost:3030/test/query", domain); w.exportAsOPMW(".", "TTL"); c.exportCatalog(null);