Discussion Forum

Error loading schema + strange error message

Hi, currently working on implementing Grakn for medical literature database and trying to load a schema in but having strange issue with ‘abstract’ being flagged as an error (see attached pic). Furthermore, the suggested solution ‘mismatched input’ seems to be incorrect in this context? I have attached a copy of the terminal output containing the error message and schema I am using. If anyone has any advice please get in touch would love to get this fixed. Cheers

Screenshot 2020-02-11 at 11.59.35

1 Like

“abstract” is a reserved keyword. You won’t be able to use that term to label an attribute/entity/etc. If you’re trying to make something abstract, take a look at this for the correct syntax.

Thanks for the reply! One more question, the script is now failing at the final line with the below error. Any suggestions?

Screenshot 2020-02-11 at 12.52.00

You should just need a “;” after the “commit”.
It’s probably a bit misleading that Grakn doesn’t use them in the examples on the homepage.

Ah that was my first thought too but unfortunately that also fails with Screenshot 2020-02-11 at 12.57.21

It’s been a while since I’ve used the Grakn console. Looks like that’s what you’re using too. Turns out you don’t need the “commit” at all. Give it a try without including that.

Tried with a few more variations and finally got it down to this error code. To my knowledge paper is not a reserved keyword and I’ve never seen it reject a custom label?

If you’re willing to share your schema I may be able to see what’s wrong. Other than that I would try cleaning the database and reloading the schema. That error looks like something I’ve seen when I changed my schema in ways that made the previous schema logically invalid (I think I tried to use an entity as a role or something).

Sure here you are. Thanks for all the help!

define

authored_by sub relation,
relates paper,
relates author,
has publication_date;

paper sub entity,
has paper_abstract,
has conclusions,
has copyrights,
has doi,
has journal,
has keywords,
has methods,
has pubmed_id,
has results,
has title,
has xml;

author sub entity,
has firstname,
has lastname,
has initial,
has affiliation;

publication_date sub attribute,
datatype string;
paper_abstract sub attribute,
datatype string;
conclusions sub attribute,
datatype string;
copyrights sub attribute,
datatype string;
doi sub attribute,
datatype string;
journal sub attribute,
datatype string;
keywords sub attribute,
datatype string;
methods sub attribute,
datatype string;
pubmed_id sub attribute,
datatype string;
results sub attribute,
datatype string;
title sub attribute,
datatype string;
xml sub attribute,
datatype string;
firstname sub attribute,
datatype string;
lastname sub attribute,
datatype string;
initials sub attribute,
datatype string;
affiliation sub attribute,
datatype string;

No problem, I’m working on a better plugin for working with Graql syntax so this helps me too.

Using this, I found a couple issues:

You can ignore the underscore under “relation” but the “paper”, “author”, and “initial” are valid issues.

You’ve defined “paper” and “author” as entities. Entities cannot “relates” to things. You might want to take a look at this.

Also, “initial” has not been defined. You need to create the attribute for it to use it as a “has”.

1 Like

Thanks for looking at my schema! So in turns of solutions I can think of the following:

  • As entities cannot relate to things I can instead link the paper to author by using the entities’ attributes?

My only other question is do you know why ‘initial’ isn’t defined? I can’t see why as it wasn’t set up differently to any other attributes. Thanks!

I probably should have mentioned a warning at the bottom which said “initials” was unused.
My guess is you meant to type “initial” :stuck_out_tongue:.

I’m no expert at designing schemas but maybe something like:

paper_authorship sub relation,
relates authored_paper,
relates paper_author,
has publication_date;

And then:

paper sub entity,
plays authored_paper…

author sub entity,
plays paper_author…

2 Likes

It just got committed successfully! Thanks so much, lifesaver.