Skip to content

Commit e9e5961

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 10b519c + d458ab9 commit e9e5961

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

lib/woql.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ WOQLQuery.prototype.loadDefaultVocabulary = function(){
9494
vocab.type = "rdf:type";
9595
vocab.label = "rdfs:label";
9696
vocab.Class = "owl:Class";
97+
vocab.DatatypeProperty = "owl:DatatypeProperty";
98+
vocab.ObjectProperty = "owl:ObjectProperty";
99+
vocab.Entity = "tcs:Entity";
100+
vocab.Document = "tcs:Document";
101+
vocab.Relationship = "tcs:Relationship";
102+
vocab.temporality = "tcs:temporality";
103+
vocab.geotemporality = "tcs:geotemporality";
104+
vocab.geography = "tcs:geography";
105+
vocab.abstract = "tcs:abstract";
97106
vocab.comment = "rdfs:comment";
98107
vocab.range = "rdfs:range";
99108
vocab.domain = "rdfs:domain";
@@ -277,15 +286,15 @@ WOQLQuery.prototype.prettyPrint = function(indent, show_context, q, embed){
277286
str += "(\n" + this.nspaces(indent) + "WOQL." + clauses.join(",\n"+ this.nspaces(indent) + "WOQL.") + "\n" + this.nspaces(indent - this.indent) + ")";
278287

279288
}
280-
else if(typeof val[val.length-1] == "object" ){
289+
else if(typeof val[val.length-1] == "object" && typeof val[val.length-1]['@value'] == "undefined"){
281290
var nvals = []
282291
for(var i = 0; i<val.length-1; i++){
283292
if(key == "limit" || key == "start"){
284293
nvals.push(val[i]);
285294
}
286295
else {
287296
if(typeof val[i] == "string"){
288-
nvals.push('"' + self.unclean(val[i]) + '"');
297+
nvals.push(self.unclean(val[i]));
289298
}
290299
else if(typeof val[i] == "object"){
291300
nvals.push(JSON.stringify(val[i]));
@@ -297,8 +306,8 @@ WOQLQuery.prototype.prettyPrint = function(indent, show_context, q, embed){
297306
}
298307
if(nvals.length){
299308
str += unclean(nvals);
300-
if(key == "from") str += ")\n .";
301-
else str +=").";
309+
if(key == "from") str += "\n .";
310+
else str +=".";
302311
}
303312
else {
304313
str += "().";
@@ -474,8 +483,8 @@ WOQLQuery.prototype.when = function(Query, Update){
474483

475484
WOQLQuery.prototype.opt = function(query){
476485
if(query){
477-
q = (query.json ? query.json() : q);
478-
this.cursor["opt"] = [query];
486+
q = (query.json ? query.json() : query);
487+
this.cursor["opt"] = [q];
479488
}
480489
else {
481490
this.cursor['opt'] = [{}];
@@ -658,7 +667,8 @@ WOQLQuery.prototype.addClass = function(c, graph){
658667
}
659668

660669
WOQLQuery.prototype.addProperty = function(p, t, g){
661-
if(p && t){
670+
t = (t ? t : "xsd:string");
671+
if(p){
662672
graph = (g ? this.cleanGraph(g) : "db:schema");
663673
p = (p.indexOf(":") == -1) ? "scm:" + p : p;
664674
t = (t.indexOf(":") == -1) ? this.cleanType(t) : t ;

lib/woqlResult.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ const FrameHelper = require("./frameHelper");
22

33
function WOQLResult(results, query, config){
44
this.bindings = results.bindings;
5-
this.query = query;
5+
if(query.constructor.name == "WOQLQuery"){
6+
this.query = query;
7+
}
8+
else {
9+
this.query = query.query;
10+
}
611
this.cursor = 0;
712
if(!(config && config.no_compress)){
813
var context = (config && config.context ? config.context : false);

0 commit comments

Comments
 (0)