Import errors: Attr should have @lang directive in schema to mutate edge

I’m trying to import the Brick ( schema into DGraph using “dgraph live”, having converted the Turtle files to n-quads via rapper, but every tuple with a literal with a language tag throws and error like:

Error while mutating Attr: [] should have @lang directive in schema to mutate edge: [entity:2470046 attr:"" value:"Speed" lang:"en" ]

Tuples look like:

<> <> "Speed"@en .

I apologize for the newbie question, but this whole domain is new to me.

You should set the schema for the predicate <> to be language strings.

<>: string @lang .

If you’re trying out Dgraph for the first time, well, welcome! You can check out the Tour of Dgraph to familiarize yourself with Dgraph.

Thanks for the very fast response.

Yes, I am well past the tour and am now trying to do something “useful” with building data as a PoC.

So. there are many predicates, with several difference namespaces, using languages tags, but no schema settings for them. I suspect that this question is kind of specific to the Brick schema I’m trying to load, but in general, could you says whether would these all be defined in one’s import file up front? Or is there likely a “base” schema file (for somewhere that I should have loaded first or something like that?

This whole business of RDF schemas and graph databases certainly involves a learning curve :slight_smile:

Dgraph has its own schema where you can specify the types and indices for each predicate in Dgraph.

The schema can be set up-front as a file you pass to the live loader. e.g., the schema file can look like this (say, in a file named schema.txt):

<predicate1>: string @lang .
<predicate2>: string @lang .
<predicate3>: string @lang .

Then you can pass this to live loader with the -s flag:

dgraph live -r data.rdf.gz -s schema.txt

More about the format of making schema changes is in the docs:

1 Like

Nice. Thanks, I was wondering about the -s flag.

The full docs for the Dgraph Live Loader are here:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.