在我的代码中找到的这个开始来自我的 JSON 文件。现在在我的 JSON 文件中,我有很多同名的“开始”。例如,在这个 JSON 文件中,我在开头有重复项(内容都为“audi”):
{"rel": "AtLocation", "weight": 0.5, "dataset": "/d/dbpedia/en", "sources": ["/s/dbpedia/3.7"], "id": "0209765bf7185615ef242513f61ca0f61efe2a04", "features": ["audi AtLocation -", "audi - curitiba", "- AtLocation curitiba"], "end": "curitiba", "license": "/l/CC/By-SA", "uri": "/a/[AtLocation/,audi/,curitiba/]", "start": "audi", "context": "/ctx/all", "surfaceText": null}
{"rel": "AtLocation", "weight": 0.5, "dataset": "/d/dbpedia/en", "sources": ["/s/dbpedia/3.7"], "id": "5158d1cfce728efb3e42840d166ec06153a3d77d", "features": ["audi AtLocation -", "audi - ingolstadt", "- AtLocation ingolstadt"], "end": "unite_state", "license": "/l/CC/By-SA", "uri": "/a/[AtLocation/,audi/,ingolstadt/]", "start": "audi", "context": "/ctx/all", "surfaceText": null}
这是我的 Java 代码:
String start = (String) jsonObject.get("start");
StartVertex startV = new StartVertex(start);
helloGraphDB.addVertex(startV);
我不希望它添加相同“audi”的 2 次顶点,否则我该如何编写逻辑?
谢谢你。