Skip to content

Commit

Permalink
literals with a lang are not to be stored in VIE as turtle strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Szaby Grünwald committed Mar 1, 2012
1 parent 916e533 commit 07aacfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Util.js
Expand Up @@ -202,8 +202,12 @@ VIE.Util = {


function getValue(rdfQueryLiteral){ function getValue(rdfQueryLiteral){
if(typeof rdfQueryLiteral.value === "string"){ if(typeof rdfQueryLiteral.value === "string"){
if (rdfQueryLiteral.lang) if (rdfQueryLiteral.lang){
return rdfQueryLiteral.toString(); rdfQueryLiteral.toString = function(){
return this.value;
};
return rdfQueryLiteral;
}
else else
return rdfQueryLiteral.value; return rdfQueryLiteral.value;
return rdfQueryLiteral.value.toString(); return rdfQueryLiteral.value.toString();
Expand Down
4 changes: 4 additions & 0 deletions test/service/stanbol.js
Expand Up @@ -33,6 +33,10 @@ test("VIE.js StanbolService - Analyze", function () {
} }
} }
ok(allEntities); ok(allEntities);
var firstTextAnnotation = _(entities).filter(function(e){return e.isof("enhancer:TextAnnotation") && e.get("enhancer:selected-text")})[0];
var s = firstTextAnnotation.get("enhancer:selected-text").toString();

ok(s.substring(s.length-4, s.length-2) != "\"@", "Selected text should be converted into a normal string.");
start(); start();
}) })
.fail(function(f){ .fail(function(f){
Expand Down

0 comments on commit 07aacfd

Please sign in to comment.