Rename triple entities were relevant
This commit is contained in:
parent
ddf8849e60
commit
443a091b72
62 changed files with 664 additions and 664 deletions
|
|
@ -32,7 +32,7 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
graph.RegisterTripleStore("bolt", true, newQuadStore, createNewBolt)
|
||||
graph.RegisterQuadStore("bolt", true, newQuadStore, createNewBolt)
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -77,7 +77,7 @@ func createNewBolt(path string, _ graph.Options) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func newQuadStore(path string, options graph.Options) (graph.TripleStore, error) {
|
||||
func newQuadStore(path string, options graph.Options) (graph.QuadStore, error) {
|
||||
var qs QuadStore
|
||||
var err error
|
||||
db, err := bolt.Open(path, 0600, nil)
|
||||
|
|
@ -136,12 +136,12 @@ func bucketFor(d [4]quad.Direction) []byte {
|
|||
return []byte{d[0].Prefix(), d[1].Prefix(), d[2].Prefix(), d[3].Prefix()}
|
||||
}
|
||||
|
||||
func (qs *QuadStore) createKeyFor(d [4]quad.Direction, triple quad.Quad) []byte {
|
||||
func (qs *QuadStore) createKeyFor(d [4]quad.Direction, q quad.Quad) []byte {
|
||||
key := make([]byte, 0, (hashSize * 4))
|
||||
key = append(key, qs.convertStringToByteHash(triple.Get(d[0]))...)
|
||||
key = append(key, qs.convertStringToByteHash(triple.Get(d[1]))...)
|
||||
key = append(key, qs.convertStringToByteHash(triple.Get(d[2]))...)
|
||||
key = append(key, qs.convertStringToByteHash(triple.Get(d[3]))...)
|
||||
key = append(key, qs.convertStringToByteHash(q.Get(d[0]))...)
|
||||
key = append(key, qs.convertStringToByteHash(q.Get(d[1]))...)
|
||||
key = append(key, qs.convertStringToByteHash(q.Get(d[2]))...)
|
||||
key = append(key, qs.convertStringToByteHash(q.Get(d[3]))...)
|
||||
return key
|
||||
}
|
||||
|
||||
|
|
@ -243,11 +243,11 @@ func (qs *QuadStore) buildQuadWrite(tx *bolt.Tx, q quad.Quad, id int64, isAdd bo
|
|||
}
|
||||
|
||||
if isAdd && len(entry.History)%2 == 1 {
|
||||
glog.Error("Adding a valid triple ", entry)
|
||||
glog.Error("Adding a valid quad ", entry)
|
||||
return graph.ErrQuadExists
|
||||
}
|
||||
if !isAdd && len(entry.History)%2 == 0 {
|
||||
glog.Error("Deleting an invalid triple ", entry)
|
||||
glog.Error("Deleting an invalid quad ", entry)
|
||||
return graph.ErrQuadNotExist
|
||||
}
|
||||
|
||||
|
|
@ -373,7 +373,7 @@ func (qs *QuadStore) Quad(k graph.Value) quad.Quad {
|
|||
return json.Unmarshal(data, &q)
|
||||
})
|
||||
if err != nil {
|
||||
glog.Error("Error getting triple: ", err)
|
||||
glog.Error("Error getting quad: ", err)
|
||||
return quad.Quad{}
|
||||
}
|
||||
return q
|
||||
|
|
@ -459,7 +459,7 @@ func (qs *QuadStore) getMetadata() error {
|
|||
return err
|
||||
}
|
||||
|
||||
func (qs *QuadStore) TripleIterator(d quad.Direction, val graph.Value) graph.Iterator {
|
||||
func (qs *QuadStore) QuadIterator(d quad.Direction, val graph.Value) graph.Iterator {
|
||||
var bucket []byte
|
||||
switch d {
|
||||
case quad.Subject:
|
||||
|
|
@ -480,11 +480,11 @@ func (qs *QuadStore) NodesAllIterator() graph.Iterator {
|
|||
return NewAllIterator(nodeBucket, quad.Any, qs)
|
||||
}
|
||||
|
||||
func (qs *QuadStore) TriplesAllIterator() graph.Iterator {
|
||||
func (qs *QuadStore) QuadsAllIterator() graph.Iterator {
|
||||
return NewAllIterator(posBucket, quad.Predicate, qs)
|
||||
}
|
||||
|
||||
func (qs *QuadStore) TripleDirection(val graph.Value, d quad.Direction) graph.Value {
|
||||
func (qs *QuadStore) QuadDirection(val graph.Value, d quad.Direction) graph.Value {
|
||||
v := val.(*Token)
|
||||
offset := PositionOf(v, d, qs)
|
||||
if offset != -1 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue