Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Update element style and release v0.1.13 #645

Merged
merged 5 commits into from
Dec 19, 2024
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
12 changes: 12 additions & 0 deletions examples/graphy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @graphscope/graphy-website

## 0.1.7

### Patch Changes

- update website
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/graphy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/graphy-website",
"version": "0.1.6",
"version": "0.1.7",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/studio-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphscope/studio-components

## 0.1.13

### Patch Changes

- update website

## 0.1.12

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-components",
"version": "0.1.12",
"version": "0.1.13",
"description": "A components for graphscope studio",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/studio-draw-pattern/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @graphscope/studio-draw-pattern

## 0.0.9

### Patch Changes

- update website
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.0.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-draw-pattern/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-draw-pattern",
"version": "0.0.8",
"version": "0.0.9",
"description": "Experiment draw pattern code for GrapeScope",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
Expand Down
6 changes: 6 additions & 0 deletions packages/studio-driver/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @graphscope/studio-driver

## 0.1.11

### Patch Changes

- update website

## 0.1.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-driver/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-driver",
"version": "0.1.10",
"version": "0.1.11",
"description": "A library provides a unified interface for interacting with graph databases",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
10 changes: 8 additions & 2 deletions packages/studio-driver/src/kuzu-wasm-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class KuzuDriver {

async installUDF(): Promise<void> {
var res = await this.conn?.execute('CREATE MACRO elementid(x) AS CAST(ID(x),"STRING")');

console.log(res.toString());
}

Expand Down Expand Up @@ -351,6 +352,12 @@ export class KuzuDriver {
}

async query(queryScript: string): Promise<any> {
if (queryScript === 'CALL kuzu.meta.schema') {
return await this.querySchema();
}
if (queryScript === 'CALL kuzu.meta.statistics') {
return await this.getCount();
}
console.time('Query cost');
const queryResult = await this.conn?.execute(queryScript);
console.timeEnd('Query cost');
Expand Down Expand Up @@ -483,7 +490,6 @@ export class KuzuDriver {
const edge_count = parseInt(edge_res.toString().split('\n')[1], 10);
const countArray = [vertex_count, edge_count];

console.log(countArray);
return countArray;
}

Expand Down Expand Up @@ -511,7 +517,7 @@ export class KuzuDriver {
console.log(`Open dataset ${this.curDataset}`);

//@ts-ignore
this.db = await this.kuzuEngine.Database(this.curDataset, 0, 10, false, false, 4194304 * 16 * 4);
this.db = await this.kuzuEngine.Database(this.curDataset, 0, 10, false, false, 4194304 * 16 * 4 * 4);
//@ts-ignore
this.conn = await this.kuzuEngine.Connection(this.db);

Expand Down
12 changes: 12 additions & 0 deletions packages/studio-explore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @graphscope/studio-explore

## 0.1.11

### Patch Changes

- update website
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-explore/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-explore",
"version": "0.1.10",
"version": "0.1.11",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Utils } from '@graphscope/studio-components';
import { getDriver as getKuzuDriver, KuzuDriver } from '@graphscope/studio-driver';
import React from 'react';
import { Typography, Tag, Flex } from 'antd';
import { ExclamationCircleOutlined, CheckCircleOutlined } from '@ant-design/icons';
const { storage } = Utils;

const getDriver = async () => {
Expand Down Expand Up @@ -55,7 +58,26 @@ export const createKuzuGraph = async (dataset_id: string) => {
.join(';\n');
return {
success: false,
message: `Some nodes or edges failed to load, please check the data format: ${message}`,
message: (
<Flex vertical gap={16}>
<Typography.Title level={3} style={{ margin: '0px' }}>
Load Failed
</Typography.Title>

{[...logs.nodes, ...logs.edges].map(item => {
const type = item.message === 'false' ? 'error' : 'success';
const icon = item.message === 'false' ? <ExclamationCircleOutlined /> : <CheckCircleOutlined />;
return (
<Typography.Text type="secondary" key={item.name} italic>
<Tag color={type} icon={icon}>
{item.name}
</Tag>
{item.message}
</Typography.Text>
);
})}
</Flex>
),
};
}
return await driver.writeBack();
Expand Down
23 changes: 17 additions & 6 deletions packages/studio-explore/src/services/cypher/queryStatistics.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import { queryStatement } from './queryStatement';
import { getQueryEngineType } from '../utils';
export const queryStatistics = async () => {
try {
// const script = `call gs.procedure.meta.statistics()`;
// const result = await queryStatement(script);
// debugger;
// console.log('result', result, result.raw.records[0]._fields[0]);
// return JSON.parse(result.raw.records[0]._fields[0]);
const engine = getQueryEngineType();

if (engine === 'kuzu_wasm') {
const [total_vertex_count, total_edge_count] = await queryStatement('CALL kuzu.meta.statistics');
return {
total_vertex_count,
total_edge_count,
};
}
if (engine === 'graphscope') {
// const script = `call gs.procedure.meta.statistics()`;
// const result = await queryStatement(script);
// debugger;
// console.log('result', result, result.raw.records[0]._fields[0]);
// return JSON.parse(result.raw.records[0]._fields[0]);
}

// 临时方案
const countNodes = await queryStatement('MATCH (n) RETURN count(n)');
const countEdges = await queryStatement('MATCH (a)-[r]-(b) RETURN count(r)');

return {
total_vertex_count: countNodes.raw.records[0]._fields[0].toNumber(),
total_edge_count: countEdges.raw.records[0]._fields[0].toNumber(),
Expand Down
8 changes: 8 additions & 0 deletions packages/studio-graph-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @graphscope/studtio-graph-editor

## 0.1.7

### Patch Changes

- update website
- Updated dependencies
- @graphscope/[email protected]

## 0.1.6

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-graph-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-graph-editor",
"version": "0.1.6",
"version": "0.1.7",
"description": "",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
9 changes: 9 additions & 0 deletions packages/studio-graph/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @graphscope/studio-graph

## 0.1.13

### Patch Changes

- update website
- Updated dependencies
- @graphscope/[email protected]
- @graphscope/[email protected]

## 0.1.12

### Patch Changes
Expand Down
1 change: 1 addition & 0 deletions packages/studio-graph/docs/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const data = {
id: 'e1',
properties: {
weight: 0.8,
desc: 'weight_0.8',
},
},
],
Expand Down
51 changes: 44 additions & 7 deletions packages/studio-graph/docs/style.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,16 @@ registerIcons(iconfontId);

```jsx
import React, { useEffect } from 'react';
import { Canvas, GraphProvider, Prepare, useContext, registerIcons, ZoomStatus } from '@graphscope/studio-graph';
import {
Canvas,
GraphProvider,
Prepare,
useContext,
registerIcons,
ZoomStatus,
BasicInteraction,
ClearStatus,
} from '@graphscope/studio-graph';
import { data, schema } from './const';
registerIcons();
const CustomGraphFetch = () => {
Expand All @@ -185,11 +194,36 @@ const CustomGraphFetch = () => {
caption: ['name'],
icon: 'logo',
options: {
textPosition: 'top',
textColor: '#000',
iconColor: '#fff',
iconSize: '8px',
zoomLevel: [3, 5],
/** keyshape */
selectColor: 'red',
/** icon */
iconColor: '#fff', // color of keyshape
iconSize: undefined, // half size of keyshape
/** label text */
textSize: 12,
textColor: '#000', // color of keyshape
textPosition: 'bottom',
textBackgroundColor: 'rgba(255,255,255,0.8)',
/** strategy */
zoomLevel: [3, 15],
},
},
};
draft.edgeStyle = {
e1: {
size: 2,
color: 'blue',
caption: ['desc'],
options: {
/** keyshape */
selectColor: 'red',
/** arrow */
arrowLength: undefined, // 默认是边宽的三倍
arrowPosition: 1, //箭头的位置
/** label */
textColor: '#fff', // 默认是边颜色
textSize: 3, // 默认是边宽的三倍
textBackgroundColor: 'blue',
},
},
};
Expand All @@ -204,6 +238,8 @@ export default () => {
<CustomGraphFetch />
<Canvas />
<ZoomStatus />
<BasicInteraction />
<ClearStatus />
</GraphProvider>
</div>
);
Expand Down Expand Up @@ -231,11 +267,12 @@ const CustomGraphFetch = () => {
draft.source = data;
draft.edgeStyle = {
e1: {
size: 2,
size: 1,
color: 'red',
caption: ['weight'],
options: {
arrowLength: 0,
// textSize: 1,
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-graph/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@graphscope/studio-graph",
"version": "0.1.12",
"version": "0.1.13",
"description": "A React toolkit for graph analysis based on g6",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
Loading
Loading