// orMorphism is the union, vice intersection, of a path and the current iterator.
func orMorphism(p *Path) morphism {
	return morphism{
		Name:     "or",
		Reversal: func(ctx *pathContext) (morphism, *pathContext) { return orMorphism(p), ctx },
		Apply: func(qs graph.QuadStore, in graph.Iterator, ctx *pathContext) (graph.Iterator, *pathContext) {
			itR := p.BuildIteratorOn(qs)
			or := iterator.NewOr(in, itR)
			return or, ctx
		},
	}
}
func bothMorphism(tags []string, via ...interface{}) morphism {
	return morphism{
		Name:     "in",
		Reversal: func(ctx *pathContext) (morphism, *pathContext) { return bothMorphism(tags, via...), ctx },
		Apply: func(qs graph.QuadStore, in graph.Iterator, ctx *pathContext) (graph.Iterator, *pathContext) {
			path := buildViaPath(qs, via...)
			inSide := inOutIterator(path, in, true, tags, ctx)
			outSide := inOutIterator(path, in.Clone(), false, tags, ctx)
			or := iterator.NewOr(inSide, outSide)
			return or, ctx
		},
		tags: tags,
	}
}