Convert to Prefix/String in graph.Triple

This commit is contained in:
Barak Michener 2014-07-02 19:56:16 -04:00
parent 1f67913ed9
commit 7b87e08e89
2 changed files with 20 additions and 3 deletions

View file

@ -60,7 +60,7 @@ const (
Provenance
)
func (d Direction) String() string {
func (d Direction) Prefix() string {
switch d {
case Any:
return "a"
@ -77,6 +77,23 @@ func (d Direction) String() string {
}
}
func (d Direction) String() string {
switch d {
case Any:
return "any"
case Subject:
return "subject"
case Predicate:
return "predicate"
case Provenance:
return "provenance"
case Object:
return "object"
default:
return fmt.Sprint("illegal direction:", byte(d))
}
}
// TODO(kortschak) Consider writing methods onto the concrete type
// instead of the pointer. This needs benchmarking to make the decision.