ref #8248 Implement OWL import wizard
authorPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 26 Apr 2019 10:10:28 +0000 (12:10 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Fri, 26 Apr 2019 10:10:28 +0000 (12:10 +0200)
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/fragment.e4xmi
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/ImportManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OpenOwlImportWizard.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportConfiguratorWizardPage.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportWizard.java [new file with mode: 0644]

index 4323fed2c64cc18ee8a1af20a9c33d2f1be83d0c..5332b5890f1e95e5967ff1556d93d0b808506b56 100644 (file)
@@ -74,6 +74,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.cdm.io.csv.caryophyllales.out,
  eu.etaxonomy.cdm.io.csv.redlist.demo,
  eu.etaxonomy.cdm.io.csv.redlist.out,
  eu.etaxonomy.cdm.io.csv.caryophyllales.out,
  eu.etaxonomy.cdm.io.csv.redlist.demo,
  eu.etaxonomy.cdm.io.csv.redlist.out,
+ eu.etaxonomy.cdm.io.descriptive.owl.in,
  eu.etaxonomy.cdm.io.descriptive.owl.out,
  eu.etaxonomy.cdm.io.descriptive.word.out,
  eu.etaxonomy.cdm.io.distribution.excelupdate,
  eu.etaxonomy.cdm.io.descriptive.owl.out,
  eu.etaxonomy.cdm.io.descriptive.word.out,
  eu.etaxonomy.cdm.io.distribution.excelupdate,
@@ -117,7 +118,7 @@ Export-Package: com.google.api,
  eu.etaxonomy.cdm.model.reference,
  eu.etaxonomy.cdm.model.taxon,
  eu.etaxonomy.cdm.model.term,
  eu.etaxonomy.cdm.model.reference,
  eu.etaxonomy.cdm.model.taxon,
  eu.etaxonomy.cdm.model.term,
 eu.etaxonomy.cdm.model.term.init,
+ eu.etaxonomy.cdm.model.term.init,
  eu.etaxonomy.cdm.model.validation,
  eu.etaxonomy.cdm.model.view,
  eu.etaxonomy.cdm.model.view.context,
  eu.etaxonomy.cdm.model.validation,
  eu.etaxonomy.cdm.model.view,
  eu.etaxonomy.cdm.model.view.context,
index 1f4a5516d54ad867f7bc346c6a4801de684a6025..51d473630e5776ff029a2894c9dd25154a723df9 100644 (file)
     <elements xsi:type="commands:Command" xmi:id="_qYxw8D85EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.command.OpenDatabaseRepairWizard" commandName="Open Cache Updater"/>
     <elements xsi:type="commands:Command" xmi:id="_VUQY0D86EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.command.openSortIndexUpdaterWizard" commandName="Open Sort Index Updater"/>
     <elements xsi:type="commands:Command" xmi:id="_d6YpoEAVEembfJNLZI9wiA" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.moveTerm" commandName="Move Term"/>
     <elements xsi:type="commands:Command" xmi:id="_qYxw8D85EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.command.OpenDatabaseRepairWizard" commandName="Open Cache Updater"/>
     <elements xsi:type="commands:Command" xmi:id="_VUQY0D86EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.command.openSortIndexUpdaterWizard" commandName="Open Sort Index Updater"/>
     <elements xsi:type="commands:Command" xmi:id="_d6YpoEAVEembfJNLZI9wiA" elementId="eu.etaxonomy.taxeditor.editor.definedTerms.moveTerm" commandName="Move Term"/>
+    <elements xsi:type="commands:Command" xmi:id="_Z7vHUGdoEemm7Ie9EDdklA" elementId="eu.etaxonomy.taxeditor.store.command.importOwl" commandName="OWL"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
     <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_swGH0GhvEee3K4uKJljEYg" featurename="handlers" parentElementId="xpath:/">
     <elements xsi:type="commands:Handler" xmi:id="_rVEdIGcjEee0qLTtA2ZpVQ" elementId="eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.featuretree.e4.handler.RemoveFeatureHandler" command="_fNBtQGcjEee0qLTtA2ZpVQ"/>
     <elements xsi:type="commands:Handler" xmi:id="_xWlngO5vEeizn7bmbAeBkw" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardHandler" command="_Za5DYO5vEeizn7bmbAeBkw"/>
     <elements xsi:type="commands:Handler" xmi:id="_i4yZAD8zEemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" command="_qYxw8D85EemTy7SLZkowuQ"/>
     <elements xsi:type="commands:Handler" xmi:id="_PugRQD86EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.handler.1" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenUpdateSortIndicesHandler" command="_VUQY0D86EemTy7SLZkowuQ"/>
     <elements xsi:type="commands:Handler" xmi:id="_xWlngO5vEeizn7bmbAeBkw" elementId="eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStausWizardHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.e4.OpenDistributionStatusWizardHandler" command="_Za5DYO5vEeizn7bmbAeBkw"/>
     <elements xsi:type="commands:Handler" xmi:id="_i4yZAD8zEemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.handler.0" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenDatabaseRepairWizardHandler" command="_qYxw8D85EemTy7SLZkowuQ"/>
     <elements xsi:type="commands:Handler" xmi:id="_PugRQD86EemTy7SLZkowuQ" elementId="eu.etaxonomy.taxeditor.store.handler.1" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.handler.OpenUpdateSortIndicesHandler" command="_VUQY0D86EemTy7SLZkowuQ"/>
+    <elements xsi:type="commands:Handler" xmi:id="_iKdcQGdoEemm7Ie9EDdklA" elementId="eu.etaxonomy.taxeditor.io.e4.in.owl.OpenOwlImportWizard" contributionURI="bundleclass://eu.etaxonomy.taxeditor.store/eu.etaxonomy.taxeditor.io.e4.in.owl.OpenOwlImportWizard" command="_Z7vHUGdoEemm7Ie9EDdklA"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
     <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_qT4hgIfTEeecZ4F2Y9Z0Og" featurename="children" parentElementId="eu.etaxonomy.taxeditor.workbench.menu.window" positionInList="before:eu.etaxonomy.taxeditor.application.windowMenu.last">
     <elements xsi:type="menu:Menu" xmi:id="_LT3P8IfcEeecZ4F2Y9Z0Og" elementId="eu.etaxonomy.taxeditor.store.menu.termeditor" label="%menu.label.1">
       <children xsi:type="menu:HandledMenuItem" xmi:id="_pQNeoKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importRisReference" label="%wizard.name.24" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
       <children xsi:type="menu:HandledMenuItem" xmi:id="_hXY2UKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importSdd" label="%wizard.name.4" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
       <children xsi:type="menu:HandledMenuItem" xmi:id="_X2Xb8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importTcs" label="%wizard.name" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
       <children xsi:type="menu:HandledMenuItem" xmi:id="_pQNeoKmsEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importRisReference" label="%wizard.name.24" command="_tBCr8KmsEeeTAPHmaMLwQQ"/>
       <children xsi:type="menu:HandledMenuItem" xmi:id="_hXY2UKmuEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importSdd" label="%wizard.name.4" command="_bLGTMKmuEeeTAPHmaMLwQQ"/>
       <children xsi:type="menu:HandledMenuItem" xmi:id="_X2Xb8KnCEeeTAPHmaMLwQQ" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importTcs" label="%wizard.name" command="_OQ9n8KnCEeeTAPHmaMLwQQ"/>
+      <children xsi:type="menu:HandledMenuItem" xmi:id="_H6tK0GdoEemm7Ie9EDdklA" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.importOwl" label="Owl Import" command="_Z7vHUGdoEemm7Ie9EDdklA"/>
     </elements>
     <elements xsi:type="menu:MenuSeparator" xmi:id="_URhG8K25EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.menuseparator.4"/>
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_NQ8aYNhHEeijwMElCRdOhg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabelrestart" label="%handledmenuitem.label.10" command="_nP0XMNhHEeijwMElCRdOhg"/>
     </elements>
     <elements xsi:type="menu:MenuSeparator" xmi:id="_URhG8K25EeeykrJkROy5EA" elementId="eu.etaxonomy.taxeditor.store.menuseparator.4"/>
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_NQ8aYNhHEeijwMElCRdOhg" elementId="eu.etaxonomy.taxeditor.store.handledmenuitem.commandlabelrestart" label="%handledmenuitem.label.10" command="_nP0XMNhHEeijwMElCRdOhg"/>
index 6f5088af606595e5306cc7bafa9c203ae302bbf9..15ddbacb353c9faf10a5b3510515cb8ef7f0da5e 100644 (file)
@@ -39,7 +39,7 @@ public abstract class AbstractIOManager<CONFIGURATOR extends IIoConfigurator> {
        protected ICdmRepository applicationConfiguration;
 
        public static enum TYPE {
        protected ICdmRepository applicationConfiguration;
 
        public static enum TYPE {
-               Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif, Excel_Distribution, Ris
+               Jaxb, Tcs, Excel_Taxa, Endnote, Sdd, Abcd, SpecimenCdmExcel, Excel_Name, SpecimenSearch, Gbif, Excel_Distribution, Ris, OWL
        }
 
        /**
        }
 
        /**
@@ -89,7 +89,7 @@ public abstract class AbstractIOManager<CONFIGURATOR extends IIoConfigurator> {
         * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
         */
        protected abstract Job createIOJob(CONFIGURATOR configurator);
         * @return a {@link org.eclipse.core.runtime.jobs.Job} object.
         */
        protected abstract Job createIOJob(CONFIGURATOR configurator);
-       
+
         /**
      * @param configurator
      * @param display
         /**
      * @param configurator
      * @param display
index 5f8f0cd89086c85ca7dd1f646b604670e1694d50..6ce4ef3eab55b25fd102158c70184c621526139a 100644 (file)
@@ -34,6 +34,7 @@ import eu.etaxonomy.cdm.io.common.IImportConfigurator;
 import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
 import eu.etaxonomy.cdm.io.common.ImportResult;
 import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
 import eu.etaxonomy.cdm.io.common.ImportConfiguratorBase;
 import eu.etaxonomy.cdm.io.common.ImportResult;
+import eu.etaxonomy.cdm.io.descriptive.owl.in.OwlImportConfigurator;
 import eu.etaxonomy.cdm.io.distribution.excelupdate.ExcelDistributionUpdateConfigurator;
 import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
 import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
 import eu.etaxonomy.cdm.io.distribution.excelupdate.ExcelDistributionUpdateConfigurator;
 import eu.etaxonomy.cdm.io.dwca.in.DwcaImportConfigurator;
 import eu.etaxonomy.cdm.io.excel.taxa.NormalExplicitImportConfigurator;
@@ -314,6 +315,8 @@ public class ImportManager extends AbstractIOManager<IImportConfigurator> implem
                    return DwcaImportConfigurator.NewInstance(null, null);
                case Excel_Distribution:
             return ExcelDistributionUpdateConfigurator.NewInstance(null, null, null);
                    return DwcaImportConfigurator.NewInstance(null, null);
                case Excel_Distribution:
             return ExcelDistributionUpdateConfigurator.NewInstance(null, null, null);
+        case OWL:
+            return OwlImportConfigurator.NewInstance(null);
 
                default:
                        MessagingUtils.notImplementedMessage(this);
 
                default:
                        MessagingUtils.notImplementedMessage(this);
@@ -404,6 +407,10 @@ public class ImportManager extends AbstractIOManager<IImportConfigurator> implem
                return (DwcaImportConfigurator) getConfigurator(TYPE.Gbif);
        }
 
                return (DwcaImportConfigurator) getConfigurator(TYPE.Gbif);
        }
 
+       public final OwlImportConfigurator OwlImportConfigurator() {
+           return (OwlImportConfigurator) getConfigurator(TYPE.OWL);
+       }
+
 
     /**
      * {@inheritDoc}
 
     /**
      * {@inheritDoc}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OpenOwlImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OpenOwlImportWizard.java
new file mode 100644 (file)
index 0000000..5d85927
--- /dev/null
@@ -0,0 +1,27 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.io.e4.in.owl;
+
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractOpenImportWizard;
+
+/**
+ *
+ * @author pplitzner
+ * @since Apr 25, 2019
+ *
+ */
+public class OpenOwlImportWizard extends AbstractOpenImportWizard {
+
+    @Override
+    protected Class<? extends AbstractImportWizardE4> getImportWizardClass() {
+        return OwlImportWizard.class;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportConfiguratorWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportConfiguratorWizardPage.java
new file mode 100644 (file)
index 0000000..fc1ee08
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.io.e4.in.owl;
+
+import javax.inject.Inject;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+import eu.etaxonomy.cdm.io.descriptive.owl.in.OwlImportConfigurator;
+
+/**
+ *
+ * @author pplitzner
+ * @since Apr 25, 2019
+ *
+ */
+public class OwlImportConfiguratorWizardPage extends WizardPage {
+
+       public static final String PAGE_NAME = "OwlImportConfiguratorWizardPage";
+
+       private OwlImportConfigurator configurator;
+
+       @Inject
+       public OwlImportConfiguratorWizardPage() {
+        super(PAGE_NAME);
+        setTitle("Configure import parameters");
+        setDescription("Tooltips will explain parameters in more detail");
+    }
+
+       @Override
+    public void createControl(Composite parent) {
+               final Composite composite = new Composite(parent, SWT.NULL);
+               GridLayout gridLayout = new GridLayout();
+               composite.setLayout(gridLayout);
+
+               setControl(composite);
+       }
+
+        public String createConfigString(){
+           return configurator.toString();
+        }
+
+    public void setConfigurator(OwlImportConfigurator configurator) {
+        this.configurator = configurator;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportWizard.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/e4/in/owl/OwlImportWizard.java
new file mode 100644 (file)
index 0000000..b8e8c5e
--- /dev/null
@@ -0,0 +1,85 @@
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.io.e4.in.owl;
+
+import java.io.File;
+import java.net.URI;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.workbench.modeling.EPartService;
+
+import eu.etaxonomy.cdm.database.DbSchemaValidation;
+import eu.etaxonomy.cdm.io.common.IImportConfigurator.SOURCE_TYPE;
+import eu.etaxonomy.cdm.io.descriptive.owl.in.OwlImportConfigurator;
+import eu.etaxonomy.taxeditor.io.e4.in.AbstractImportWizardE4;
+import eu.etaxonomy.taxeditor.io.e4.in.ImportFromFileDataSourceWizardPage;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ *
+ * @author pplitzner
+ * @since Apr 25, 2019
+ *
+ */
+public class OwlImportWizard extends AbstractImportWizardE4<OwlImportConfigurator> {
+
+       private OwlImportConfigurator configurator;
+       private ImportFromFileDataSourceWizardPage dataSourcePage;
+
+       @Inject
+       public OwlImportWizard(IEclipseContext context, EPartService partService) {
+           super(context, partService);
+       }
+
+       @Override
+       public OwlImportConfigurator getConfigurator() {
+               return configurator;
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       public boolean performFinish() {
+           URI source = dataSourcePage.getUri();
+           configurator.setSource(source);
+           configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+           Job job = CdmStore.getImportManager().createIOServiceJob(configurator, new File(source), SOURCE_TYPE.URI);
+           CdmStore.getImportManager().run(job);
+
+           return true;
+       }
+
+       /** {@inheritDoc} */
+       @Override
+    public void init() {
+        configurator =  CdmStore.getImportManager().OwlImportConfigurator();
+       }
+
+       @Override
+       protected void addConfiguratorPage() {
+//         OwlImportConfiguratorWizardPage configuratorWizardPage = ContextInjectionFactory.make(OwlImportConfiguratorWizardPage.class, context);//AbcdImportConfiguratorWizardPage.createPage(configurator);
+//         configuratorWizardPage.setConfigurator(configurator);
+//             addPage(configuratorWizardPage);
+       }
+
+       /** {@inheritDoc} */
+       @Override
+       public void addPages() {
+           dataSourcePage = ContextInjectionFactory.make(ImportFromFileDataSourceWizardPage.class, context);
+           dataSourcePage.setTitle("Choose File");
+           dataSourcePage.setDescription("Please choose an OWL file to import an ontology as a term tree.");
+           dataSourcePage.setExtensions(new String[]{"*.owl"});
+
+           addPage(dataSourcePage);
+       }
+}