Skip to content

Commit 40ce8c1

Browse files
committed
fixing commit path query and adding data list structure
1 parent 257a336 commit 40ce8c1

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

lib/query/woqlCore.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ function getClauseAndRemainder(pat) {
644644
}
645645
return []
646646
}
647-
if (pat[0] == '+' || pat[0] == ',' || pat[0] == '|') {
647+
if (pat[0] == '+' || pat[0] == ',' || pat[0] == '|' || pat[0] == '*') {
648648
let ret = [pat[0]]
649649
if (pat.substring(1)) ret.push(pat.substring(1))
650650
return ret
@@ -655,7 +655,7 @@ function getClauseAndRemainder(pat) {
655655
return ret
656656
}
657657
for (var i = 1; i < pat.length; i++) {
658-
if (pat[i] == ',' || pat[i] == '|' || pat[i] == '+' || pat[i] == '{')
658+
if (pat[i] == ',' || pat[i] == '|' || pat[i] == '+' || pat[i] == '{' || pat[i] == '*')
659659
return [pat.substring(0, i), pat.substring(i)]
660660
}
661661
return [pat]
@@ -676,14 +676,17 @@ function compilePredicate(pp, q) {
676676
}
677677
} else if (pp.indexOf('<') != -1) {
678678
let pred = pp.slice(1, pp.length)
679-
let cleaned = pred == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pred)
679+
//let cleaned = pred == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pred)
680+
let cleaned = q.cleanPathPredicate(pred)
680681
return {'@type': 'InvertedPathPredicate', 'predicate': cleaned}
681682
} else if (pp.indexOf('>') != -1) {
682683
let pred = pp.slice(0, pp.length - 1)
683-
let cleaned = pred == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pred)
684+
//let cleaned = pred == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pred)
685+
let cleaned = q.cleanPathPredicate(pred)
684686
return {'@type': 'PathPredicate', 'predicate': cleaned}
685687
} else {
686-
let pred = pp == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pp)
688+
//let pred = pp == '*' ? 'owl:topObjectProperty' : q.cleanPathPredicate(pp)
689+
let pred = q.cleanPathPredicate(pp)
687690
return {'@type': 'PathPredicate', 'predicate': pred}
688691
}
689692
}
@@ -726,6 +729,12 @@ function tokensToJSON(seq, q) {
726729
'@type': 'PathPlus',
727730
'plus': tokensToJSON([seq[0]], q),
728731
}
732+
} else if (seq[1] == '*') {
733+
//binds tightest of all
734+
return {
735+
'@type': 'PathStar',
736+
'star': tokensToJSON([seq[0]], q),
737+
}
729738
} else if (seq[1].charAt(0) == '{') {
730739
//binds tightest of all
731740
let meat = seq[1].substring(1, seq[1].length - 1).split(',')

lib/query/woqlQuery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ WOQLQuery.prototype.path = function(Subject, Pattern, Object, Path) {
932932
this.cursor['@type'] = 'Path'
933933
this.cursor['subject'] = this.cleanSubject(Subject)
934934
if (typeof Pattern == 'string') Pattern = this.compilePathPattern(Pattern)
935-
this.cursor['path_pattern'] = Pattern
935+
this.cursor['pattern'] = Pattern
936936
this.cursor['object'] = this.cleanObject(Object)
937937
this.cursor['path'] = this.varj(Path)
938938
return this
@@ -968,4 +968,4 @@ WOQLQuery.prototype.type_of = function(a, b) {
968968
return this
969969
}
970970

971-
module.exports = WOQLQuery
971+
module.exports = WOQLQuery

0 commit comments

Comments
 (0)