From 1015d8b7d277115ea836f7eade2a03998be25a7e Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Thu, 6 Sep 2018 18:20:30 +0200
Subject: [PATCH] support for vmh miriam types

---
 CHANGELOG                                     |  5 ++++
 .../lcsb/mapviewer/model/map/MiriamType.java  | 23 ++++++++++++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index ea66d7c7d9..cd93b2a0ad 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+minerva (12.1.0~beta.0) experimental; urgency=medium
+  * Small improvement: miriam support for VMH reaction and VMH metabolite
+
+ -- Piotr Gawron <piotr.gawron@uni.lu>  Wed, 05 Sep 2018 17:00:00 +0200
+
 minerva (12.1.0~beta.0) experimental; urgency=medium
   * Small improvement: option to remove additional overlays generated by custom 
     semantic zoom
diff --git a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java
index bbb1df775f..d5ef085177 100644
--- a/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java
+++ b/model/src/main/java/lcsb/mapviewer/model/map/MiriamType.java
@@ -464,6 +464,22 @@ public enum MiriamType {
       new String[] {}, //
       new Class<?>[] {}, null),
 
+  /**
+   * VMH reaction
+   */
+  VMH_REACTION("VMH reaction", //
+      "http://vmh.uni.lu/", //
+      new String[] { "urn:miriam:vmhreaction", "http://identifiers.org/vmhreaction/" }, //
+      new Class<?>[] { Reaction.class }, null),
+
+  /**
+   * VMH reaction
+   */
+  VMH_METABOLITE("VMH reaction", //
+      "http://vmh.uni.lu/", //
+      new String[] { "urn:miriam:vmhmetabolite", "http://identifiers.org/vmhmetabolite/" }, //
+      new Class<?>[] { Chemical.class }, null),
+
   /**
    * Wikidata: https://www.wikidata.org/.
    */
@@ -710,7 +726,7 @@ public enum MiriamType {
    * @return {@link MiriamData} from miriam uri
    */
   public static MiriamData getMiriamByUri(String miriamUri) {
-    // this hack is due to CellDesigner issue (CellDesigner incorectly handle
+    // this hack is due to CellDesigner issue (CellDesigner incorrectly handle
     // with identifiers that have ":" inside resource ":" inside resource with
     // "%3A" and also the last ":"
     miriamUri = miriamUri.replace("%3A", ":");
@@ -725,6 +741,11 @@ public enum MiriamType {
             foundType = type;
             foundUri = uri;
           }
+        } else if (miriamUri.startsWith(uri) && uri.endsWith("/")) {
+          if (uri.length() > foundUri.length()) {
+            foundType = type;
+            foundUri = uri;
+          }
         }
       }
     }
-- 
GitLab