Replace string type with graph.Direction

This conversion is not complete as there are still uses of string
directions via the Direction.String method in leveldb.
This commit is contained in:
kortschak 2014-06-30 12:33:55 +09:30
parent cd11053c98
commit 0a03cec497
21 changed files with 340 additions and 298 deletions

View file

@ -41,15 +41,15 @@ func TestIteratorsAndNextResultOrderA(t *testing.T) {
fixed := ts.MakeFixed()
fixed.AddValue(ts.GetIdFor("C"))
all := ts.GetNodesAllIterator()
lto := graph.NewLinksToIterator(ts, all, "o")
lto := graph.NewLinksToIterator(ts, all, graph.Object)
innerAnd := graph.NewAndIterator()
fixed2 := ts.MakeFixed()
fixed2.AddValue(ts.GetIdFor("follows"))
lto2 := graph.NewLinksToIterator(ts, fixed2, "p")
lto2 := graph.NewLinksToIterator(ts, fixed2, graph.Predicate)
innerAnd.AddSubIterator(lto2)
innerAnd.AddSubIterator(lto)
hasa := graph.NewHasaIterator(ts, innerAnd, "s")
hasa := graph.NewHasaIterator(ts, innerAnd, graph.Subject)
outerAnd := graph.NewAndIterator()
outerAnd.AddSubIterator(fixed)
outerAnd.AddSubIterator(hasa)
@ -98,7 +98,7 @@ func TestLinksToOptimization(t *testing.T) {
ts := MakeTestingMemstore()
fixed := ts.MakeFixed()
fixed.AddValue(ts.GetIdFor("cool"))
lto := graph.NewLinksToIterator(ts, fixed, "o")
lto := graph.NewLinksToIterator(ts, fixed, graph.Object)
lto.AddTag("foo")
newIt, changed := lto.Optimize()
if !changed {
@ -122,14 +122,14 @@ func TestRemoveTriple(t *testing.T) {
ts.RemoveTriple(graph.MakeTriple("E", "follows", "F", ""))
fixed := ts.MakeFixed()
fixed.AddValue(ts.GetIdFor("E"))
lto := graph.NewLinksToIterator(ts, fixed, "s")
lto := graph.NewLinksToIterator(ts, fixed, graph.Subject)
fixed2 := ts.MakeFixed()
fixed2.AddValue(ts.GetIdFor("follows"))
lto2 := graph.NewLinksToIterator(ts, fixed2, "p")
lto2 := graph.NewLinksToIterator(ts, fixed2, graph.Predicate)
innerAnd := graph.NewAndIterator()
innerAnd.AddSubIterator(lto2)
innerAnd.AddSubIterator(lto)
hasa := graph.NewHasaIterator(ts, innerAnd, "o")
hasa := graph.NewHasaIterator(ts, innerAnd, graph.Object)
newIt, _ := hasa.Optimize()
_, ok := newIt.Next()
if ok {