Skip to content

Commit

Permalink
getting vie2 data working
Browse files Browse the repository at this point in the history
  • Loading branch information
Szaby Grünwald committed May 13, 2011
1 parent 17856ea commit 5c29978
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions src/annotate.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
(function(jQuery) {
jQuery.widget('VIE2.annotate', {
options: {
// rdfQuery object
store: VIE2.globalCache,
text: ''
// acceptStrategy can be a string identifying a strategy like
// 'unique': Automatically accept if there's only one enhancement, default
// 'none': No enhancement gets accepted automatically
// callback function: implement your own strategy
acceptStrategy: 'unique',
text: '',
},

_create: function() {
if(!this.options.text)this.options.text = this.element.textContent;
var that = this;
var entities = this.options.store
.where('?entity <http://fise.iks-project.eu/ontology/selected-text> ?occ')
.where('?entity fise:hasEntityAnnotation ?annotation')
.where('?entity fise:selected-text ?occ')
.where('?enh fise:confidence ?conf')
.where('?entity fise:hasEntityAnnotation ?enh')
.filter('occ', this.options.text);
entities = _(entities).sortBy(function(ent){ent.conf.value});
console.log('store entities found', entities);
if(entities.length){
_(entities).each(function(entityResult){

// var curie = $.createCurie(entityResult.entity.value, {namespaces: VIE2.namespaces});
console.info(['entity for ' + entityResult.occ, entityResult.entity.toString()])
that.element.attr('about', entityResult.entity.value);
// that.element.attr("property", 'dbpedia:foo')
var fromVIE = VIE.RDFaEntities.getInstance(that.element);
console.log("VIE finds", fromVIE);
})
var entityResult = entities[0];

// var curie = $.createCurie(entityResult.entity.value, {namespaces: VIE2.namespaces});
console.info(['entity for ' + entityResult.occ, entityResult.entity.toString()])
that.element.attr('about', entityResult.entity.value);
// that.element.attr("property", 'dbpedia:foo')
var fromVIE = VIE.RDFaEntities.getInstance(that.element);
console.log("VIE finds", fromVIE);
} else {
console.info("No entity for '" + this.options.text + "'");
}
Expand Down Expand Up @@ -52,6 +60,13 @@
});
*/
},
acceptAnnotation: function(domEl, enhancement){
$(domEl).addClass('confirmedAnnotation');
},
declineAnnotation: function(domEl, enhancement){
$(domEl).removeClass('confirmedAnnotation');
this.options.blacklist[domEl.textValue] = enhancement.uri;
},
enable: function() {
},

Expand Down

0 comments on commit 5c29978

Please sign in to comment.