rasvaan / accurator

Accurator cpack
7 stars 3 forks source link

Formulate generic target of annotation #204

Closed rasvaan closed 8 years ago

rasvaan commented 8 years ago

Write a function determining the generic target of a annotation, based on annotations.js:

findTarget : function(tag) {
   result = this.findSpecificTarget(tag);
    if (result) return result;
    else return this.findGenericTarget(tag)
},
findGenericTarget : function(tag) {
        var targets = tag.hasTarget;
        var target = undefined;
        if (!targets)
            return null;
        if (targets['@id'])
            return targets;
        for (var t in targets) {
            target = targets[t];
            if (target['@id'])
            return target;
        }
        return null
    },