Skip to content
Browse files

Tabs to spaces

  • Loading branch information...
1 parent 81bc88e commit ed354dba8310e6fb3adb7211f4b765a900908453 @bergie committed Nov 2, 2012
Showing with 144 additions and 144 deletions.
  1. +144 −144 test/service/stanbol.js
View
288 test/service/stanbol.js
@@ -78,7 +78,7 @@ test("VIE.js StanbolService - API", function() {
});
test("VIE.js StanbolConnector - API", function() {
- var z = new VIE();
+ var z = new VIE();
var stanbol = new z.StanbolService({url : stanbolRootUrl});
z.use(stanbol);
@@ -125,19 +125,19 @@ test("VIE.js StanbolService - Analyze - Default", function () {
ok(entities instanceof Array, "The entities are an array.");
ok(entities.length > 0, "At least one entity returned");
if(entities.length > 0){
- var allEntities = true;
- for(var i=0; i<entities.length; i++){
- var entity = entities[i];
- if (! (entity instanceof Backbone.Model)){
- allEntities = false;
- ok(false, "VIE.js StanbolService - Analyze: Entity is not a Backbone model!");
- console.error("VIE.js StanbolService - Analyze: ", entity, "is not a Backbone model!");
- }
- }
- ok(allEntities, "All result elements are VIE entities.");
- 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.");
+ var allEntities = true;
+ for(var i=0; i<entities.length; i++){
+ var entity = entities[i];
+ if (! (entity instanceof Backbone.Model)){
+ allEntities = false;
+ ok(false, "VIE.js StanbolService - Analyze: Entity is not a Backbone model!");
+ console.error("VIE.js StanbolService - Analyze: ", entity, "is not a Backbone model!");
+ }
+ }
+ ok(allEntities, "All result elements are VIE entities.");
+ 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();
})
@@ -228,12 +228,12 @@ test("VIE.js StanbolConnector - Get all referenced sites", function () {
z.use(stanbol);
stop();
stanbol.connector.referenced(function (sites) {
- ok(_.isArray(sites));
- ok(sites.length > 0);
- start();
+ ok(_.isArray(sites));
+ ok(sites.length > 0);
+ start();
}, function (err) {
- ok(false, "No referenced site has been returned!");
- start();
+ ok(false, "No referenced site has been returned!");
+ start();
});
});
@@ -243,15 +243,15 @@ test("VIE.js StanbolConnector - Perform SPARQL Query", function () {
}
var query = "PREFIX fise: <http://fise.iks-project.eu/ontology/> " +
- "PREFIX dc: <http://purl.org/dc/terms/> " +
- "SELECT distinct ?enhancement ?content ?engine ?extraction_time " +
- "WHERE { " +
- "?enhancement a fise:Enhancement . " +
- "?enhancement fise:extracted-from ?content . " +
- "?enhancement dc:creator ?engine . " +
- "?enhancement dc:created ?extraction_time . " +
- "} " +
- "ORDER BY DESC(?extraction_time) LIMIT 5";
+ "PREFIX dc: <http://purl.org/dc/terms/> " +
+ "SELECT distinct ?enhancement ?content ?engine ?extraction_time " +
+ "WHERE { " +
+ "?enhancement a fise:Enhancement . " +
+ "?enhancement fise:extracted-from ?content . " +
+ "?enhancement dc:creator ?engine . " +
+ "?enhancement dc:created ?extraction_time . " +
+ "} " +
+ "ORDER BY DESC(?extraction_time) LIMIT 5";
// Sending a an example with double quotation marks.
var z = new VIE();
@@ -261,19 +261,19 @@ test("VIE.js StanbolConnector - Perform SPARQL Query", function () {
z.use(stanbol);
stop();
stanbol.connector.sparql(query, function (response) {
- ok(response instanceof Document);
- var xmlString = (new XMLSerializer()).serializeToString(response);
- var myJsonObject = xml2json.parser(xmlString);
-
- ok(myJsonObject.sparql);
- ok(myJsonObject.sparql.results);
- ok(myJsonObject.sparql.results.result);
- ok(myJsonObject.sparql.results.result.length > 0);
-
- start();
+ ok(response instanceof Document);
+ var xmlString = (new XMLSerializer()).serializeToString(response);
+ var myJsonObject = xml2json.parser(xmlString);
+
+ ok(myJsonObject.sparql);
+ ok(myJsonObject.sparql.results);
+ ok(myJsonObject.sparql.results.result);
+ ok(myJsonObject.sparql.results.result.length > 0);
+
+ start();
}, function (err) {
- ok(false, "SPARQL endpoint returned no response!");
- start();
+ ok(false, "SPARQL endpoint returned no response!");
+ start();
});
});
@@ -487,8 +487,8 @@ test("VIE.js StanbolService - ContentHub: Upload of content / Retrieval of enhan
//TODO: This does not work in jQuery :(
start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});
@@ -509,24 +509,24 @@ test("VIE.js StanbolService - ContentHub: Lookup", function () {
stop();
stanbol.connector.lookup(entity, function (response) {
- var entities = VIE.Util.rdf2Entities(stanbol, response);
- ok(entities.length > 0, "With 'create'");
- start();
+ var entities = VIE.Util.rdf2Entities(stanbol, response);
+ ok(entities.length > 0, "With 'create'");
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
}, {
- create : true
+ create : true
});
stop();
stanbol.connector.lookup(entity, function (response) {
- var entities = VIE.Util.rdf2Entities(stanbol, response);
- ok(entities.length > 0, "Without 'create'");
- start();
+ var entities = VIE.Util.rdf2Entities(stanbol, response);
+ ok(entities.length > 0, "Without 'create'");
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});
*/
@@ -555,12 +555,12 @@ test("VIE.js StanbolConnector - LDPath - on all sites", function () {
stop();
// on all sites
stanbol.connector.ldpath(ldpath, context, function (response) {
- var entities = VIE.Util.rdf2Entities(stanbol, response);
- ok(entities.length > 0);
- start();
+ var entities = VIE.Util.rdf2Entities(stanbol, response);
+ ok(entities.length > 0);
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});
test("VIE.js StanbolService - LDPath - on one specific site", function () {
@@ -586,14 +586,14 @@ test("VIE.js StanbolService - LDPath - on one specific site", function () {
// on one specific site
stanbol.connector.ldpath(ldpath, context, function (response) {
- var entities = VIE.Util.rdf2Entities(stanbol, response);
- ok(entities.length > 0);
- start();
+ var entities = VIE.Util.rdf2Entities(stanbol, response);
+ ok(entities.length > 0);
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
}, {
- site: "dbpedia"
+ site: "dbpedia"
});
});
@@ -620,14 +620,14 @@ test("VIE.js StanbolService - LDPath - on local entities", function () {
stop();
// on local entities
stanbol.connector.ldpath(ldpath, context, function (response) {
- var entities = VIE.Util.rdf2Entities(stanbol, response);
- ok(entities.length > 0);
- start();
+ var entities = VIE.Util.rdf2Entities(stanbol, response);
+ ok(entities.length > 0);
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
}, {
- local : true
+ local : true
});
});
@@ -639,10 +639,10 @@ test("VIE.js StanbolService - Create a New Fact Schema", function () {
var employeeOfFact = {
"@context" : {
- "iks" : "http://iks-project.eu/ont/",
- "@types" : {
- "person" : "iks:person",
- "organization" : "iks:organization"
+ "iks" : "http://iks-project.eu/ont/",
+ "@types" : {
+ "person" : "iks:person",
+ "organization" : "iks:organization"
}
}
};
@@ -659,11 +659,11 @@ test("VIE.js StanbolService - Create a New Fact Schema", function () {
stop();
// on all sites
stanbol.connector.createFactSchema(employeeOfFactURL, employeeOfFact, function (response) {
- debugger;
- start();
+ debugger;
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});
@@ -673,14 +673,14 @@ test("VIE.js StanbolService - Create a New Fact", function () {
}
var fact = {
- "@context" : {
- "iks" : "http://iks-project.eu/ont/",
- "upb" : "http://upb.de/persons/"
- },
- "@profile" : "iks:employeeOf",
- "person" : { "@iri" : "upb:bnagel" },
- "organization" : { "@iri" : "http://uni-paderborn.de"}
- };
+ "@context" : {
+ "iks" : "http://iks-project.eu/ont/",
+ "upb" : "http://upb.de/persons/"
+ },
+ "@profile" : "iks:employeeOf",
+ "person" : { "@iri" : "upb:bnagel" },
+ "organization" : { "@iri" : "http://uni-paderborn.de"}
+ };
var z = new VIE();
ok (z.StanbolService);
@@ -690,62 +690,62 @@ test("VIE.js StanbolService - Create a New Fact", function () {
stop();
stanbol.connector.createFact(fact, function (response) {
- debugger;
- start();
+ debugger;
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
var moreFactsOfSameType = {
- "@context" : {
- "iks" : "http://iks-project.eu/ont/",
- "upb" : "http://upb.de/persons/"
- },
- "@profile" : "iks:employeeOf",
- "@subject" : [
- { "person" : { "@iri" : "upb:bnagel" },
- "organization" : { "@iri" : "http://uni-paderborn.de" }
- },
- { "person" : { "@iri" : "upb:fchrist" },
- "organization" : { "@iri" : "http://uni-paderborn.de" }
- }
- ]
- };
+ "@context" : {
+ "iks" : "http://iks-project.eu/ont/",
+ "upb" : "http://upb.de/persons/"
+ },
+ "@profile" : "iks:employeeOf",
+ "@subject" : [
+ { "person" : { "@iri" : "upb:bnagel" },
+ "organization" : { "@iri" : "http://uni-paderborn.de" }
+ },
+ { "person" : { "@iri" : "upb:fchrist" },
+ "organization" : { "@iri" : "http://uni-paderborn.de" }
+ }
+ ]
+ };
stop();
stanbol.connector.createFact(moreFactsOfSameType, function (response) {
- debugger;
- start();
+ debugger;
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
var moreFactsOfDifferentType = {
- "@context" : {
- "iks" : "http://iks-project.eu/ont/",
- "upb" : "http://upb.de/persons/"
- },
- "@subject" : [
- { "@profile" : "iks:employeeOf",
- "person" : { "@iri" : "upb:bnagel" },
- "organization" : { "@iri" : "http://uni-paderborn.de" }
- },
- { "@profile" : "iks:friendOf",
- "person" : { "@iri" : "upb:bnagel" },
- "friend" : { "@iri" : "upb:fchrist" }
- }
- ]
- };
+ "@context" : {
+ "iks" : "http://iks-project.eu/ont/",
+ "upb" : "http://upb.de/persons/"
+ },
+ "@subject" : [
+ { "@profile" : "iks:employeeOf",
+ "person" : { "@iri" : "upb:bnagel" },
+ "organization" : { "@iri" : "http://uni-paderborn.de" }
+ },
+ { "@profile" : "iks:friendOf",
+ "person" : { "@iri" : "upb:bnagel" },
+ "friend" : { "@iri" : "upb:fchrist" }
+ }
+ ]
+ };
stop();
stanbol.connector.createFact(moreFactsOfDifferentType, function (response) {
- debugger;
- start();
+ debugger;
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});
@@ -755,19 +755,19 @@ test("VIE.js StanbolService - Query for Facts of a Certain Type", function () {
}
var query = {
- "@context" : {
- "iks" : "http://iks-project.eu/ont/"
- },
- "select" : [ "person" ],
- "from" : "iks:employeeOf",
- "where" : [
- {
- "=" : {
- "organization" : { "@iri" : "http://uni-paderborn.de" }
- }
- }
- ]
- };
+ "@context" : {
+ "iks" : "http://iks-project.eu/ont/"
+ },
+ "select" : [ "person" ],
+ "from" : "iks:employeeOf",
+ "where" : [
+ {
+ "=" : {
+ "organization" : { "@iri" : "http://uni-paderborn.de" }
+ }
+ }
+ ]
+ };
var z = new VIE();
ok (z.StanbolService);
@@ -777,11 +777,11 @@ test("VIE.js StanbolService - Query for Facts of a Certain Type", function () {
stop();
stanbol.connector.queryFact(query, function (response) {
- debugger;
- start();
+ debugger;
+ start();
}, function (err) {
- ok(false, err);
- start();
+ ok(false, err);
+ start();
});
});

0 comments on commit ed354db

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