0

datastaxグラフのdataloaderからcsvファイルを読み込み中です。データスタックスグラフの同じcsvファイルからエッジと頂点を作成

最初のファイル(Year_2015.txt)以下れる私のCSVファイルの構造

YearID

第二のファイル(BaseVehicle_2005.txt)

BaseVehicleID | YearID | MakeID | ModelID

最初のファイルの場合は、年として頂点レベルを作成し、2番目にYearIDとしてキーを作成しました。頂点レベルをBaseVehicleとして作成しましたが、 BaseVehicleIDとしてyを入力し、YearID、MakeID、ModelIDは無視します。今では、エッジレベルの年とプロパティYearIDの2番目(BaseVehicle)と1番目(Year)の間にエッジを作成したいが、何も私のために働いていない。何が変わる必要があるか教えてください。

答えて

0

ドキュメントは例があります:https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/dgl/dglCSV.html以下

は、JSONデータ上で動作サンプルローダースクリプトですが、それが使用する要素を決定するマッパーを使用して、同じレコードから頂点と辺の両方をロードする方法を示しています。


config load_threads: 8 
config batch_size: 1000 
config load_new: true 
config driver_retry_attempts: 10 
config driver_retry_delay: 1000 

/** SAMPLE INPUT 
    {"actor_name":"'Bear'Boyd, Steven","title_name":"The Replacements","year":"2000","role":"Defensive Tackle - Washington Sentinels","episode":"The Replacements"} 
*/ 
input = File.json(filename) 

//Defines the mapping from input record to graph elements 
actorMapper = { 
    key "actor_name"   // the unique id for an actor 
    label "actor" 
    ignore "title_name" 
    ignore "role" 
    ignore "year" 
    ignore "episode" 
} 

titleMapper = { 
    key "title_name"   // the unique id for a title 
    label "title" 
    ignore "sex" 
    ignore "actor_name" 
    ignore "role" 
    ignore "episode" 
} 

castMapper = { 
    label "cast" 
    outV "actor_name", { 
     label "actor" 
     key "actor_name" 
    } 
    inV "title_name", { 
     label "title" 
     key "title_name" 
    } 
    ignore "year" 
    ignore "sex" 
    // remaining should be edge properties 
    // pickup role as property 
    // pickup episode as property 
} 

//Load vertex records from the input according to the mapping 
load(input).asVertices(actorMapper) 
load(input).asVertices(titleMapper) 
load(input).asEdges(castMapper) 
関連する問題