Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ defaults, and their descriptions.
[Add a New Connection](#connections-ui)
- Optional
- `GRAPH_TYPE` - `None` - If not specified, multiple connections will be
created for every available graph type / query language. See
created for every available query language. See
[Add a New Connection](#connections-ui)
- `USING_PROXY_SERVER` - `False` - See [Add a New Connection](#connections-ui)
- `IAM` - `False` - See [Add a New Connection](#connections-ui)
Expand Down
2 changes: 1 addition & 1 deletion additionaldocs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ manager used for the project is consistent.
corepack enable
```

### Supported Graph Types
### Supported Graph Data Models and Query Languages

- Labelled Property Graph (PG) using Gremlin or openCypher
- Resource Description Framework (RDF) using SPARQL
Expand Down
2 changes: 1 addition & 1 deletion additionaldocs/features/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ to add a new connection. You can also edit and delete connections.

- **Add a new connection:**
- **Name:** Enter a name for your connection (e.g., `MyNeptuneCluster`).
- **Graph Type:** Choose a graph data model that corresponds to your graph
- **Query Language:** Choose a query language that corresponds to your graph
database.
- **Public or proxy endpoint:** Provide the publicly accessible endpoint URL
for a graph database, e.g., Gremlin Server. If connecting to Amazon Neptune,
Expand Down
2 changes: 1 addition & 1 deletion additionaldocs/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ It comes with a very small graph dataset.
```
3. Open Graph Explorer and add a new connection
- Name: `Gremlin Server`
- Graph Type: `Gremlin`
- Query Language: `Gremlin`
- Public or Proxy Endpoint: `https://localhost`
- Using Proxy Server: `true`
- Graph Connection URL: `http://localhost:8182`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"target-type": "Target Label",
"property": "Property",
"properties": "Properties",
"graph-type": "PG-Gremlin",
"query-language": "PG-Gremlin",

"nodes-styling": {
"title": "Node Label Styling"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"target-type": "Target Label",
"property": "Property",
"properties": "Properties",
"graph-type": "PG-openCypher",
"query-language": "PG-openCypher",

"nodes-styling": {
"title": "Node Label Styling"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"target-type": "Target Class",
"property": "Datatype Property",
"properties": "Datatype Properties",
"graph-type": "RDF-SPARQL",
"query-language": "RDF-SPARQL",

"nodes-styling": {
"title": "Resource Styling"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ConnectionRow({
: null;

const graphType = t(
"graph-type",
"query-language",
connection.connection?.queryEngine || "gremlin",
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ function ConnectionDetail({ config }: ConnectionDetailProps) {
<GlobeIcon />
</InfoItemIcon>
<InfoItemContent>
<InfoItemLabel>Graph Type</InfoItemLabel>
<InfoItemValue>{t("graph-type")}</InfoItemValue>
<InfoItemLabel>Query Language</InfoItemLabel>
<InfoItemValue>{t("query-language")}</InfoItemValue>
</InfoItemContent>
</InfoItem>
<InfoItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ const CreateConnection = ({
/>
</FormItem>
<FormItem>
<Label>Graph Type</Label>
<Label>Query Language</Label>
<SelectField
options={CONNECTIONS_OP}
value={form.queryEngine}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("createErrorNotification", () => {
const notification = createErrorNotification(error, file, allConnections);

expect(notification).toBe(
`The graph file requires a connection to ${connection.dbUrl} using the graph type PG-Gremlin.`,
`The graph file requires a connection to ${connection.dbUrl} using the query language PG-Gremlin.`,
);
});

Expand All @@ -61,7 +61,7 @@ describe("createErrorNotification", () => {
const notification = createErrorNotification(error, file, allConnections);

expect(notification).toBe(
`The graph file requires a connection to ${connection.dbUrl} using the graph type RDF-SPARQL.`,
`The graph file requires a connection to ${connection.dbUrl} using the query language RDF-SPARQL.`,
);
});

Expand All @@ -75,7 +75,7 @@ describe("createErrorNotification", () => {
const notification = createErrorNotification(error, file, allConnections);

expect(notification).toBe(
`The graph file requires a connection to ${connection.dbUrl} using the graph type PG-openCypher.`,
`The graph file requires a connection to ${connection.dbUrl} using the query language PG-openCypher.`,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function createErrorNotification(
);

const displayQueryEngine = getTranslation(
"graph-type",
"query-language",
error.connection.queryEngine,
);

Expand All @@ -132,7 +132,7 @@ export function createErrorNotification(
return `The graph file requires switching to connection ${matchingConnection.displayLabel}.`;
} else {
const dbUrl = error.connection.dbUrl;
return `The graph file requires a connection to ${dbUrl} using the graph type ${displayQueryEngine}.`;
return `The graph file requires a connection to ${dbUrl} using the query language ${displayQueryEngine}.`;
}
}
return "Failed to load the graph because an error occurred.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
type DisplayAttribute,
type DisplayEdge,
} from "@/core";
import {
createRandomQueryEngine,
DbState,
renderHookWithState,
} from "@/utils/testing";
import { DbState, renderHookWithState } from "@/utils/testing";

import { useEdgeAttributesAsScalars } from "./useEdgeAttributesAsScalars";

Expand Down Expand Up @@ -48,20 +44,19 @@ describe("useEdgeAttributesAsScalars", () => {
dbState = new DbState();
});

describe("Gremlin/OpenCypher", () => {
describe("Gremlin", () => {
beforeEach(() => {
dbState.activeConfig.connection!.queryEngine =
createRandomQueryEngine("pg");
dbState.activeConfig.connection!.queryEngine = "gremlin";
});

it("should return ID, Label, and attributes for edge with unique ID", () => {
it("should return ID, Edge Label, and attributes for edge with unique ID", () => {
const { result } = renderHookWithState(
() => useEdgeAttributesAsScalars(edge),
dbState,
);

const scalars = result.current;
expect(scalars).toHaveLength(4); // ID + Label + 2 attributes
expect(scalars).toHaveLength(4); // ID + Edge Label + 2 attributes

expect(scalars[0]).toEqual(
createResultScalar({
Expand Down Expand Up @@ -93,7 +88,6 @@ describe("useEdgeAttributesAsScalars", () => {
});

it("should not include ID for edge without unique ID", () => {
dbState.activeConfig.connection!.queryEngine = "gremlin";
const edgeWithoutId = {
...edge,
hasUniqueId: false,
Expand All @@ -105,7 +99,7 @@ describe("useEdgeAttributesAsScalars", () => {
);

const scalars = result.current;
expect(scalars).toHaveLength(3); // Label + 2 attributes (no ID)
expect(scalars).toHaveLength(3); // Edge Label + 2 attributes (no ID)

expect(scalars[0]).toEqual(
createResultScalar({
Expand All @@ -116,6 +110,72 @@ describe("useEdgeAttributesAsScalars", () => {
});
});

describe("openCypher", () => {
beforeEach(() => {
dbState.activeConfig.connection!.queryEngine = "openCypher";
});

it("should return ID, Relationship Type, and attributes for edge with unique ID", () => {
const { result } = renderHookWithState(
() => useEdgeAttributesAsScalars(edge),
dbState,
);

const scalars = result.current;
expect(scalars).toHaveLength(4); // ID + Relationship Type + 2 attributes

expect(scalars[0]).toEqual(
createResultScalar({
name: "ID",
value: "edge-1",
}),
);

expect(scalars[1]).toEqual(
createResultScalar({
name: "Relationship Type",
value: "knows",
}),
);

expect(scalars[2]).toEqual(
createResultScalar({
name: "Since",
value: "2020",
}),
);

expect(scalars[3]).toEqual(
createResultScalar({
name: "Weight",
value: "0.8",
}),
);
});

it("should not include ID for edge without unique ID", () => {
const edgeWithoutId = {
...edge,
hasUniqueId: false,
};

const { result } = renderHookWithState(
() => useEdgeAttributesAsScalars(edgeWithoutId),
dbState,
);

const scalars = result.current;
expect(scalars).toHaveLength(3); // Relationship Type + 2 attributes (no ID)

expect(scalars[0]).toEqual(
createResultScalar({
name: "Relationship Type",
value: "knows",
}),
);
});
});

describe("SPARQL", () => {
beforeEach(() => {
dbState.activeConfig.connection!.queryEngine = "sparql";
Expand Down