{
  "version": "https://jsonfeed.org/version/1.1",
  "title": "chem-bla-ics",
  "description": "Chemblaics (pronounced chem-bla-ics) is the science that uses open science and computers to solve problems in chemistry, biochemistry and related fields.",
  "home_page_url": "https://chem-bla-ics.linkedchemistry.info/",
  "feed_url": "https://chem-bla-ics.linkedchemistry.info/2010/10/28/oscar4-java-api-chemical-name.json",
  "icon": "https://chem-bla-ics.linkedchemistry.info/assets/images/chem-bla-ics_logo.png",
  "language": "en",
  "authors": [
    {
      "name": "Egon Willighagen",
      "url": "https://orcid.org/0000-0001-7542-0286",
      "_orcid": "0000-0001-7542-0286"
    }
  ],
  "items": [

    {
      "id": "https://doi.org/10.59350/866tq-qv177",
      "url": "https://chem-bla-ics.linkedchemistry.info/2010/10/28/oscar4-java-api-chemical-name.html",
      "title": "Oscar4 Java API: chemical name dictionaries",
      "content_html": "<p>Besides getting Oscar used by <a href=\"http://www.ebi.ac.uk/chebi/\">ChEBI</a> (hopefully <a href=\"https://chem-bla-ics.linkedchemistry.info/2010/10/21/oscar-text-mining-in-taverna.html\">via Taverna <i class=\"fa-solid fa-recycle fa-xs\"></i></a>),\nmy main task in <a href=\"https://chem-bla-ics.linkedchemistry.info/2010/10/15/working-on-oscar-for-three-months.html\">my three month Oscar project <i class=\"fa-solid fa-recycle fa-xs\"></i></a>\nis to refactor things to make it more modular, and remove some features no longer needed (e.g. an automatically created workspace environment).\nClearly, I need to define a lot of <a href=\"https://chem-bla-ics.linkedchemistry.info/2010/10/26/multiple-unit-test-inheritance-with.html\">new unit tests <i class=\"fa-solid fa-recycle fa-xs\"></i></a>\nto ensure my assumptions on how to code works are valid.</p>\n\n<p>So, what are the API requirements set out? These include (but are not limited to):</p>\n\n<ul>\n  <li>have reasonable defaults</li>\n  <li>being able to add custom dictionaries</li>\n  <li>easily change the chemical entity recogniser</li>\n  <li>plugin text normalization (see <a href=\"https://blogs.ch.cam.ac.uk/pmr/2010/10/24/the-absolute-minimum-every-scientist-with-data-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/\">Peter’s post on UNICODE <i class=\"fa-solid fa-recycle fa-xs\"></i></a>)</li>\n</ul>\n\n<p>This week I worked on the dictionary refactoring, and talked with Lezan about the <a href=\"http://www-ucc.ch.cam.ac.uk/products/software/chemicaltagger\">ChemicalTagger</a>\nand trying to get this based on the newer Oscar code (I think we’ll be able to finish that today). So, I cleaned up\nsome code I did in the first week, and introduced <a href=\"https://bitbucket.org/wwmm/oscar4/src/bf79fd11045c/oscar4-api/src/main/java/uk/ac/cam/ch/wwmm/oscar/Oscar.java\">a Oscar class</a>\nproviding a Java API to the Oscar functionality.</p>\n\n<p>So, to get started with Oscar in your application, you only need to do:</p>\n\n<div class=\"language-java highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nc\">Oscar</span> <span class=\"n\">oscar</span> <span class=\"o\">=</span> <span class=\"k\">new</span> <span class=\"nc\">Oscar</span><span class=\"o\">(</span>\n  <span class=\"k\">this</span><span class=\"o\">.</span><span class=\"na\">getClass</span><span class=\"o\">().</span><span class=\"na\">getClassLoader</span><span class=\"o\">()</span>\n<span class=\"o\">);</span>\n<span class=\"n\">oscar</span><span class=\"o\">.</span><span class=\"na\">loadDefaultDictionaries</span><span class=\"o\">();</span>\n<span class=\"nc\">Map</span><span class=\"o\">&lt;</span><span class=\"nc\">NamedEntity</span><span class=\"o\">,</span><span class=\"nc\">String</span><span class=\"o\">&gt;</span> <span class=\"n\">structures</span> <span class=\"o\">=</span>\n  <span class=\"n\">oscar</span><span class=\"o\">.</span><span class=\"na\">getNamedEntities</span><span class=\"o\">(</span>\n    <span class=\"s\">\"Ingredients: acetic acid, water.\"</span>\n  <span class=\"o\">);</span>\n</code></pre></div></div>\n\n<p>The ClassLoader is needed because the Oscar class will not generally know how to load custom classes.</p>\n\n<p>You can add additional dictionaries, by implementing the <a href=\"https://bitbucket.org/wwmm/oscar4/src/tip/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/IChemNameDict.java\">IChemNameDict</a>\ninterface and one or more of <a href=\"https://bitbucket.org/wwmm/oscar4/src/tip/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/IInChIProvider.java\">IInChIProvider</a>,\n<a href=\"https://bitbucket.org/wwmm/oscar4/src/tip/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/ISMILESProvider.java\">ISMILESProvider</a>,\nand <a href=\"https://bitbucket.org/wwmm/oscar4/src/tip/oscar4-chemnamedict/src/main/java/uk/ac/cam/ch/wwmm/oscar/chemnamedict/ICMLProvider.java\">ICMLProvider</a>.\nFor example, adding the OPSIN dictionary would extend the above code to:</p>\n\n<div class=\"language-java highlighter-rouge\"><div class=\"highlight\"><pre class=\"highlight\"><code><span class=\"nc\">Oscar</span> <span class=\"n\">oscar</span> <span class=\"o\">=</span> <span class=\"k\">new</span> <span class=\"nc\">Oscar</span><span class=\"o\">(</span>\n  <span class=\"k\">this</span><span class=\"o\">.</span><span class=\"na\">getClass</span><span class=\"o\">().</span><span class=\"na\">getClassLoader</span><span class=\"o\">()</span>\n<span class=\"o\">);</span>\n<span class=\"n\">oscar</span><span class=\"o\">.</span><span class=\"na\">loadDefaultDictionaries</span><span class=\"o\">();</span>\n<span class=\"n\">oscar</span><span class=\"o\">.</span><span class=\"na\">getChemNameDict</span><span class=\"o\">().</span><span class=\"na\">register</span><span class=\"o\">(</span>\n  <span class=\"k\">new</span> <span class=\"nf\">OpsinDictionary</span><span class=\"o\">()</span>\n<span class=\"o\">);</span>\n<span class=\"nc\">Map</span><span class=\"o\">&lt;</span><span class=\"nc\">NamedEntity</span><span class=\"o\">,</span><span class=\"nc\">String</span><span class=\"o\">&gt;</span> <span class=\"n\">structures</span> <span class=\"o\">=</span>\n  <span class=\"n\">oscar</span><span class=\"o\">.</span><span class=\"na\">getNamedEntities</span><span class=\"o\">(</span>\n    <span class=\"s\">\"Ingredients: acetic acid, water.\"</span>\n  <span class=\"o\">);</span>\n</code></pre></div></div>\n\n<p>And, I think the <code class=\"language-plaintext highlighter-rouge\">oscar.getChemNameDict()</code> method will be renamed to something like <code class=\"language-plaintext highlighter-rouge\">oscar.getDictionaryRegistry()</code> really soon.</p>",
      "summary": "Besides getting Oscar used by ChEBI (hopefully via Taverna ), my main task in my three month Oscar project is to refactor things to make it more modular, and remove some features no longer needed (e.g. an automatically created workspace environment). Clearly, I need to define a lot of new unit tests to ensure my assumptions on how to code works are valid.",
      
      "date_published": "2010-10-28T00:00:00+00:00",
      "date_modified": "2026-05-05T00:00:00+00:00",
      "tags": ["oscar","java","chebi"],
      
      
      
      
      
      
        "authors": [ { "name": "Egon Willighagen", "url": "https://orcid.org/0000-0001-7542-0286" } ]
      
    }

  ]
}
