Skip to content

Commit 77a3460

Browse files
optimised queries in woql for connections
1 parent f76456d commit 77a3460

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/viewer/woqlChooser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ WOQLChooser.prototype.setResult = function(result){
3737
const variables = result.getVariableList();
3838
if(!this.config.values() && variables.length){
3939
this.config.values(variables[0]);
40-
alert(variables[0]);
4140
}
4241
//sort it
4342
if(this.config.sort()){

lib/woql.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -930,28 +930,28 @@ WOQLQuery.prototype.documentProperties = function(id){
930930

931931
WOQLQuery.prototype.getDocumentConnections = function(id){
932932
return this.and(
933+
WOQL.eq("v:Docid", id),
934+
WOQL.triple("v:Entid", "type", "v:Enttype"),
935+
WOQL.sub("v:Enttype", "tcs:Document"),
933936
WOQL.or(
934937
WOQL.triple("v:Docid", "v:Outgoing", "v:Entid"),
935938
WOQL.triple("v:Entid", "v:Incoming", "v:Docid")
936939
),
937-
WOQL.eq("v:Docid", id),
938-
WOQL.triple("v:Entid", "type", "v:Enttype"),
939-
WOQL.sub("v:Enttype", "tcs:Document"),
940940
WOQL.opt().triple("v:Entid", "rdfs:label", "v:Label"),
941941
WOQL.opt().quad("v:Enttype", "rdfs:label", "v:Class_Label", "db:schema")
942942
);
943943
}
944944

945945
WOQLQuery.prototype.getAllDocumentConnections = function(){
946946
return this.and(
947+
WOQL.sub("v:Enttype", "tcs:Document"),
947948
WOQL.triple("v:doc1", "type", "v:Enttype"),
949+
WOQL.triple("v:doc1", "v:Predicate", "v:doc2"),
948950
WOQL.triple("v:doc2", "type", "v:Enttype2"),
949-
WOQL.not().eq("v:doc1", "v:doc2"),
950-
WOQL.sub("v:Enttype", "tcs:Document"),
951951
WOQL.sub("v:Enttype2", "tcs:Document"),
952-
WOQL.triple("v:doc1", "v:Predicate", "v:doc2"),
953952
WOQL.opt().triple("v:doc1", "rdfs:label", "v:Label1"),
954-
WOQL.opt().triple("v:doc2", "rdfs:label", "v:Label2")
953+
WOQL.opt().triple("v:doc2", "rdfs:label", "v:Label2"),
954+
WOQL.not().eq("v:doc1", "v:doc2")
955955
);
956956
}
957957

0 commit comments

Comments
 (0)