Syntax-Error when modeling (schema included)


#1

Hello someone can explain why I am getting the following error:
# load your schema into knowledge graph
./graql console -f ./schema.gql -k fusion_tree
syntax error at line 108:
linkes system_need,
^
no viable alternative at input 'linkes’
syntax error at line 109:
linkes epics;
^
no viable alternative at input 'linkes’
syntax error at line 112:
linkes epics,
^
no viable alternative at input 'linkes’
syntax error at line 113:
linkes functional_gap,
^
no viable alternative at input 'linkes’
syntax error at line 114:
linkes infrastructure_gap,

Thank you for any help! I am just getting started with Grakn. and this seems to be a small syntax error which I do not get.

My schema:

define

#Entities

system_needs sub entity
	has sn_number
	has requirement
	has user_story;

epics sub entity
	has ep_number
	has epic
	has objectives
	has details;
	
functional_gap sub entity
	has fg_number
	has function_type
	has data_level1
	has data_level2
	has valuation
	has comment
	has current_status_description
	has missing_status_description
	has description
	has redundancy
	has values
	has contact_person
	has optional_elements;

infrastructure_gap sub entity
	has ig_number
	has infrastructure_type
	has infrastructure_name
	has valuation
	has comment
	has current_status_description
	has missing_status_description;
	
organizational_gap sub entity
	has og_number
	has organizational_type
	has organizational_name
	has valuation
	has comment
	has current_status_description
	has missing_status_description;
	
measures sub entity
	has ms_number
	has solution_type
	has objective
	has business_benefits
	has howto
	has existing_tools;
	
#Resources
	
sn_number sub attribute datatype string;
requirement sub attribute datatype string;
user_story sub attribute datatype string;
	
ep_number sub attribute datatype string;
epic sub attribute datatype string;
objectives sub attribute datatype string;
details sub attribute datatype string;
	
fg_number sub attribute datatype string;
functional_type sub attribute datatype string;
data_level1 sub attribute datatype string;
data_level2 sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;
description sub attribute datatype string;
redundancy sub attribute datatype string;
values sub attribute datatype string;
contact_person sub attribute datatype string;
optional_elements sub attribute datatype string;
	
ig_number sub attribute datatype string;
infrastructure_type sub attribute datatype string;
infrastructure_name sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;

og_number sub attribute datatype string;
organizational_type sub attribute datatype string;
organizational_name sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;

ms_number sub attribute datatype string;
solution_type sub attribute datatype string;
objective sub attribute datatype string;
business_benefits sub attribute datatype string;
howto sub attribute datatype string;
existing_tools sub attribute datatype string;

# Roles and Relations

linkage_sn sub linkage
	linkes system_needs
	linkes epics;
	
linkage_ep sub linkage
	linkes epics
	linkes functional_gap
	linkes infrastructure_gap
	linkes organizational_gap
	linkes measures;
	
linkage_ms sub linkage
	linkes functional_gap
	linkes infrastructure_gap
	linkes organizational_gap;
	
linkage_fg sub linkage
	linkes infrastructure_gap;
	
linkage_ig sub linkage
	linkes organizational_gap;

#2

Not sure what the linkes keyword is but I think you mean to use relates.

Like so:

linkage_sn sub linkage
	relates system_needs
	relates epics;

#3

As above, plus you seem to be trying to relate relations directly via entity rather through roles they play:

So:

linkage_sn sub linkage
	relates system_needs
	relates epics;

should be something like:

system_needs plays system_needs_role;
epics plays epics_role;

linkage_sn sub linkage
	relates system_needs_role
	relates epics_role;

which means:

system_needs_role sub role;
epics_role sub role;

system_needs plays system_needs_role;
epics plays epics_role;

linkage_sn sub linkage
	relates system_needs_role
	relates epics_role;

#4

All the roles in the entities are missing also.
Here a useful link: http://dev.grakn.ai/docs/building-schema/basic-schema


#5

yeah paco i just started and looked at the Basic Schema


#6

So when defining a relation you define roles by just saying:

some-relation relates some-role;.

Under the hood an extra role some-role will be created. It is equiavalent to saying:

some-role sub role;.

What you need to do extra is to say which entity types can play that role which you do by saying:

some-entity-type plays some-role;


#7


So a role would be:
system_need sub entity
has sn_number
has requirement
has user_story
linked epics;


#8

Not sure if i understand it correctly, one way to do define your relationship is:

linkage sub relationship
  relates link;

system_need sub entity
  plays link;

epic sub entity
  plays link;

gap sub entity
  plays link;

functional-gap sub gap;
infrastructure-gap sub gap;
organisational-gap sub gap;

There is no unique way to model your domain. I assumed you want to relate all the entity types via a linkage relation which your schema above suggests.


#9

Simple example

define
person sub entity
has name
has surname
plays spouse1
plays spouse2;

using plays you define a role/s that can be played by the entity/entities

marriage sub relationship
relates spouse1
relates spouse2;

then you need to define the type of relationship and the roles of this relationship:


#10

Now I am getting “function_type doesn’t have an ‘isa’, a ‘sub’ or an ‘id’” Why?
I edited my schema to the following:
define

#Entities

system_need sub entity
	has sn_number
	has requirement
	has user_story
	plays link;

epics sub entity
	has ep_number
	has epic
	has objectives
	has details
	plays link;

gap sub entity
	plays link;
	
functional_gap sub gap
	has fg_number
	has function_type
	has data_level1
	has data_level2
	has valuation
	has comment
	has current_status_description
	has missing_status_description
	has description
	has redundancy
	has values
	has contact_person
	has optional_elements;

infrastructure_gap sub gap
	has ig_number
	has infrastructure_type
	has infrastructure_name
	has valuation
	has comment
	has current_status_description
	has missing_status_description;
	
organizational_gap sub gap
	has og_number
	has organizational_type
	has organizational_name
	has valuation
	has comment
	has current_status_description
	has missing_status_description;
	
measures sub entity
	has ms_number
	has solution_type
	has objective
	has business_benefits
	has howto
	has existing_tools
	plays link;
	
#Resources
	
sn_number sub attribute datatype string;
requirement sub attribute datatype string;
user_story sub attribute datatype string;
	
ep_number sub attribute datatype string;
epic sub attribute datatype string;
objectives sub attribute datatype string;
details sub attribute datatype string;
	
fg_number sub attribute datatype string;
functional_type sub attribute datatype string;
data_level1 sub attribute datatype string;
data_level2 sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;
description sub attribute datatype string;
redundancy sub attribute datatype string;
values sub attribute datatype string;
contact_person sub attribute datatype string;
optional_elements sub attribute datatype string;
	
ig_number sub attribute datatype string;
infrastructure_type sub attribute datatype string;
infrastructure_name sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;

og_number sub attribute datatype string;
organizational_type sub attribute datatype string;
organizational_name sub attribute datatype string;
valuation sub attribute datatype string;
comment sub attribute datatype string;
current_status_description sub attribute datatype string;
missing_status_description sub attribute datatype string;

ms_number sub attribute datatype string;
solution_type sub attribute datatype string;
objective sub attribute datatype string;
business_benefits sub attribute datatype string;
howto sub attribute datatype string;
existing_tools sub attribute datatype string;

# Roles and Relations

linkage sub relationship
	relates link;
	

# load your schema into knowledge graph
# ./graql console -f ./schema_fusiontree.gql -k fusion_tree

#11

That’s because you are referencing an attribute function-type when defining functional_gap which is not defined.

You should add a line saying something like this:

function-type sub attribute datatype string;


#12

sry this was just a typo (had it writtin under -> Resources) - THANK YOU GUYS for the support - I am a newbie :smile: and got welcomed really good :wink: