【发布时间】:2023-03-31 19:55:01
【问题描述】:
我还在玩 OrientDB。 现在我正在尝试模式功能,看起来很棒:-)
我有两个数据文件:joinA.txt 和 joinB.txt,我用它来填充数据库,其架构如下(这两个文件的内容在帖子的末尾):
CREATE CLASS Employee EXTENDS V;
CREATE PROPERTY Employee.eid Integer;
CREATE PROPERTY Employee.name String;
CREATE PROPERTY Employee.eage Short;
CREATE INDEX Employee.eid unique_hash_index;
CREATE CLASS ExtendedProfile EXTENDS V;
CREATE CLASS XYZProfile EXTENDS ExtendedProfile;
CREATE PROPERTY XYZProfile.textual String;
-- SameAs can only connect Employees to ExtendedProfile
CREATE CLASS SameAs EXTENDS E; -- same employee across many tables
CREATE PROPERTY SameAs.out LINK ExtendedProfile;
CREATE PROPERTY SameAs.In LINK Employee;
我提供给 ETL 工具的 JSON 是,用于 JoinA:
{
"source": { "file": {"path": "the_path"}},
"extractor": {"csv": {
"separator": " ",
"columns": [
"eid:Integer",
"name:String",
"eage:Short"
]
}
},
"transformers": [
{"vertex": {"class": "Employee", "skipDuplicates": true}}
]
,"loader": {
"orientdb": {
"dbURL": "plocal:thepath",
"dbType": "graph",
"useLightweightEdges": false
}
}
}
对于 JoinB:
{
"source": { "file": {"path": "thepath"}},
"extractor": {"csv": {
"separator": " ",
"columnsOnFirstLine": false,
"quote": "\"",
"columns": [
"id:String",
"textual:String"
]
}
},
"transformers": [
{"vertex": {"class": "XYZProfile", "skipDuplicates": true}},
{ "edge": { "class": "SameAs",
"direction": "out",
"joinFieldName": "id",
"lookup":"Employee.eid",
"unresolvedLinkAction":"ERROR"}},
],
"loader": {
"orientdb": {
"dbURL": "path",
"dbUser": "root",
"dbPassword": "pwd",
"dbType": "graph",
"useLightweightEdges": false}
}
}
现在,问题是当我运行select expand(both()) from Employee 时,我得到out_SameAs 列中的边缘,而当我运行select expand(both()) from XYZProfile 时,我什么也得不到。
这很奇怪,因为第一个查询告诉我边缘指向的@CLASS 是 XYZProfile。
有人知道我的例子有什么问题吗?
干杯,
阿尔伯托
加入A:
1 A 10
2 B 14
3 C 22
加入B:
1 i0
1 i1
2 i2
【问题讨论】:
标签: orientdb