次のクラスを検討してください。
class Basic{
String id;
Double val;
//some other member variables
}
class NodeBO{
List<String> id;
Type type;
// list of id from objects of Basic class in data below
Map<ChEnum, Basic> data;
addBeans(NodeBO nodeBO, Node node){
// in transaction...
node.setProperty("priperties", nodeBO.toString());
// is it ok to convert to array? or should be converted to JSON string?
node.setProperty(GraphElementProps.id,toArray(nodeBO.id));
node.setProperty(GraphElementProps.type, nodeBO.type);
}
@override
toString(){
//return json of this object
}
}
enum ChEnum{
CH1(1), CH2(2);
// constructor and some methods
}
ノードは、autoIndexer を使用してインデックス付けされます。
AutoIndexer<Node> nodeAutoIndexer = GRAPH_DB.index().getNodeAutoIndexer();
nodeAutoIndexer.startAutoIndexingProperty(GraphElementProps.id);
nodeAutoIndexer.setEnabled(true);
GRAPH_NODE_AUTO_INDEX = nodeAutoIndexer.getAutoIndex();
ここではGraphElementProps.id
(配列に変換して)ノードのプロパティとして格納しています。(文字列の) 配列をプロパティとして取りますか? または、リストを JSON 文字列に変換してから保存する必要がありますか?
で指定されたこの配列に対してクエリを実行できるようにしたいqueryId
。たとえば、node-index をクエリして、指定された?をnode.getProperty(GraphElementProps.id)
含むノードを取得します。queryId
つまり、次のようなものです:
// how to do this?
GRAPH_NODE_AUTO_INDEX.get(/*Nodes whose id contain queryId*/);
または、(どういうわけか)クラスid
のプロパティをBasic
インデックス可能および検索可能にすることは可能ですか? 可能であれば、そのようなプロパティにインデックスを付ける方法は? それらを照会する方法は?
よく分からないけど何か関係あるのSpring-data-neo4j
?私は完全に初めてですSpring-data-neo4j
。