Merge branch 'master' into benchmarks
This commit is contained in:
commit
1a0dd13735
77 changed files with 14272 additions and 1476 deletions
|
|
@ -23,6 +23,7 @@ import (
|
|||
|
||||
"github.com/google/cayley/graph"
|
||||
"github.com/google/cayley/graph/iterator"
|
||||
"github.com/google/cayley/quad"
|
||||
)
|
||||
|
||||
func (q *Query) buildFixed(s string) graph.Iterator {
|
||||
|
|
@ -33,7 +34,7 @@ func (q *Query) buildFixed(s string) graph.Iterator {
|
|||
|
||||
func (q *Query) buildResultIterator(path Path) graph.Iterator {
|
||||
all := q.ses.ts.NodesAllIterator()
|
||||
all.AddTag(string(path))
|
||||
all.Tagger().Add(string(path))
|
||||
return all
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +98,7 @@ func (q *Query) buildIteratorTreeInternal(query interface{}, path Path) (it grap
|
|||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
it.AddTag(string(path))
|
||||
it.Tagger().Add(string(path))
|
||||
return it, optional, nil
|
||||
}
|
||||
|
||||
|
|
@ -139,16 +140,16 @@ func (q *Query) buildIteratorTreeMapInternal(query map[string]interface{}, path
|
|||
subAnd := iterator.NewAnd()
|
||||
predFixed := q.ses.ts.FixedIterator()
|
||||
predFixed.Add(q.ses.ts.ValueOf(pred))
|
||||
subAnd.AddSubIterator(iterator.NewLinksTo(q.ses.ts, predFixed, graph.Predicate))
|
||||
subAnd.AddSubIterator(iterator.NewLinksTo(q.ses.ts, predFixed, quad.Predicate))
|
||||
if reverse {
|
||||
lto := iterator.NewLinksTo(q.ses.ts, builtIt, graph.Subject)
|
||||
lto := iterator.NewLinksTo(q.ses.ts, builtIt, quad.Subject)
|
||||
subAnd.AddSubIterator(lto)
|
||||
hasa := iterator.NewHasA(q.ses.ts, subAnd, graph.Object)
|
||||
hasa := iterator.NewHasA(q.ses.ts, subAnd, quad.Object)
|
||||
subit = hasa
|
||||
} else {
|
||||
lto := iterator.NewLinksTo(q.ses.ts, builtIt, graph.Object)
|
||||
lto := iterator.NewLinksTo(q.ses.ts, builtIt, quad.Object)
|
||||
subAnd.AddSubIterator(lto)
|
||||
hasa := iterator.NewHasA(q.ses.ts, subAnd, graph.Subject)
|
||||
hasa := iterator.NewHasA(q.ses.ts, subAnd, quad.Subject)
|
||||
subit = hasa
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
"github.com/google/cayley/graph"
|
||||
_ "github.com/google/cayley/graph/memstore"
|
||||
"github.com/google/cayley/quad"
|
||||
)
|
||||
|
||||
// This is a simple test graph.
|
||||
|
|
@ -36,7 +37,7 @@ import (
|
|||
// \-->|#D#|------------->+---+
|
||||
// +---+
|
||||
//
|
||||
var simpleGraph = []*graph.Triple{
|
||||
var simpleGraph = []*quad.Quad{
|
||||
{"A", "follows", "B", ""},
|
||||
{"C", "follows", "B", ""},
|
||||
{"C", "follows", "D", ""},
|
||||
|
|
@ -50,7 +51,7 @@ var simpleGraph = []*graph.Triple{
|
|||
{"G", "status", "cool", "status_graph"},
|
||||
}
|
||||
|
||||
func makeTestSession(data []*graph.Triple) *Session {
|
||||
func makeTestSession(data []*quad.Quad) *Session {
|
||||
ts, _ := graph.NewTripleStore("memstore", "", nil)
|
||||
for _, t := range data {
|
||||
ts.AddTriple(t)
|
||||
|
|
@ -164,7 +165,7 @@ var testQueries = []struct {
|
|||
},
|
||||
}
|
||||
|
||||
func runQuery(g []*graph.Triple, query string) interface{} {
|
||||
func runQuery(g []*quad.Quad, query string) interface{} {
|
||||
s := makeTestSession(g)
|
||||
c := make(chan interface{}, 5)
|
||||
go s.ExecInput(query, c, -1)
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func (s *Session) ExecInput(input string, c chan interface{}, limit int) {
|
|||
glog.V(2).Infoln(it.DebugString(0))
|
||||
}
|
||||
for {
|
||||
_, ok := it.Next()
|
||||
_, ok := graph.Next(it)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue