Stored in data store engine link schema:

interface LinkStored {
	id: number;
	type_id: number;
	from_id: number | 0;
	to_id: number | 0;
}

Link schema with graphql and deepclient relations:

interface Link {
	id: number;
	type_id: number;
	from_id: number | 0;
	to_id: number | 0;
	
	type: Link;
	from?: Link;
	to?: Link;

	typed: Link[]; // Links uses current link as theyr type_id
	in: Link[]; // Links related by to_id to current link
	out: Link[]; // Links related by from_id to current links

	string?: Value;
  number?: Value;
	object?: Value;

	value?: Value; // relation to string/number/object value
  // if you dont know type of value
	// not avaible on select/insert/update/delete op, only in
  // GraphQL/DeepClient results
}

interface Value {
	id: number; // sequental id in value type collections (strings/numbers/objects)
  link_id: number; // id of the link to which the value is attached
  value: string | number | object;
}

Value are data accessible by a .value relation from link.

Value

Values are stored in separate stores strings, numbers, objects in schema.

# create new type
mutation { insert_links(objects: {
	type_id: 1,
	# type without from_id and to_id - node/dot type
  # instances of this type can't have from_id and to_id too.
}) {
	returning { id }
}
{ data: { insert_links: { returning: [{
	id: 356
}] } } }
# add to out type, string Value support
mutation { insert_link(objects: {
	type_id: 4, # Value
  # 4 - await deep.id('@deep-foundation/core', 'Value')
	from_id: 356,
	to_id: 5, # String
}) {
	returning { id }
}
# after it we can create link instance of 356 with value
mutation { insert_link(objects: {
	type_id: 356,
	string: { data: { value: "Abc" } },
}) {
	returning { id }
}

Example of inserting type with string value support using DeepClient methods in js:

// 1 is base type link
const baseTypeId = await deep.id('@deep-foundation/core', 'Type');
baseTypeId; // 1

const { data: [{ id: id3 }] } = await deep.insert({
	type_id: baseTypeId,
	out: { data: {
		type_id: await deep.id('@deep-foundation/core', 'Value'),
		to_id: await deep.id('@deep-foundation/core', 'String'),
		// Supports now: String/Number/Object
	} }
});
// we create our link with type 1 without from and to references
// conceptualy id3 typeof 1
// now we can insert links with type = id3
// now any link typeof id3 can have value

const { data: [{ id: id3_1 }] } = await deep.insert({
	type_id: id3,
	string: { data: { value: 'abc' } }
	// in future versions just value: 'abc',
});
const { data: [{ id, value }] } = await deep.select(id3_1);
value; // { value: 'abc', link_id: id3_1 }

const { data: [{ id: id3_2 }] } = await deep.insert({ type_id: id3 });

// insert if not value exists in link
await deep.insert({ link_id: id3_2, value: 'abc' }, { table: 'strings' });
// update existed value
const updateResult = await deep.update({ link_id: id3_2 }, {
  value: 'def',
}, { table: 'strings' });
// delete existed value
const deleteResult = await deep.delete({ link_id: id3_2 }, { table: 'strings' });

// trying to insert already exsited link - transaction error
// trying to update not existed value - updateResult.data.length == 0
// trying to delete not existed value - deleteResult.data.length == 0

Search by strings and numbers supports all basic bool_exp operations. For search by objects available in Hasura JSONB operators, read here:

Postgres: Filter query results / search queries | Hasura GraphQL Docs

Link