World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
A class has two tabs, one for its relations and one for its attributes, and neither carries a count (#449)
WaylandYang9280b5c51541
diff --git a/web/src/i18n/en.ts b/web/src/i18n/en.tsindex d5808d1e..29716d81 100644--- a/web/src/i18n/en.ts+++ b/web/src/i18n/en.ts@@ -1390,10 +1390,11 @@ export const en = {schemaScopeTopHint:"No class has instances yet, so the top two levels are drawn. Pick any other class in the rail to add it.",schemaClosePanel: "Close",- // 面板里的三段:定义(表单)/ 属性(关系 + 字面值字段)/ 实例。- // 用页面自己的词——左栏就叫 Classes / Properties+ // 面板里的四段:定义(表单)/ 关系(边)/ 属性(字面值字段)/ 实例。+ // 关系和属性是两种东西——左栏的 Properties 只列关系,属性挂在类下schemaTabDefinition: "Definition",- schemaTabProperties: "Properties",+ schemaTabRelations: "Relations",+ schemaTabAttributes: "Attributes",schemaTabInstances: "Instances",schemaAddRelationship: "New relationship…",schemaCheckDefects: (n: number) =>@@ -1401,12 +1402,12 @@ export const en = {? "1 new ontology issue from this change": `${n} new ontology issues from this change`,schemaCheckReview: "Review",- schemaRelationships: "Relationships",/** 画布上并成一条的关系边写的字 */schemaBundle: (n: number) => `${n} relations`,schemaOutgoing: "From this class",schemaIncoming: "To this class",schemaNoRelationships: "No relationships yet.",+ schemaNoInstances: "No instances yet.",schemaConnectHint: "Connect using an existing relationship",schemaConnectPlaceholder: "Search relationships…",schemaConnectAs: "As",diff --git a/web/src/i18n/zh.ts b/web/src/i18n/zh.tsindex 10ad8f2d..1f3fb29d 100644--- a/web/src/i18n/zh.ts+++ b/web/src/i18n/zh.ts@@ -1212,17 +1212,18 @@ export const zh: Strings = {schemaScopeTopHint: "还没有类有实例,画的是层级最上面两层。想看别的类,在左栏点它。",schemaClosePanel: "关闭",schemaTabDefinition: "定义",- schemaTabProperties: "属性",+ schemaTabRelations: "关系",+ schemaTabAttributes: "属性",schemaTabInstances: "实例",schemaAddRelationship: "新建关系…",schemaCheckDefects: (n) =>n === 1 ? "这次改动带来 1 个新的本体问题" : `这次改动带来 ${n} 个新的本体问题`,schemaCheckReview: "去审阅",- schemaRelationships: "关系",schemaBundle: (n) => `${n} 条关系`,schemaOutgoing: "从这个类出发",schemaIncoming: "指向这个类",schemaNoRelationships: "还没有关系。",+ schemaNoInstances: "还没有实例。",schemaConnectHint: "用一个已有的关系连接",schemaConnectPlaceholder: "搜索关系…",schemaConnectAs: "作为",diff --git a/web/src/pages/Ontology.tsx b/web/src/pages/Ontology.tsxindex 2effc303..8ad327c9 100644--- a/web/src/pages/Ontology.tsx+++ b/web/src/pages/Ontology.tsx@@ -110,7 +110,7 @@ export function Ontology() {// 模式图详情面板停在哪一段。**跨选中保留**:在实例上挨个类看下去,// 是一种真实的读法,每换一个类就被弹回定义页会打断它const [panelTab, setPanelTab] = useState<- "definition" | "properties" | "instances"+ "definition" | "relations" | "attributes" | "instances">("definition");/** 正在退场的那次选择:面板演完 `u-dock-out` 再卸载,而不是一下子消失 */const [exitingSel, setExitingSel] = useState<Sel>(null);@@ -207,14 +207,7 @@ export function Ontology() {panelSel?.kind === "relation"? (relation_types.find((r) => r.id === panelSel.id) ?? null): null;- // 选中类身上挂着的东西,面板分段的计数和内容都用它- const classRelations = selectedClass- ? relations.filter(- (r) =>- r.domains.includes(selectedClass.id) ||- r.ranges.includes(selectedClass.id),- )- : [];+ // 选中类身上挂着的属性,Attributes 一段用它const classAttributes = selectedClass? relation_types.filter((r) => r.kind === "attribute" && r.domains.includes(selectedClass.id),@@ -486,14 +479,16 @@ export function Ontology() {label: S.ontology.schemaTabDefinition,},{- value: "properties",- label: S.ontology.schemaTabProperties,- count: classRelations.length + classAttributes.length,+ value: "relations",+ label: S.ontology.schemaTabRelations,+ },+ {+ value: "attributes",+ label: S.ontology.schemaTabAttributes,},{value: "instances",label: S.ontology.schemaTabInstances,- count: selectedClass.usage,},]}/>@@ -541,11 +536,7 @@ export function Ontology() {</div>{selectedClass && (<>- <div- className={- classTab === "properties" ? "flex flex-col gap-3" : "hidden"- }- >+ <div className={classTab === "relations" ? "" : "hidden"}><RelationshipsCardkbId={kb.id}cls={selectedClass}@@ -561,6 +552,8 @@ export function Ontology() {})}/>+ </div>+ <div className={classTab === "attributes" ? "" : "hidden"}><AttributesCardkbId={kb.id}type={selectedClass}@@ -724,14 +717,13 @@ function InstancesCard({ kbId, type }: { kbId: string; type: EntityTypeView }) {});const total = q.data?.total ?? 0;const rows = q.data?.entities ?? [];- if (!q.isPending && total === 0) return null; // 没有实例时不占版面+ // 这一段自己就是 Instances 那个 tab:没有实例就说一句,不顶同名的标题+ if (!q.isPending && total === 0)+ return <p className="text-small text-ink-3">{S.ontology.schemaNoInstances}</p>;return (- // 平铺在面板里:面板已经是一块面,里面不再套卡片。标题与行同一个 px-2+ // 平铺在面板里:面板已经是一块面,里面不再套卡片<div>- <GroupLabel className="mb-1" count={total}>- {S.ontology.instances}- </GroupLabel><div>{rows.map((e) => (<Link@@ -866,14 +858,9 @@ function RelationshipsCard({);return (- // 平铺在面板里,与图谱面板的关系分组同一个骨架:带方向箭头的小标题 + 行+ // 平铺在面板里,与图谱面板的关系分组同一个骨架:带方向箭头的小标题 + 行。+ // 这一段自己就是 Relations 那个 tab,不再顶一个同名的标题<div>- <GroupLabel- className="mb-1"- count={outgoing.length + incoming.length || undefined}- >- {S.ontology.schemaRelationships}- </GroupLabel>{outgoing.length === 0 && incoming.length === 0 ? (<p className="mb-2 text-small text-ink-3">{S.ontology.schemaNoRelationships}@@ -992,10 +979,7 @@ export function AttributesCard({useEffect(() => setEditing(null), [type.id]);return (- <div className="border-t border-line pt-3">- <GroupLabel className="mb-1" count={attributes.length || undefined}>- {S.ontology.attributes}- </GroupLabel>+ <div><p className="mb-2 text-fine text-ink-3">{S.ontology.attributesHint}</p>