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

@ -138,16 +138,16 @@ func (q *Query) buildIteratorTreeMapInternal(query map[string]interface{}, path
subAnd := graph.NewAndIterator()
predFixed := q.ses.ts.MakeFixed()
predFixed.AddValue(q.ses.ts.GetIdFor(pred))
subAnd.AddSubIterator(graph.NewLinksToIterator(q.ses.ts, predFixed, "p"))
subAnd.AddSubIterator(graph.NewLinksToIterator(q.ses.ts, predFixed, graph.Predicate))
if reverse {
lto := graph.NewLinksToIterator(q.ses.ts, builtIt, "s")
lto := graph.NewLinksToIterator(q.ses.ts, builtIt, graph.Subject)
subAnd.AddSubIterator(lto)
hasa := graph.NewHasaIterator(q.ses.ts, subAnd, "o")
hasa := graph.NewHasaIterator(q.ses.ts, subAnd, graph.Object)
subit = hasa
} else {
lto := graph.NewLinksToIterator(q.ses.ts, builtIt, "o")
lto := graph.NewLinksToIterator(q.ses.ts, builtIt, graph.Object)
subAnd.AddSubIterator(lto)
hasa := graph.NewHasaIterator(q.ses.ts, subAnd, "s")
hasa := graph.NewHasaIterator(q.ses.ts, subAnd, graph.Subject)
subit = hasa
}
}