Merge branch 'master' into nexter

Conflicts:
	graph/leveldb/all_iterator.go
	graph/leveldb/iterator.go
	graph/memstore/triplestore.go
	query/gremlin/finals.go
This commit is contained in:
kortschak 2014-08-07 06:52:36 +09:30
commit 62785d25c2
37 changed files with 882 additions and 467 deletions

View file

@ -101,13 +101,13 @@ func newTripleStore() *TripleStore {
return &ts
}
func (ts *TripleStore) AddTripleSet(triples []*quad.Quad) {
func (ts *TripleStore) AddTripleSet(triples []quad.Quad) {
for _, t := range triples {
ts.AddTriple(t)
}
}
func (ts *TripleStore) tripleExists(t *quad.Quad) (bool, int64) {
func (ts *TripleStore) tripleExists(t quad.Quad) (bool, int64) {
smallest := -1
var smallest_tree *llrb.LLRB
for d := quad.Subject; d <= quad.Label; d++ {
@ -134,19 +134,19 @@ func (ts *TripleStore) tripleExists(t *quad.Quad) (bool, int64) {
for it.Next() {
val := it.Result()
if t.Equals(&ts.triples[val.(int64)]) {
if t == ts.triples[val.(int64)] {
return true, val.(int64)
}
}
return false, 0
}
func (ts *TripleStore) AddTriple(t *quad.Quad) {
func (ts *TripleStore) AddTriple(t quad.Quad) {
if exists, _ := ts.tripleExists(t); exists {
return
}
var tripleID int64
ts.triples = append(ts.triples, *t)
ts.triples = append(ts.triples, t)
tripleID = ts.tripleIdCounter
ts.size++
ts.tripleIdCounter++
@ -175,7 +175,7 @@ func (ts *TripleStore) AddTriple(t *quad.Quad) {
// TODO(barakmich): Add VIP indexing
}
func (ts *TripleStore) RemoveTriple(t *quad.Quad) {
func (ts *TripleStore) RemoveTriple(t quad.Quad) {
var tripleID int64
var exists bool
tripleID = 0
@ -221,8 +221,8 @@ func (ts *TripleStore) RemoveTriple(t *quad.Quad) {
}
}
func (ts *TripleStore) Quad(index graph.Value) *quad.Quad {
return &ts.triples[index.(int64)]
func (ts *TripleStore) Quad(index graph.Value) quad.Quad {
return ts.triples[index.(int64)]
}
func (ts *TripleStore) TripleIterator(d quad.Direction, value graph.Value) graph.Iterator {