【问题标题】:OrientDB: missing "half edges"OrientDB:缺少“半边”
【发布时间】: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


    【解决方案1】:

    检查您的 JSON 文件,我认为您的 JSON 文件有错误。您忘记将[] 放在 JSON 文件的开头和结尾。

    【讨论】:

      【解决方案2】:

      这实际上是我的错。 CREATE PROPERTY SameAs.In LINK Employee; 是问题所在:In 应该全部小写,正如 here 指出的那样。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-23
        • 1970-01-01
        相关资源
        最近更新 更多