简体   繁体   中英

OrientDB: missing “half edges”

I'm still playing with OrientDB. Now I'm trying the schema functionalities, that look awesome :-)

I have two data files: joinA.txt and joinB.txt, which I used to populate a database with the following schema (the content of the two files is at the end of the 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;

The JSONs I gave to the ETL tool are, for 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
        }
    }
}

and for 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}
    }
}

Now, the problem is that when I run select expand(both()) from Employee I get the edges in the column out_SameAs , while when I run select expand(both()) from XYZProfile I get nothing. This is weird since the first query told me that the @CLASS pointed by the edges is XYZProfile. Does anybody know what's wrong with my example?

Cheers,

Alberto


JoinA:

1   A   10
2   B   14
3   C   22

JoinB:

1   i0
1   i1
2   i2

Check out your JSON file, I think there is an error on your JSON file. You forget to put [] at the beginning and ending of the JSON file.

It was actually my fault. The line CREATE PROPERTY SameAs.In LINK Employee; was the problem: In should have been all lowercased, as pointed out here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM