OrientDB:缺少 "half edges"
OrientDB: missing "half edges"
我还在玩 OrientDB。
现在我正在尝试模式功能,看起来很棒:-)
我有两个数据文件:joinA.txt 和 joinB.txt,我用它们来填充具有以下模式的数据库(这两个文件的内容在 post):
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
检查你的 JSON 文件,我认为你的 JSON 文件有错误。您忘记将 []
放在 JSON 文件的开头和结尾。
其实是我的错。
CREATE PROPERTY SameAs.In LINK Employee;
行是问题所在:In
应该全部小写,正如 .
所指出的
我还在玩 OrientDB。 现在我正在尝试模式功能,看起来很棒:-)
我有两个数据文件:joinA.txt 和 joinB.txt,我用它们来填充具有以下模式的数据库(这两个文件的内容在 post):
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
检查你的 JSON 文件,我认为你的 JSON 文件有错误。您忘记将 []
放在 JSON 文件的开头和结尾。
其实是我的错。
CREATE PROPERTY SameAs.In LINK Employee;
行是问题所在:In
应该全部小写,正如