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:
parent
4c3f5109eb
commit
979a0c4aee
5 changed files with 177 additions and 164 deletions
19
db/init.go
19
db/init.go
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue