Create quads hierarchy

* Move nquads into quad.
* Create cquads simplified parser in quad.
* Move Triple (renamed Quad) to quad.

Also made sure mongo actually implements BulkLoader.
This commit is contained in:
kortschak 2014-07-27 17:42:45 +09:30
parent 01bc63810b
commit 401c58426f
51 changed files with 13400 additions and 5495 deletions

View file

@ -19,13 +19,13 @@ import (
"reflect"
"testing"
"github.com/google/cayley/graph"
"github.com/google/cayley/quad"
)
var parseTests = []struct {
message string
input string
expect []*graph.Triple
expect []*quad.Quad
err error
}{
{
@ -34,7 +34,7 @@ var parseTests = []struct {
{"subject": "foo", "predicate": "bar", "object": "baz"},
{"subject": "foo", "predicate": "bar", "object": "baz", "provenance": "graph"}
]`,
expect: []*graph.Triple{
expect: []*quad.Quad{
{"foo", "bar", "baz", ""},
{"foo", "bar", "baz", "graph"},
},
@ -45,7 +45,7 @@ var parseTests = []struct {
input: `[
{"subject": "foo", "predicate": "bar", "object": "foo", "something_else": "extra data"}
]`,
expect: []*graph.Triple{
expect: []*quad.Quad{
{"foo", "bar", "foo", ""},
},
err: nil,
@ -56,7 +56,7 @@ var parseTests = []struct {
{"subject": "foo", "predicate": "bar"}
]`,
expect: nil,
err: fmt.Errorf("Invalid triple at index %d. %v", 0, &graph.Triple{"foo", "bar", "", ""}),
err: fmt.Errorf("Invalid triple at index %d. %v", 0, &quad.Quad{"foo", "bar", "", ""}),
},
}