Skip to content

Commit 25d0551

Browse files
committed
Merge branch 'dev' of https://github.com/terminusdb/terminus-client into dev
2 parents 7a528bf + c85055e commit 25d0551

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

lib/objectFrame.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ ObjectFrame.prototype.getAsFrame = function (prop, parent) {
114114
return ff;
115115
};
116116

117+
ObjectFrame.prototype.getAsFrames = function (prop, parent) {
118+
var frames = [];
119+
for (const prop of Object.keys(this.properties)) {
120+
frames = frames.concat(frames, this.properties[prop].getAsFrames());
121+
}
122+
return frames;
123+
}
124+
117125
ObjectFrame.prototype.isnew = function () {
118126
return this.newDoc;
119127
};

lib/woql.js

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ WOQL.list = function(vars){ return new WOQLQuery().list(vars); }
5050
//These ones are special ones for dealing with the schema only...
5151
WOQL.addClass = function(classid, graph){ return new WOQLQuery().addClass(classid, graph); }
5252
WOQL.addProperty = function(propid, type, graph){ return new WOQLQuery().addProperty(propid, type, graph); }
53+
WOQL.deleteClass = function(classid, graph){ return new WOQLQuery().deleteClass(classid, graph); }
54+
WOQL.deleteProperty = function(propid, type, graph){ return new WOQLQuery().deleteProperty(propid, type, graph); }
5355
WOQL.node = function(nodeid, type){ return new WOQLQuery().node(nodeid, type); }
5456

5557

@@ -233,7 +235,6 @@ WOQLQuery.prototype.nspaces = function (n) {
233235
return spaces;
234236
};
235237

236-
237238
WOQLQuery.prototype.prettyPrint = function(indent, show_context, q, embed){
238239
if(!embed) this.indent = indent;
239240
q = (q ? q : this.query);
@@ -344,6 +345,7 @@ WOQLQuery.prototype.setPage = function (pagenum) {
344345
return this;
345346
};
346347

348+
<<<<<<< HEAD
347349

348350
WOQLQuery.prototype.hasStart = function () {
349351
return (typeof this.getPagingProperty('start') !== 'undefined');
@@ -354,6 +356,9 @@ WOQLQuery.prototype.getStart = function () {
354356
};
355357

356358
WOQLQuery.prototype.nextPage = function () {
359+
=======
360+
WOQLQuery.prototype.nextPage = function(){
361+
>>>>>>> c85055e6384aa4c834e1a014093ad63850781f8f
357362
return this.setPage(this.getPage() + 1);
358363
};
359364

@@ -367,9 +372,26 @@ WOQLQuery.prototype.previousPage = function () {
367372
return this;
368373
};
369374

375+
<<<<<<< HEAD
370376
WOQLQuery.prototype.hasSelect = function () {
371377
return this.getPagingProperty('select');
372378
};
379+
=======
380+
WOQLQuery.prototype.setPageSize = function(size){
381+
this.setPagingProperty("limit", size);
382+
if(this.hasStart()){
383+
this.setStart(0);
384+
}
385+
else {
386+
this.addStart(0);
387+
}
388+
return this;
389+
}
390+
391+
WOQLQuery.prototype.hasSelect = function(){
392+
return this.getPagingProperty("select");
393+
}
394+
>>>>>>> c85055e6384aa4c834e1a014093ad63850781f8f
373395

374396
WOQLQuery.prototype.getSelectVariables = function (q) {
375397
q = (q || this.query);
@@ -387,6 +409,7 @@ WOQLQuery.prototype.getSelectVariables = function (q) {
387409
}
388410
};
389411

412+
<<<<<<< HEAD
390413
WOQLQuery.prototype.setStart = function(start){
391414
return this.setPagingProperty("start", start);
392415
}
@@ -400,6 +423,19 @@ WOQLQuery.prototype.setPageSize = function (size) {
400423
}
401424
return this;
402425
};
426+
=======
427+
WOQLQuery.prototype.hasStart = function(){
428+
return (typeof this.getPagingProperty("start") != "undefined");
429+
}
430+
431+
WOQLQuery.prototype.getStart = function(){
432+
return this.getPagingProperty("start");
433+
}
434+
435+
WOQLQuery.prototype.setStart = function(start){
436+
return this.setPagingProperty("start", start);
437+
}
438+
>>>>>>> c85055e6384aa4c834e1a014093ad63850781f8f
403439

404440
/*
405441
* Called to indicate an update that is the last chainable element in a query
@@ -763,12 +799,22 @@ WOQLQuery.prototype.propertyMetadata = function(){
763799

764800
WOQLQuery.prototype.elementMetadata = function () {
765801
return this.and(
802+
<<<<<<< HEAD
766803
WOQL.quad('v:Element', 'rdf:type', 'v:Type', 'db:schema'),
767804
WOQL.opt().quad('v:Element', 'tcs:tag', 'v:Abstract', 'db:schema'),
768805
WOQL.opt().quad('v:Element', 'rdfs:label', 'v:Label', 'db:schema'),
769806
WOQL.opt().quad('v:Element', 'rdfs:comment', 'v:Comment', 'db:schema'),
770807
WOQL.opt().quad('v:Element', 'rdfs:domain', 'v:Domain', 'db:schema'),
771808
WOQL.opt().quad('v:Element', 'rdfs:range', 'v:Range', 'db:schema')
809+
=======
810+
WOQL.quad("v:Element", "rdf:type", "v:Type", "db:schema"),
811+
WOQL.opt().quad("v:Element", "tcs:tag", "v:Abstract", "db:schema"),
812+
WOQL.opt().quad("v:Element", "rdfs:label", "v:Label", "db:schema"),
813+
WOQL.opt().quad("v:Element", "rdfs:comment", "v:Comment", "db:schema"),
814+
WOQL.opt().quad("v:Element", "rdfs:subClassOf", "v:Parent", "db:schema"),
815+
WOQL.opt().quad("v:Element", "rdfs:domain", "v:Domain", "db:schema"),
816+
WOQL.opt().quad("v:Element", "rdfs:range", "v:Range", "db:schema")
817+
>>>>>>> c85055e6384aa4c834e1a014093ad63850781f8f
772818
);
773819
};
774820

@@ -861,36 +907,36 @@ WOQLQuery.prototype.cleanSubject = function(s){
861907
if(typeof s != "string") return s;
862908
if(s.indexOf(":") != -1) return s;
863909
if(this.vocab && this.vocab[s]) return this.vocab[s];
864-
return "v:" + s;
910+
return "doc:" + s;
865911
}
866912

867913
WOQLQuery.prototype.cleanPredicate = function(p){
868914
if(p.indexOf(":") != -1) return p;
869915
if(this.vocab && this.vocab[p]) return this.vocab[p];
870-
return "v:" + p;
916+
return "scm:" + p;
871917
}
872918
WOQLQuery.prototype.cleanType = function(t){
873919
if(t.indexOf(":") != -1) return t;
874920
if(this.vocab && this.vocab[t]) return this.vocab[t];
875-
return "v:" + t;
921+
return "scm:" + t;
876922
}
877923

878924
WOQLQuery.prototype.cleanObject = function(o){
879925
if(typeof o != "string" || o.indexOf(":") != -1) return o;
880926
if(this.vocab && this.vocab[o]) return this.vocab[o];
881-
return "v:" + o;
927+
return { "@value": o, "@language": "en"};
882928
}
883929

884930
WOQLQuery.prototype.cleanGraph = function(g){
885931
if(g.indexOf(":") != -1) return g;
886932
if(this.vocab && this.vocab[g]) return this.vocab[g];
887-
return "v:" + g;
933+
return "db:" + g;
888934
}
889935

890936
WOQLQuery.prototype.cleanClass = function(c){
891937
if(c.indexOf(":") != -1) return c;
892938
if(this.vocab && this.vocab[c]) return this.vocab[c];
893-
return "v:" + c;
939+
return "scm:" + c;
894940
}
895941

896942
/**
@@ -1038,7 +1084,7 @@ TripleBuilder.prototype.min = function(m){
10381084
return this.card(m, "min");
10391085
}
10401086

1041-
TripleBuilder.prototype.s = function(s){
1087+
TripleBuilder.prototype.node = function(s){
10421088
this.subject = this.query.cleanSubject(s);
10431089
return this;
10441090
}

0 commit comments

Comments
 (0)