diff --git a/VERSION b/VERSION
index 434dcac4f..732aa7d7d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.9
\ No newline at end of file
+1.2.10
\ No newline at end of file
diff --git a/dependencies/graknlabs/dependencies.bzl b/dependencies/graknlabs/dependencies.bzl
index 70fce750f..39e92e276 100644
--- a/dependencies/graknlabs/dependencies.bzl
+++ b/dependencies/graknlabs/dependencies.bzl
@@ -29,12 +29,12 @@ def graknlabs_grakn_core():
git_repository(
name = "graknlabs_grakn_core",
remote = "https://github.com/graknlabs/grakn",
- commit = "ababa285be4d0d71a537d77d1990c4291da7c16e", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_grakn_core
+ tag = "1.7.2", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_grakn_core
)
def graknlabs_client_nodejs():
git_repository(
name = "graknlabs_client_nodejs",
remote = "https://github.com/graknlabs/client-nodejs",
- commit = "b85668f7063b2313ed02ab35cd0922e67d1f9f4b", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_client_nodejs
+ tag = "1.7.0", # sync-marker: do not remove this comment, this is used for sync-dependencies by @graknlabs_client_nodejs
)
diff --git a/package.json b/package.json
index 4a8df4f5e..149838cf2 100644
--- a/package.json
+++ b/package.json
@@ -51,7 +51,7 @@
"@blueprintjs/table": "^3.1.1",
"codemirror": "^5.38.0",
"electron-store": "^1.3.0",
- "grakn-client": "https://repo.grakn.ai/repository/npm-snapshot-group/grakn-client/-/grakn-client-0.0.0-b85668f7063b2313ed02ab35cd0922e67d1f9f4b.tgz",
+ "grakn-client": "1.7.0",
"grpc": "^1.18.0",
"hex-to-hsl": "^1.0.2",
"image-data-uri": "^1.1.1",
@@ -165,5 +165,5 @@
"prebuild": "node version.js",
"unit": "node ./node_modules/jest/bin/jest.js ./test/unit"
},
- "version": "1.2.9"
+ "version": "1.2.10"
}
\ No newline at end of file
diff --git a/src/renderer/components/SchemaDesign/LeftBar/NewAttributePanel.vue b/src/renderer/components/SchemaDesign/LeftBar/NewAttributePanel.vue
index 220df46af..a559907cd 100644
--- a/src/renderer/components/SchemaDesign/LeftBar/NewAttributePanel.vue
+++ b/src/renderer/components/SchemaDesign/LeftBar/NewAttributePanel.vue
@@ -24,12 +24,12 @@
data type
-
-
{{valueType}}
+
+
{{dataType}}
@@ -371,8 +371,8 @@
superTypes: [],
superType: undefined,
showDataTypeList: false,
- valueTypes: ['string', 'long', 'double', 'boolean', 'datetime'],
- valueType: undefined,
+ dataTypes: ['string', 'long', 'double', 'boolean', 'date'],
+ dataType: undefined,
showSpinner: false,
toggledAttributeTypes: [],
toggledRoleTypes: [],
@@ -411,7 +411,7 @@
if (val !== 'attribute') { // if super type is not 'attribute' set data type of super type
const graknTx = await this[OPEN_GRAKN_TX]();
const attributeType = await graknTx.getSchemaConcept(val);
- this.valueType = (await attributeType.valueType()).toLowerCase();
+ this.dataType = (await attributeType.dataType()).toLowerCase();
this.showDataTypeList = false;
const sup = await graknTx.getSchemaConcept(val);
@@ -419,7 +419,7 @@
this.hasAttributes = this.hasAttributes.filter(x => !this.supAttributes.includes(x));
graknTx.close();
} else {
- this.valueType = this.valueTypes[0];
+ this.dataType = this.dataTypes[0];
this.hasAttributes = this.metaTypeInstances.attributes;
this.supAttributes = [];
@@ -433,7 +433,7 @@
} else {
this.showSpinner = true;
this[DEFINE_ATTRIBUTE_TYPE]({
- attributeLabel: this.attributeLabel, superType: this.superType, valueType: this.valueType, attributeTypes: this.toggledAttributeTypes, roleTypes: this.toggledRoleTypes,
+ attributeLabel: this.attributeLabel, superType: this.superType, dataType: this.dataType, attributeTypes: this.toggledAttributeTypes, roleTypes: this.toggledRoleTypes,
})
.then(() => {
this.showSpinner = false;
@@ -452,7 +452,7 @@
this.showAttributeTypeList = false;
},
selectDataType(type) {
- this.valueType = type;
+ this.dataType = type;
this.showDataTypeList = false;
},
resetPanel() {
@@ -461,7 +461,7 @@
this.showDataTypeList = false;
this.superTypes = ['attribute', ...this.metaTypeInstances.attributes];
this.superType = this.superTypes[0];
- this.valueType = this.valueTypes[0];
+ this.dataType = this.dataTypes[0];
this.toggledAttributeTypes = [];
this.toggledRoleTypes = [];
this.showHasPanel = false;
diff --git a/src/renderer/components/SchemaDesign/RightBar/ConceptInfoTab/AttributesPanel.vue b/src/renderer/components/SchemaDesign/RightBar/ConceptInfoTab/AttributesPanel.vue
index 0b3f2cf6d..889c8d23e 100644
--- a/src/renderer/components/SchemaDesign/RightBar/ConceptInfoTab/AttributesPanel.vue
+++ b/src/renderer/components/SchemaDesign/RightBar/ConceptInfoTab/AttributesPanel.vue
@@ -12,7 +12,7 @@
-
{{value.type}}: {{value.valueType}}
+
{{value.type}}: {{value.dataType}}
diff --git a/src/renderer/components/SchemaDesign/SchemaHandler.js b/src/renderer/components/SchemaDesign/SchemaHandler.js
index 4a8290c42..a361b8f1e 100644
--- a/src/renderer/components/SchemaDesign/SchemaHandler.js
+++ b/src/renderer/components/SchemaDesign/SchemaHandler.js
@@ -1,4 +1,4 @@
-import { valueType } from 'grakn-client';
+import { dataType } from 'grakn-client';
let tx;
@@ -6,14 +6,14 @@ function SchemaHandler(graknTx) {
tx = graknTx;
}
-function toGraknDatatype(valueTypeParam) {
- switch (valueTypeParam) {
- case 'string': return valueType.STRING;
- case 'datetime': return valueType.DATETIME;
- case 'boolean': return valueType.BOOLEAN;
- case 'long': return valueType.LONG;
- case 'double': return valueType.DOUBLE;
- default: throw new Error(`Datatype not recognised. Received [${valueTypeParam}]`);
+function toGraknDatatype(dataTypeParam) {
+ switch (dataTypeParam) {
+ case 'string': return dataType.STRING;
+ case 'date': return dataType.DATETIME;
+ case 'boolean': return dataType.BOOLEAN;
+ case 'long': return dataType.LONG;
+ case 'double': return dataType.DOUBLE;
+ default: throw new Error(`Datatype not recognised. Received [${dataTypeParam}]`);
}
}
@@ -37,8 +37,8 @@ SchemaHandler.prototype.defineRelationType = async function define({ relationLab
return type;
};
-SchemaHandler.prototype.defineAttributeType = async function define({ attributeLabel, superType, valueType }) {
- const type = await tx.putAttributeType(attributeLabel, toGraknDatatype(valueType));
+SchemaHandler.prototype.defineAttributeType = async function define({ attributeLabel, superType, dataType }) {
+ const type = await tx.putAttributeType(attributeLabel, toGraknDatatype(dataType));
const directSuper = await tx.getSchemaConcept(superType);
await type.sup(directSuper);
};
diff --git a/src/renderer/components/SchemaDesign/SchemaUtils.js b/src/renderer/components/SchemaDesign/SchemaUtils.js
index d0d1f1de4..809cc38e4 100644
--- a/src/renderer/components/SchemaDesign/SchemaUtils.js
+++ b/src/renderer/components/SchemaDesign/SchemaUtils.js
@@ -27,7 +27,7 @@ export async function loadMetaTypeInstances(graknTx) {
.then(labels => labels.filter(l => l !== 'entity')
.concat()
.sort());
- metaTypeInstances.relations = await Promise.all(rels.map(async type => type.label()))
+ metaTypeInstances.relations = await Promise.all(rels.map(async type => ((!await type.isImplicit()) ? type.label() : null)))
.then(labels => labels.filter(l => l && l !== 'relation')
.concat()
.sort());
@@ -35,7 +35,7 @@ export async function loadMetaTypeInstances(graknTx) {
.then(labels => labels.filter(l => l !== 'attribute')
.concat()
.sort());
- metaTypeInstances.roles = await Promise.all(roles.map(async type => type.label()))
+ metaTypeInstances.roles = await Promise.all(roles.map(async type => ((!await type.isImplicit()) ? type.label() : null)))
.then(labels => labels.filter(l => l && l !== 'role')
.concat()
.sort());
@@ -47,7 +47,7 @@ export async function computeAttributes(nodes, graknTx) {
return Promise.all(nodes.map(async (node) => {
const concept = await graknTx.getSchemaConcept(node.label);
const attributes = await (await concept.attributes()).collect();
- node.attributes = await Promise.all(attributes.map(async concept => ({ type: await concept.label(), valueType: await concept.valueType() })));
+ node.attributes = await Promise.all(attributes.map(async concept => ({ type: await concept.label(), dataType: await concept.dataType() })));
return node;
}));
}
@@ -57,7 +57,7 @@ export async function computeRoles(nodes, graknTx) {
return Promise.all(nodes.map(async (node) => {
const concept = await graknTx.getSchemaConcept(node.label);
const roles = await (await concept.playing()).collect();
- node.roles = await Promise.all(roles.map(concept => concept.label())).then(nodes => nodes.filter(x => x));
+ node.roles = await Promise.all(roles.map(async concept => ((await concept.isImplicit()) ? null : concept.label()))).then(nodes => nodes.filter(x => x));
return node;
}));
}
diff --git a/src/renderer/components/SchemaDesign/store/actions.js b/src/renderer/components/SchemaDesign/store/actions.js
index 22f573d53..690e9ff4b 100644
--- a/src/renderer/components/SchemaDesign/store/actions.js
+++ b/src/renderer/components/SchemaDesign/store/actions.js
@@ -31,8 +31,8 @@ import CDB from '../../shared/CanvasDataBuilder';
import { META_LABELS } from '../../shared/SharedUtils';
export default {
- async [OPEN_GRAKN_TX]({ state, commit }) {
- const graknTx = await state.graknSession.transaction().write();
+ async [OPEN_GRAKN_TX]({ commit }) {
+ const graknTx = await global.graknSession.transaction().write();
if (!global.graknTx) global.graknTx = {};
global.graknTx.schemaDesign = graknTx;
commit('setSchemaHandler', new SchemaHandler(graknTx));
@@ -43,7 +43,8 @@ export default {
if (keyspace !== state.currentKeyspace) {
dispatch(CANVAS_RESET);
commit('currentKeyspace', keyspace);
- await commit('graknSession', await global.grakn.session(keyspace));
+ if (global.graknSession) await global.graknSession.close();
+ global.graknSession = await global.grakn.session(keyspace);
dispatch(UPDATE_METATYPE_INSTANCES);
dispatch(LOAD_SCHEMA);
}
diff --git a/src/renderer/components/SchemaDesign/store/mutations.js b/src/renderer/components/SchemaDesign/store/mutations.js
index e359fb157..d3ef11a50 100644
--- a/src/renderer/components/SchemaDesign/store/mutations.js
+++ b/src/renderer/components/SchemaDesign/store/mutations.js
@@ -5,9 +5,6 @@ export default {
loadingSchema(state, isRunning) {
state.loadingSchema = isRunning;
},
- graknSession(state, session) {
- state.graknSession = session;
- },
setVisFacade(state, facade) {
state.visFacade = Object.freeze(facade); // Freeze it so that Vue does not attach watchers to its properties
},
diff --git a/src/renderer/components/SchemaDesign/store/state.js b/src/renderer/components/SchemaDesign/store/state.js
index eaeec43b0..e35463126 100644
--- a/src/renderer/components/SchemaDesign/store/state.js
+++ b/src/renderer/components/SchemaDesign/store/state.js
@@ -7,7 +7,6 @@ export default {
currentKeyspace: null,
selectedNodes: null,
loadingSchema: false,
- graknSession: undefined,
canvasData: { entities: 0, attributes: 0, relations: 0 },
contextMenu: { show: false, x: null, y: null },
schemaHandler: undefined,
diff --git a/src/renderer/components/Visualiser/TopBar/GraqlEditor/GraqlCodeMirror.js b/src/renderer/components/Visualiser/TopBar/GraqlEditor/GraqlCodeMirror.js
index fdf61656b..355987543 100644
--- a/src/renderer/components/Visualiser/TopBar/GraqlEditor/GraqlCodeMirror.js
+++ b/src/renderer/components/Visualiser/TopBar/GraqlEditor/GraqlCodeMirror.js
@@ -7,7 +7,7 @@ CodeMirror.defineSimpleMode('graql', {
start: [
{ regex: /#.*/, token: 'comment' },
{ regex: /".*?"/, token: 'string' },
- { regex: /(match|isa|isa!|sub|sub!|has|id|type|limit|offset|sort|asc|desc|get|compute|path|from|to)(?![-a-zA-Z_0-9])/, // eslint-disable-line max-len
+ { regex: /(match|insert|delete|select|isa|sub|plays|relates|datatype|abstract|has|value|id|of|limit|offset|order|by|compute|from|to|in|aggregate|label|get|using|where)(?![-a-zA-Z_0-9])/, // eslint-disable-line max-len
token: 'keyword' },
{ regex: /true|false/, token: 'number' },
{ regex: /\$[-a-zA-Z_0-9]+/, token: 'variable' },
diff --git a/src/renderer/components/Visualiser/VisualiserUtils.js b/src/renderer/components/Visualiser/VisualiserUtils.js
index b6f9bf7a5..968557d6c 100644
--- a/src/renderer/components/Visualiser/VisualiserUtils.js
+++ b/src/renderer/components/Visualiser/VisualiserUtils.js
@@ -87,7 +87,7 @@ export async function loadMetaTypeInstances(graknTx) {
.then(labels => labels.filter(l => l !== 'entity')
.concat()
.sort());
- metaTypeInstances.relations = await Promise.all(rels.map(type => type.label()))
+ metaTypeInstances.relations = await Promise.all(rels.map(async type => ((!await type.isImplicit()) ? type.label() : null)))
.then(labels => labels.filter(l => l && l !== 'relation')
.concat()
.sort());
@@ -95,7 +95,7 @@ export async function loadMetaTypeInstances(graknTx) {
.then(labels => labels.filter(l => l !== 'attribute')
.concat()
.sort());
- metaTypeInstances.roles = await Promise.all(roles.map(type => type.label()))
+ metaTypeInstances.roles = await Promise.all(roles.map(async type => ((!await type.isImplicit()) ? type.label() : null)))
.then(labels => labels.filter(l => l && l !== 'role')
.concat()
.sort());
@@ -128,6 +128,27 @@ export function addResetGraphListener(dispatch, action) {
});
}
+/**
+ * Checks if a ConceptMap inside the provided Answer contains at least one implicit concept
+ * @param {Object} answer ConceptMap Answer to be inspected
+ * @return {Boolean}
+ */
+async function answerContainsImplicitType(answer) {
+ const concepts = Array.from(answer.map().values());
+ return Promise.all(concepts.map(async concept => ((concept.isThing()) ? (await concept.type()).isImplicit() : concept.isImplicit())))
+ .then(a => a.includes(true));
+}
+
+/**
+ * Filters out Answers that contained inferred concepts in their ConceptMap
+ * @param {Object[]} answers array of ConceptMap Answers to be inspected
+ * @return {Object[]} filtered array of Answers
+ */
+export async function filterMaps(answers) { // Filter out ConceptMaps that contain implicit relations
+ return Promise.all(answers.map(async x => ((await answerContainsImplicitType(x)) ? null : x)))
+ .then(maps => maps.filter(map => map));
+}
+
/**
* Executes query to load neighbours of given node and filters our all the answers that contain implicit concepts, given that we
* don't want to show implicit concepts (relations to attributes) to the user, for now.
@@ -138,5 +159,11 @@ export function addResetGraphListener(dispatch, action) {
export async function getFilteredNeighbourAnswers(node, graknTx, limit) {
const query = getNeighboursQuery(node, limit);
const resultAnswers = await (await graknTx.query(query)).collect();
+ const filteredResult = await filterMaps(resultAnswers);
+ if (resultAnswers.length !== filteredResult.length) {
+ const offsetDiff = resultAnswers.length - filteredResult.length;
+ node.offset += QuerySettings.getNeighboursLimit();
+ return filteredResult.concat(await getFilteredNeighbourAnswers(node, graknTx, offsetDiff));
+ }
return resultAnswers;
}
diff --git a/src/renderer/components/shared/CanvasDataBuilder.js b/src/renderer/components/shared/CanvasDataBuilder.js
index f57c21d0d..eb83269f8 100644
--- a/src/renderer/components/shared/CanvasDataBuilder.js
+++ b/src/renderer/components/shared/CanvasDataBuilder.js
@@ -40,9 +40,16 @@ const getConceptLabel = (concept) => {
return label;
};
+const shouldVisualiseInstance = (instance) => {
+ let shouldSkip = false;
+ if (instance.type().isImplicit()) shouldSkip = true;
+ return !shouldSkip;
+};
+
const shouldVisualiseType = (type) => {
let shouldSkip = false;
- if (META_LABELS.has(getConceptLabel(type))) shouldSkip = true;
+ if (type.isImplicit()) shouldSkip = true;
+ else if (META_LABELS.has(getConceptLabel(type))) shouldSkip = true;
return !shouldSkip;
};
@@ -253,7 +260,7 @@ const buildInstances = async (answers) => {
}));
}).reduce(collect, []);
- const shouldVisualiseVals = data.map(item => item.concept.isThing());
+ const shouldVisualiseVals = data.map(item => item.concept.isThing() && shouldVisualiseInstance(item.concept));
data = data.map((item, index) => {
item.shouldVisualise = shouldVisualiseVals[index];
return item;
@@ -496,7 +503,7 @@ const buildNeighbours = async (targetConcept, answers) => {
}));
}).reduce(collect, []);
- const shouldVisualiseVals = data.map(item => item.concept.isThing());
+ const shouldVisualiseVals = data.map(item => item.concept.isThing() && shouldVisualiseInstance(item.concept));
data = data.map((item, index) => {
item.shouldVisualise = shouldVisualiseVals[index];
@@ -543,7 +550,7 @@ const buildRPInstances = async (answers, currentData, shouldLimit, graknTx) => {
answers.forEach((answer) => {
Array.from(answer.map().entries()).forEach(([graqlVar, concept]) => {
- if (concept.isRelation()) {
+ if (concept.isRelation() && shouldVisualiseInstance(concept)) {
const relation = concept;
promises.push(new Promise((resolve) => {
diff --git a/test/helpers/MockConcepts.js b/test/helpers/MockConcepts.js
index 760eeb2d3..b222e9665 100644
--- a/test/helpers/MockConcepts.js
+++ b/test/helpers/MockConcepts.js
@@ -5,6 +5,7 @@ function getMockEntityType() {
id: '0000',
label: () => Promise.resolve('person'),
instances: () => Promise.resolve({ next: () => Promise.resolve(getMockEntity1()) }), // eslint-disable-line no-use-before-define
+ isImplicit: () => Promise.resolve(false),
attributes: () => Promise.resolve({ next: () => Promise.resolve(getMockAttributeType()), collect: () => Promise.resolve([getMockAttributeType()]) }), // eslint-disable-line no-use-before-define
playing: () => Promise.resolve({ next: () => Promise.resolve(getMockRoleType1()), collect: () => Promise.resolve([getMockRoleType1(), getMockRoleType2()]) }), // eslint-disable-line no-use-before-define
isType: () => true,
@@ -16,6 +17,7 @@ function getMockRoleType1() {
return {
baseType: 'Role_TYPE',
label: () => Promise.resolve('child'),
+ isImplicit: () => Promise.resolve(false),
};
}
@@ -23,6 +25,7 @@ function getMockRoleType2() {
return {
baseType: '',
label: () => Promise.resolve('@has'),
+ isImplicit: () => Promise.resolve(true),
};
}
@@ -31,8 +34,9 @@ function getMockAttributeType() {
baseType: 'ATTRIBUTE_TYPE',
id: '1111',
label: () => Promise.resolve('name'),
+ isImplicit: () => Promise.resolve(false),
isType: () => true,
- valueType: () => Promise.resolve('String'),
+ dataType: () => Promise.resolve('String'),
};
}
@@ -41,6 +45,7 @@ function getMockRelationType() {
baseType: 'RELATION_TYPE',
id: '2222',
label: () => Promise.resolve('parentship'),
+ isImplicit: () => Promise.resolve(false),
};
}
@@ -48,6 +53,7 @@ function getMockImplicitRelationType() {
return {
baseType: 'RELATION_TYPE',
id: '2222',
+ isImplicit: () => Promise.resolve(true),
isThing: () => false,
};
}
diff --git a/test/helpers/gene.gql b/test/helpers/gene.gql
index d2976a1f7..c915b33b4 100644
--- a/test/helpers/gene.gql
+++ b/test/helpers/gene.gql
@@ -21,15 +21,15 @@ person sub entity,
# Resources
-identifier sub attribute, value string;
-firstname sub attribute, value string;
-surname sub attribute, value string;
-middlename sub attribute, value string;
-picture sub attribute, value string;
-age sub attribute, value long;
-birth-date sub attribute, value datetime;
-death-date sub attribute, value datetime;
-gender sub attribute, value string;
+identifier sub attribute, datatype string;
+firstname sub attribute, datatype string;
+surname sub attribute, datatype string;
+middlename sub attribute, datatype string;
+picture sub attribute, datatype string;
+age sub attribute, datatype long;
+birth-date sub attribute, datatype date;
+death-date sub attribute, datatype date;
+gender sub attribute, datatype string;
# Roles and Relations
diff --git a/test/helpers/mockedConcepts.js b/test/helpers/mockedConcepts.js
index 1b310224e..5b03a5ab7 100644
--- a/test/helpers/mockedConcepts.js
+++ b/test/helpers/mockedConcepts.js
@@ -17,9 +17,11 @@ const methods = {
},
local: {
label: () => 'thing',
+ isImplicit: () => false,
},
remote: {
label: () => Promise.resolve('thing'),
+ isImplicit: () => Promise.resolve(false),
},
},
type: {
@@ -73,7 +75,7 @@ const methods = {
},
remote: {
label: () => Promise.resolve('attribute-type'),
- valueType: () => Promise.resolve('string'),
+ dataType: () => Promise.resolve('string'),
},
},
relationType: {
@@ -120,11 +122,11 @@ const methods = {
isEntity: () => true,
},
local: {
- valueType: () => 'string',
+ dataType: () => 'string',
value: () => 'attribute-value',
},
remote: {
- valueType: () => Promise.resolve('string'),
+ dataType: () => Promise.resolve('string'),
value: () => Promise.resolve('attribute-value'),
owners: () => Promise.resolve({ collect: Promise.resolve([]) }),
},
@@ -136,7 +138,7 @@ const methods = {
isEntity: () => true,
},
local: {
- valueType: () => 'string',
+ dataType: () => 'string',
value: () => 'relation-value',
},
remote: {
diff --git a/test/integration/SchemaDesign/SchemaHandler.test.js b/test/integration/SchemaDesign/SchemaHandler.test.js
index f1e94f1a6..0b27a3fb7 100644
--- a/test/integration/SchemaDesign/SchemaHandler.test.js
+++ b/test/integration/SchemaDesign/SchemaHandler.test.js
@@ -44,7 +44,7 @@ describe('Actions', () => {
let graknTx = await graknSession.transaction().write();
const schemaHandler = new SchemaHandler(graknTx);
- await schemaHandler.defineAttributeType({ attributeLabel: 'name', valueType: 'string' });
+ await schemaHandler.defineAttributeType({ attributeLabel: 'name', dataType: 'string' });
await graknTx.commit();
graknTx = await graknSession.transaction().write();
diff --git a/test/unit/components/ScehmaDesign/SchemaUtils.test.js b/test/unit/components/ScehmaDesign/SchemaUtils.test.js
index 58652fb7e..5fcb7f3f9 100644
--- a/test/unit/components/ScehmaDesign/SchemaUtils.test.js
+++ b/test/unit/components/ScehmaDesign/SchemaUtils.test.js
@@ -22,7 +22,7 @@ describe('Schema Utils', () => {
const nodes = await computeAttributes([entityType], graknTx);
expect(nodes[0].attributes[0].type).toBe('attribute-type');
- expect(nodes[0].attributes[0].valueType).toBe('string');
+ expect(nodes[0].attributes[0].dataType).toBe('string');
});
test('Compute Roles', async () => {
diff --git a/test/unit/components/ScehmaDesign/store/actions.test.js b/test/unit/components/ScehmaDesign/store/actions.test.js
index 41b653d3d..a2a53ba56 100644
--- a/test/unit/components/ScehmaDesign/store/actions.test.js
+++ b/test/unit/components/ScehmaDesign/store/actions.test.js
@@ -61,7 +61,7 @@ describe('actions', () => {
await store.dispatch(`schema-design/${CURRENT_KEYSPACE_CHANGED}`, 'gene');
expect(store.state['schema-design'].currentKeyspace).toBe('gene');
- expect(store.state['schema-design'].graknSession).toBeDefined();
+ expect(global.graknSession).toBeDefined();
});
test('OPEN_GRAKN_TX', async () => {
diff --git a/test/unit/components/Visualiser/VisualiserUtils.test.js b/test/unit/components/Visualiser/VisualiserUtils.test.js
index f078393fe..3156d4540 100644
--- a/test/unit/components/Visualiser/VisualiserUtils.test.js
+++ b/test/unit/components/Visualiser/VisualiserUtils.test.js
@@ -1,6 +1,7 @@
import {
limitQuery,
computeAttributes,
+ filterMaps,
validateQuery,
} from '@/components/Visualiser/VisualiserUtils.js';
@@ -11,6 +12,7 @@ import {
getMockedTransaction,
getMockedEntity,
getMockedAttribute,
+ getMockedRelation,
} from '../../../helpers/mockedConcepts';
Array.prototype.flatMap = function flat(lambda) { return Array.prototype.concat.apply([], this.map(lambda)); };
@@ -151,6 +153,26 @@ describe('Compute Attributes', () => {
});
});
+describe('Filters out Answers that contain inferred concepts in their ConceptMap', () => {
+ test('contains implicit type', async () => {
+ const implicitRelation = getMockedRelation({ extraProps: { local: { isImplicit: () => true } } });
+ const nonImplicitRelation = getMockedRelation();
+
+ const answer = getMockedConceptMap([nonImplicitRelation, implicitRelation]);
+
+ const nonImplicitOnlyAnswer = await filterMaps([answer]);
+ expect(nonImplicitOnlyAnswer).toHaveLength(1);
+ });
+
+ test('does not contains implicit type', async () => {
+ const nonImplicitRelation = getMockedRelation();
+ const answer = getMockedConceptMap([nonImplicitRelation]);
+
+ const nonImplicitOnlyAnswer = await filterMaps([answer]);
+ expect(nonImplicitOnlyAnswer).toHaveLength(1);
+ });
+});
+
describe('Validate Query', () => {
test('match get', async () => {
const query = 'match $p isa person; get;';
diff --git a/test/unit/components/shared/CanvasDataBuilder.test.js b/test/unit/components/shared/CanvasDataBuilder.test.js
index 9fdef3ecb..c2fcfc110 100644
--- a/test/unit/components/shared/CanvasDataBuilder.test.js
+++ b/test/unit/components/shared/CanvasDataBuilder.test.js
@@ -167,6 +167,22 @@ describe('building instances', () => {
});
});
+test('when graql answer contains an implicit instance', async () => {
+ const attribute = getMockedAttribute({
+ extraProps: {
+ local: {
+ type: () => getMockedAttributeType({
+ extraProps: { local: { isImplicit: () => true } },
+ }),
+ },
+ },
+ });
+ const answer = getMockedConceptMap([attribute]);
+ const { nodes, edges } = await CDB.buildInstances([answer]);
+ expect(nodes).toHaveLength(0);
+ expect(edges).toHaveLength(0);
+});
+
describe('building types', () => {
test('when graql answer contains a subtype of a meta type', async () => {
const entityType = getMockedEntityType({
@@ -395,6 +411,21 @@ describe('building types', () => {
});
});
+test('when graql answer contains an implicit type', async () => {
+ const relationType = getMockedRelationType({
+ extraProps: {
+ local: { isImplicit: () => true },
+ },
+ });
+
+ const answer = getMockedConceptMap([relationType]);
+
+ const { nodes, edges } = await CDB.buildTypes([answer]);
+
+ expect(nodes).toHaveLength(0);
+ expect(edges).toHaveLength(0);
+});
+
describe('building neighbours', () => {
test('when the target node is a type', async () => {
const entityType = getMockedEntityType({ isRemote: false });