ISA-tools/OntoMaton

itemDefinitionHandler missing from github

Closed this issue · 4 comments

Hi guys,

Really finding this tool useful. Thanks very much. We modified it to insert ONTO:00012345 rather than purls which don't help when we are trying to load the experiment data into Chado.

What's happened to itemDefinitionHandler() ? I can't find the code for it anywhere on GitHub - although I can find it in Utils.gs on my local copy.

We found that this is essential (try looking up "London" in GAZ) but seems broken. I am trying to fix it - will post what I find.

cheers,
Bob.

The following seems to work for me (has the XML returned from bioportal changed structure?)

I have only tested it on GAZ and UO (units) terms at the moment.

function itemDefinitionHandler(e) {
    var app = UiApp.getActiveApplication();
    var value = e.parameter.source;
    var ontologyObject = createOntologyObjectFromString(value);

    var searchString = "http://rest.bioontology.org/bioportal/concepts/" + ontologyObject.ontologyVersion
        + "?conceptid=" + ontologyObject.conceptId + "&apikey=INSERT-YOURS-HERE"; // we are using our own
    Logger.log(searchString);

    var text = UrlFetchApp.fetch(searchString).getContentText();
    var doc = Xml.parse(text, true);

    var definition = "";
    if (doc.success.data.classBean.definitions != null) {
      var strings = doc.success.data.classBean.definitions.getElements("string");
      for (var strIndex in strings) {
        var string = strings[strIndex];
        definition += string.getText() + " ";
      }
    }

    if(definition == "") {
      definition = "No definition available for this term.";
    }

    SpreadsheetApp.getActiveSpreadsheet().toast("Definition: " + definition, ontologyObject.conceptId, -1);

    return app;
}

I had to copy the files over manually since all the coding has to be done
within googles app script UI. I obviously missed this off when I was
copying and pasting...apologies.

Eamonn Maguire
Sent from my iPhone with tiny buttons

On 22 Jan 2013, at 08:11, bobular notifications@github.com wrote:

Hi guys,

Really finding this tool useful. Thanks very much. We modified it to insert
ONTO:00012345 rather than purls which don't help when we are trying to load
the experiment data into Chado.

What's happened to itemDefinitionHandler() ? I can't find the code for it
anywhere on GitHub - although I can find it in Utils.gs on my local copy.

We found that this is essential (try looking up "London" in GAZ) but seems
broken. I am trying to fix it - will post what I find.

cheers,
Bob.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/6.

That does look very different from what we originally had. Before there was
no explicit definition block, just lists of generic elements that were
tagged with a label 'definition' sometimes.

If this is a change across the board, then it's great and makes the task of
getting the definition much easier :)

Eamonn Maguire
Sent from my iPhone with tiny buttons

On 22 Jan 2013, at 08:23, bobular notifications@github.com wrote:

The following seems to work for me (has the XML returned from bioportal
changed structure?)

I have only tested it on GAZ and UO (units) terms at the moment.

function itemDefinitionHandler(e) {
var app = UiApp.getActiveApplication();
var value = e.parameter.source;
var ontologyObject = createOntologyObjectFromString(value);

var searchString =

"http://rest.bioontology.org/bioportal/concepts/" +
ontologyObject.ontologyVersion
+ "?conceptid=" + ontologyObject.conceptId +
"&apikey=INSERT-YOURS-HERE"; // we are using our own
Logger.log(searchString);

var text = UrlFetchApp.fetch(searchString).getContentText();
var doc = Xml.parse(text, true);

var definition = "";
if (doc.success.data.classBean.definitions != null) {
  var strings =

doc.success.data.classBean.definitions.getElements("string");
for (var strIndex in strings) {
var string = strings[strIndex];
definition += string.getText() + " ";
}
}

if(definition == "") {
  definition = "No definition available for this term.";
}

SpreadsheetApp.getActiveSpreadsheet().toast("Definition: " +

definition, ontologyObject.conceptId, -1);

return app;}


Reply to this email directly or view it on
GitHubhttps://github.com//issues/6#issuecomment-12544019.

This is now added.