Skip to content

Commit 5882681

Browse files
Changes for driver changes
1 parent 758e330 commit 5882681

28 files changed

+145
-96
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"rxjs": "~7.8.0",
4747
"sigma": "3.0.1",
4848
"tslib": "^2.3.0",
49-
"typedb-driver-http": "0.0.1",
49+
"@typedb/driver-http": "file:/Users/krishnangovindraj/code/typedb-driver/http-ts/dist",
5050
"typedb-web-common": "workspace:*",
5151
"uuid": "11.1.0",
5252
"zone.js": "~0.15.1",

pnpm-lock.yaml

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/concept/action.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66

7-
import { ApiResponse, QueryResponse } from "typedb-driver-http";
7+
import { ApiResponse, QueryResponse } from "@typedb/driver-http";
88
import { TransactionOperation } from "./transaction";
99

1010
interface DriverActionBase {

src/concept/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import {
88
Database, DriverParams, DriverParamsBasic, DriverParamsTranslated, isBasicParams, TranslatedAddress
9-
} from "typedb-driver-http";
9+
} from "@typedb/driver-http";
1010

1111
export class ConnectionConfig {
1212

src/concept/transaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
55
*/
66

7-
import { TransactionType } from "typedb-driver-http";
7+
import { TransactionType } from "@typedb/driver-http";
88
import { QueryRunAction } from "./action";
99

1010
export class Transaction {

src/framework/graph-visualiser/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EdgeKind, RoleType } from "typedb-driver-http";
1+
import { EdgeKind, RoleType } from "@typedb/driver-http";
22
import {DataVertex, DataVertexKind, VertexUnavailable} from "./graph";
33
import {Color} from "chroma-js";
44

src/framework/graph-visualiser/converter.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getVariableName, QueryConstraintAny, QueryStructure, QueryVertex } from "typedb-driver-http";
1+
import { getVariableName, ConstraintVertexAny } from "@typedb/driver-http";
22
import {
33
EdgeAttributes,
44
EdgeMetadata,
@@ -21,13 +21,18 @@ import {
2121
} from "./graph";
2222
import {ILogicalGraphConverter} from "./visualisation";
2323
import {StudioConverterStructureParameters, StudioConverterStyleParameters} from "./config";
24+
import {
25+
AnalyzedPipelineBackwardsCompatible,
26+
backwardCompatible_expressionAssigned,
27+
ConstraintBackwardsCompatible
28+
} from "./index";
2429

25-
type QueryVertexOrSpecial = QueryVertex | VertexFunction | VertexExpression;
30+
type ConstraintVertexOrSpecial = ConstraintVertexAny | VertexFunction | VertexExpression;
2631

2732
export class StudioConverter implements ILogicalGraphConverter {
2833

2934
constructor(
30-
public readonly graph: VisualGraph, public readonly queryStructure: QueryStructure,
35+
public readonly graph: VisualGraph, public readonly queryStructure: AnalyzedPipelineBackwardsCompatible,
3136
public readonly isFollowupQuery: boolean, public readonly structureParameters: StudioConverterStructureParameters,
3237
public readonly styleParameters: StudioConverterStyleParameters
3338
) {
@@ -81,11 +86,11 @@ export class StudioConverter implements ILogicalGraphConverter {
8186
return `${from_id}:${to_id}:${edge_type_id}`;
8287
}
8388

84-
private shouldCreateNode(queryVertex: QueryVertexOrSpecial) {
89+
private shouldCreateNode(queryVertex: ConstraintVertexOrSpecial) {
8590
return shouldCreateNode(this.queryStructure, queryVertex);
8691
}
8792

88-
private shouldCreateEdge(edge: DataConstraintAny, from: QueryVertexOrSpecial, to: QueryVertexOrSpecial) {
93+
private shouldCreateEdge(edge: DataConstraintAny, from: ConstraintVertexOrSpecial, to: ConstraintVertexOrSpecial) {
8994
return shouldCreateEdge(this.queryStructure, edge.queryConstraint, from, to);
9095
}
9196

@@ -105,7 +110,7 @@ export class StudioConverter implements ILogicalGraphConverter {
105110
}
106111
}
107112

108-
private maybeCreateEdge(answerIndex: number, edge: DataConstraintAny, label: string, from: DataVertex, to: DataVertex, queryFrom: QueryVertexOrSpecial, queryTo: QueryVertexOrSpecial) {
113+
private maybeCreateEdge(answerIndex: number, edge: DataConstraintAny, label: string, from: DataVertex, to: DataVertex, queryFrom: ConstraintVertexOrSpecial, queryTo: ConstraintVertexOrSpecial) {
109114
if (this.shouldCreateEdge(edge, queryFrom, queryTo)) {
110115
let fromKey = this.put_vertex(answerIndex, from, queryFrom);
111116
let toKey = this.put_vertex(answerIndex, to, queryTo);
@@ -124,7 +129,7 @@ export class StudioConverter implements ILogicalGraphConverter {
124129

125130
// ILogicalGraphConverter
126131
// Vertices
127-
put_vertex(answerIndex: number, vertex: DataVertex, queryVertex: QueryVertexOrSpecial): string {
132+
put_vertex(answerIndex: number, vertex: DataVertex, queryVertex: ConstraintVertexOrSpecial): string {
128133
const key = vertexMapKey(vertex);
129134
if (this.shouldCreateNode(queryVertex)) {
130135
this.createVertex(key, this.vertexAttributes(vertex))
@@ -207,13 +212,11 @@ export class StudioConverter implements ILogicalGraphConverter {
207212
repr: constraint.text,
208213
vertex_map_key: expressionVertexKey
209214
}
210-
expression.assigned
211-
.forEach((assigned, i) => {
212-
let queryVertex = constraint.queryConstraint.assigned[i];
213-
let varNameOrId = getVariableName(this.queryStructure, queryVertex) ?? `$_${queryVertex.id}`;
214-
let label = `assign[${varNameOrId}]`;
215-
this.maybeCreateEdge(answerIndex, constraint, label, expressionVertex, assigned, expressionVertex, queryVertex);
216-
});
215+
216+
let queryVertex = backwardCompatible_expressionAssigned(constraint.queryConstraint);
217+
let varNameOrId = getVariableName(this.queryStructure, queryVertex) ?? `$_${queryVertex.id}`;
218+
let label = `assign[${varNameOrId}]`;
219+
this.maybeCreateEdge(answerIndex, constraint, label, expressionVertex, expression.assigned, expressionVertex, queryVertex);
217220
expression.arguments
218221
.forEach((arg, i) => {
219222
let queryVertex = constraint.queryConstraint.arguments[i];
@@ -253,15 +256,15 @@ export class StudioConverter implements ILogicalGraphConverter {
253256
}
254257
}
255258

256-
export function shouldCreateNode(structure: QueryStructure, vertex: QueryVertexOrSpecial) {
259+
export function shouldCreateNode(structure: AnalyzedPipelineBackwardsCompatible, vertex: ConstraintVertexOrSpecial) {
257260
return !(
258261
(vertex.tag === "label" ||
259262
(vertex.tag == "variable" && !structure.outputs.includes(vertex.id))
260263
)
261264
);
262265
}
263266

264-
export function shouldCreateEdge(structure: QueryStructure, _edge: QueryConstraintAny, from: QueryVertexOrSpecial, to: QueryVertexOrSpecial) {
267+
export function shouldCreateEdge(structure: AnalyzedPipelineBackwardsCompatible, _edge: ConstraintBackwardsCompatible, from: ConstraintVertexOrSpecial, to: ConstraintVertexOrSpecial) {
265268
return shouldCreateNode(structure, from) && shouldCreateNode(structure, to);
266269
}
267270

@@ -297,6 +300,6 @@ function functionVertexKeyFromArgsAndAssigned(constraint: DataConstraintFunction
297300

298301
function expressionVertexKeyFromArgsAndAssigned(constraint: DataConstraintExpression): string {
299302
let args = constraint.arguments.map(v => vertexMapKey(v)).join(",");
300-
let assigned = constraint.assigned.map(v => vertexMapKey(v)).join(",");
303+
let assigned = constraint.assigned;
301304
return `${constraint.text}(${args}) -> ${assigned}`;
302305
}

src/framework/graph-visualiser/defaults.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RoleType } from "typedb-driver-http";
1+
import { RoleType } from "@typedb/driver-http";
22
import chroma from "chroma-js";
33
import { vertexMapKey } from "./converter";
44
import {DataVertex, VertexUnavailable} from "./graph";

0 commit comments

Comments
 (0)