Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

getting vie2 data working

  • Loading branch information...
commit 5c299780cc875d8a2c485e49e0eb87318c16c607 1 parent 17856ea
authored May 13, 2011

Showing 1 changed file with 27 additions and 12 deletions. Show diff stats Hide diff stats

  1. 39  src/annotate.js
39  src/annotate.js
... ...
@@ -1,27 +1,35 @@
1 1
 (function(jQuery) {
2 2
     jQuery.widget('VIE2.annotate', {
3 3
         options: {
  4
+            // rdfQuery object
4 5
             store: VIE2.globalCache,
5  
-            text: ''
  6
+            // acceptStrategy can be a string identifying a strategy like 
  7
+            // 'unique': Automatically accept if there's only one enhancement, default
  8
+            // 'none': No enhancement gets accepted automatically
  9
+            // callback function: implement your own strategy
  10
+            acceptStrategy: 'unique',
  11
+            text: '',
6 12
         },
7 13
     
8 14
         _create: function() {
9 15
             if(!this.options.text)this.options.text = this.element.textContent;
10 16
             var that = this;
11 17
             var entities = this.options.store
12  
-            .where('?entity <http://fise.iks-project.eu/ontology/selected-text> ?occ')
13  
-            .where('?entity fise:hasEntityAnnotation ?annotation')
  18
+            .where('?entity fise:selected-text ?occ')
  19
+            .where('?enh fise:confidence ?conf')
  20
+            .where('?entity fise:hasEntityAnnotation ?enh')
14 21
             .filter('occ', this.options.text);
  22
+            entities = _(entities).sortBy(function(ent){ent.conf.value});
  23
+            console.log('store entities found', entities);
15 24
             if(entities.length){
16  
-                _(entities).each(function(entityResult){
17  
-                    
18  
-                    // var curie = $.createCurie(entityResult.entity.value, {namespaces: VIE2.namespaces});
19  
-                    console.info(['entity for ' + entityResult.occ, entityResult.entity.toString()])
20  
-                    that.element.attr('about', entityResult.entity.value);
21  
-                    // that.element.attr("property", 'dbpedia:foo')
22  
-                    var fromVIE = VIE.RDFaEntities.getInstance(that.element);
23  
-                    console.log("VIE finds", fromVIE);
24  
-                })
  25
+                var entityResult = entities[0];
  26
+                
  27
+                // var curie = $.createCurie(entityResult.entity.value, {namespaces: VIE2.namespaces});
  28
+                console.info(['entity for ' + entityResult.occ, entityResult.entity.toString()])
  29
+                that.element.attr('about', entityResult.entity.value);
  30
+                // that.element.attr("property", 'dbpedia:foo')
  31
+                var fromVIE = VIE.RDFaEntities.getInstance(that.element);
  32
+                console.log("VIE finds", fromVIE);
25 33
             } else {
26 34
                 console.info("No entity for '" + this.options.text + "'");
27 35
             }
@@ -52,6 +60,13 @@
52 60
             });
53 61
 */
54 62
         },
  63
+        acceptAnnotation: function(domEl, enhancement){
  64
+            $(domEl).addClass('confirmedAnnotation');
  65
+        },
  66
+        declineAnnotation: function(domEl, enhancement){
  67
+            $(domEl).removeClass('confirmedAnnotation');
  68
+            this.options.blacklist[domEl.textValue] = enhancement.uri;
  69
+        },
55 70
         enable: function() {      
56 71
         },
57 72
         

0 notes on commit 5c29978

Please sign in to comment.
Something went wrong with that request. Please try again.