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.
This commit is contained in:
kortschak 2014-07-28 21:52:02 +09:30
parent 401c58426f
commit 41f6d3fd84
2 changed files with 5 additions and 5 deletions

View file

@ -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 {

View file

@ -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)