Skip to content

Commit

Permalink
Change keywords according to the released version of Kùzu (#74)
Browse files Browse the repository at this point in the history
* Change keywords according to the released version of Kùzu

* Run linters

---------

Co-authored-by: Lint Bot <[email protected]>
  • Loading branch information
mewim and mewim authored Feb 8, 2024
1 parent 06adbc7 commit 1f178d5
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 42 deletions.
53 changes: 39 additions & 14 deletions src/components/DatasetView/DatasetMainView.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<div v-if="schema" ref="wrapper" class="dataset-view__wrapper">
<div
v-if="schema"
ref="wrapper"
class="dataset-view__wrapper"
>
<div
v-if="!isSchemaEmpty && isProduction && !datasetLoadingLog && modeStore.isReadWrite"
class="alert alert-warning"
Expand Down Expand Up @@ -31,48 +35,69 @@
database. However, please make sure there is no conflict with the existing schema.
</div>

<div v-if="modeStore.isReadOnly" class="alert alert-warning" role="alert">
<div
v-if="modeStore.isReadOnly"
class="alert alert-warning"
role="alert"
>
<i class="fa-solid fa-info-circle" />
KùzuExplorer is running in read-only mode. You can still review the schema of the
bundled datasets. If you want to load a dataset, please restart your KùzuExplorer
Docker image in read-write mode with an empty database.
</div>

<div v-if="modeStore.isDemo" class="alert alert-warning" role="alert">
<div
v-if="modeStore.isDemo"
class="alert alert-warning"
role="alert"
>
<i class="fa-solid fa-info-circle" />
KùzuExplorer is running in demo mode. You can still review the schema of the bundled
datasets. Loading a dataset is not possible in this demo. However, you can load a
bundled dataset or use your own dataset if you run KùzuExplorer locally. Please
refer to
<a target="_blank" href="https://kuzudb.com/docusaurus/kuzuexplorer/">
the documentation </a
>for more information.
<a
target="_blank"
href="https://kuzudb.com/docusaurus/kuzuexplorer/"
>
the documentation </a>for more information.
</div>
<div v-if="!datasetLoadingLog" class="form-group">
<div
v-if="!datasetLoadingLog"
class="form-group"
>
<label for="dataset-select">
<h6>Select a dataset from the list below to review its schema.</h6>
</label>
<select id="dataset-select" v-model="selectedDataset" class="form-select">
<option v-for="dataset in allDatasets" :key="dataset" :value="dataset">
<select
id="dataset-select"
v-model="selectedDataset"
class="form-select"
>
<option
v-for="dataset in allDatasets"
:key="dataset"
:value="dataset"
>
{{ dataset }}
</option>
</select>
</div>
<br />
<br>
<code v-if="selectedDatasetSchema || datasetLoadingLog">
<pre v-text="datasetLoadingLog ? datasetLoadingLog : selectedDatasetSchema" />
</code>
<br />
<br>
<div>
<button
v-if="!datasetLoadingEnded"
class="btn btn-lg btn-primary"
title="Load Dataset"
:disabled="
(!isSchemaEmpty && isProduction) ||
!selectedDatasetSchema ||
datasetLoadingLog ||
!modeStore.isReadWrite
!selectedDatasetSchema ||
datasetLoadingLog ||
!modeStore.isReadWrite
"
@click="copyDataset"
>
Expand Down
1 change: 1 addition & 0 deletions src/components/SchemaView/SchemaViewMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export default {
nodeStrength: 100,
nodeSize: 100,
nodeSpacing,
comboSpacing: 10,
comboCollideStrength: 0.2,
};
return config;
Expand Down
11 changes: 4 additions & 7 deletions src/server/utils/Constants.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
const MODES = {
DEMO: "DEMO",
READ_WRITE: "READ_WRITE",
READ_ONLY: "READ_ONLY",
DEMO: "DEMO",
READ_WRITE: "READ_WRITE",
READ_ONLY: "READ_ONLY",
};

const IRI_PROPERTY_NAME = "iri";

module.exports = {
MODES,
IRI_PROPERTY_NAME,
MODES,
};
20 changes: 1 addition & 19 deletions src/server/utils/Database.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ const TABLE_TYPES = {
NODE: "NODE",
REL: "REL",
REL_GROUP: "REL_GROUP",
RDF: "RDF",
RDF: "RDFGraph",
};
const RDF_NODE_TABLE_SUFFIXES = ["_l", "_r"];
const RDF_REL_TABLE_SUFFIXES = ["_lt", "_rt"];
const CONSTANTS = require("./Constants");
const MODES = CONSTANTS.MODES;
const IRI_PROPERTY_NAME = CONSTANTS.IRI_PROPERTY_NAME;
const READ_WRITE_MODE = MODES.READ_WRITE;

let kuzu;
Expand Down Expand Up @@ -192,23 +191,6 @@ class Database {
return name;
});
});
relTables.forEach((relTable) => {
// iri is a virtual property of RDF relationships. It will is not stored
// in the schema but will be added when returning a RDF relationship
// from the database. We treat it as a property of RDF relationships
// for the UI app to be able to display it.
if (rdfRelTables.has(relTable.name)) {
const isIriPropertyExist = relTable.properties.some((property) => {
return property.name === IRI_PROPERTY_NAME;
});
if (!isIriPropertyExist) {
relTable.properties.push({
name: IRI_PROPERTY_NAME,
type: "STRING",
});
}
}
});
nodeTables.sort((a, b) => a.name.localeCompare(b.name));
relTables.sort((a, b) => a.name.localeCompare(b.name));
relGroups.sort((a, b) => a.name.localeCompare(b.name));
Expand Down
5 changes: 3 additions & 2 deletions src/store/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
PLACEHOLDER_REL_TABLE,
GPT_MODELS,
IRI_PROPERTY_NAME,
IRI_VIRTUAL_PROPERTY_NAME,
} from "../utils/Constants";

const COLOR_PALETTE = [
Expand Down Expand Up @@ -186,10 +187,10 @@ export const useSettingsStore = defineStore("settings", {
const relSettings = this.initDefaultRel(rel);
if (rel.rdf) {
const isIriPropertyExist = rel.properties.some(
(property) => property.name === IRI_PROPERTY_NAME
(property) => property.name === IRI_VIRTUAL_PROPERTY_NAME
);
if (isIriPropertyExist) {
relSettings.label = IRI_PROPERTY_NAME;
relSettings.label = IRI_VIRTUAL_PROPERTY_NAME;
}
}
this.graphViz.rels[rel.name] = relSettings;
Expand Down
1 change: 1 addition & 0 deletions src/utils/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ export const PLACEHOLDER_NODE_TABLE = "__placeholder_node_table__";
export const PLACEHOLDER_REL_TABLE = "__placeholder_rel_table__";

export const IRI_PROPERTY_NAME = "iri";
export const IRI_VIRTUAL_PROPERTY_NAME = "iri (Virtual)";

0 comments on commit 1f178d5

Please sign in to comment.