TinkerPop框架 - 将Map <string,string>存储到顶点属性</string,string>中

时间:2014-07-15 15:36:03

标签: map tinkerpop tinkerpop-frames

我想将裸映射保存到顶点属性。 动机是我事先不知道地图将包含哪些属性。 并且每个属性存储一个顶点似乎没有效果。 我该怎么做?

interface Foo {
    @Properties...?
    Map<String,String> getProperties();

    @Properties
    Map<String,String> addProperty();
}

也许通过方法处理程序。怎么样? 是否有本地支持?

1 个答案:

答案 0 :(得分:1)

我已经使用处理程序添加了对它的支持。 查看Windup项目。 https://github.com/windup/windup/pull/157

这就是它在模特中的表现。

这个地图使用前缀map:

将地图存储在给定框架顶点的道具中
@TypeValue("MapInAdjPropsModelMain")
public interface MapMainModel extends WindupVertexFrame
{
    @InProperties(propPrefix = "map") void setMap(Map<String, String> map);

    @InProperties(propPrefix = "map") Map<String, String> getMap();
}

这个将地图存储在相邻的顶点,因此可以存储多个地图:

@TypeValue("MapInAdjPropsModelMain")
public interface MapMainModel extends WindupVertexFrame
{
    @InAdjacentProperties(edgeLabel = "map")
    void setMap(Map<String, String> map);

    @InAdjacentProperties(edgeLabel = "map")
    Map<String, String> getMap();

    @InAdjacentProperties(edgeLabel = "map2")
    void setMap2(Map<String, String> map);

    @InAdjacentProperties(edgeLabel = "map2")
    Map<String, String> getMap2();
}
相关问题