From 41f6d3fd84b6dd3d4caa35ee5b8f08688f6a78db Mon Sep 17 00:00:00 2001 From: kortschak Date: Mon, 28 Jul 2014 21:52:02 +0930 Subject: [PATCH] Temporarily use cquads only I intend to make this configurable, but there is tight connection between db.Load and db.Open that is getting in the way of that. Testing on data set 30kmoviedata.cq.gz created by doing: zcat 30kmoviedata.nq.gz | sed 's/[<>]//g' | gzip -c > 30kmoviedata.cq.gz The following query is successful: [{ "type": "/film/film", "name": null, "/film/film/directed_by": { "name": "David Fincher" }, "/film/film/starring": [{ "/film/performance/actor": { "name": null } }] }] TODO: fix up naming for quads and make strict parsing an option. --- db/load.go | 4 ++-- db/repl.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/load.go b/db/load.go index 0a8d573..20953a7 100644 --- a/db/load.go +++ b/db/load.go @@ -26,7 +26,7 @@ import ( "github.com/google/cayley/config" "github.com/google/cayley/graph" "github.com/google/cayley/quad" - "github.com/google/cayley/quad/nquads" + "github.com/google/cayley/quad/cquads" ) func Load(ts graph.TripleStore, cfg *config.Config, path string) error { @@ -41,7 +41,7 @@ func Load(ts graph.TripleStore, cfg *config.Config, path string) error { glog.Fatalln(err) } - dec := nquads.NewDecoder(r) + dec := cquads.NewDecoder(r) bulker, canBulk := ts.(graph.BulkLoader) if canBulk { diff --git a/db/repl.go b/db/repl.go index 94dedb6..3dcd083 100644 --- a/db/repl.go +++ b/db/repl.go @@ -26,7 +26,7 @@ import ( "github.com/google/cayley/config" "github.com/google/cayley/graph" "github.com/google/cayley/graph/sexp" - "github.com/google/cayley/quad/nquads" + "github.com/google/cayley/quad/cquads" "github.com/google/cayley/query/gremlin" "github.com/google/cayley/query/mql" ) @@ -112,7 +112,7 @@ func Repl(ts graph.TripleStore, queryLanguage string, cfg *config.Config) error } if bytes.HasPrefix(line, []byte(":a")) { var tripleStmt = line[3:] - triple, err := nquads.Parse(string(tripleStmt)) + triple, err := cquads.Parse(string(tripleStmt)) if triple == nil { if err != nil { fmt.Printf("not a valid triple: %v\n", err) @@ -126,7 +126,7 @@ func Repl(ts graph.TripleStore, queryLanguage string, cfg *config.Config) error } if bytes.HasPrefix(line, []byte(":d")) { var tripleStmt = line[3:] - triple, err := nquads.Parse(string(tripleStmt)) + triple, err := cquads.Parse(string(tripleStmt)) if triple == nil { if err != nil { fmt.Printf("not a valid triple: %v\n", err)