Allow optional strict N-Quad parsing

This puts more of the logic in cayley, but other approaches require that
db knows about quad formats.
This commit is contained in:
kortschak 2014-08-08 10:28:18 +09:30
parent 4c3f5109eb
commit 979a0c4aee
5 changed files with 177 additions and 164 deletions

View file

@ -24,25 +24,10 @@ import (
var ErrNotPersistent = errors.New("database type is not persistent")
func Init(cfg *config.Config, triplePath string) error {
func Init(cfg *config.Config) error {
if !graph.IsPersistent(cfg.DatabaseType) {
return fmt.Errorf("ignoring unproductive database initialization request: %v", ErrNotPersistent)
}
err := graph.InitTripleStore(cfg.DatabaseType, cfg.DatabasePath, cfg.DatabaseOptions)
if err != nil {
return err
}
if triplePath != "" {
ts, err := Open(cfg)
if err != nil {
return err
}
err = Load(ts, cfg, triplePath)
if err != nil {
return err
}
ts.Close()
}
return err
return graph.InitTripleStore(cfg.DatabaseType, cfg.DatabasePath, cfg.DatabaseOptions)
}