unipop-graph / unipop

Data Integration Graph
Apache License 2.0
203 stars 35 forks source link

How to write conf content in coding #109

Closed baozengkai closed 6 years ago

baozengkai commented 6 years ago

I would like to use tinkerpop connection elasticsearch, I have written a json configuration file, how should I add this configuration file to conf? The code did not talk about how to write conf on json configuration.

seanbarzilay commented 6 years ago

You need to create a configuration like so

BaseConfiguration conf = new BaseConfiguration();
conf.addProperty('providers', '/path/to/mapping/folder');
UniGraph graph = UniGraph.open(conf);
baozengkai commented 6 years ago

@seanbarzilay Thank you for your immediate reply. I wrote the above code on IDEA, as follows: BaseConfiguration conf = new BaseConfiguration(); conf.addProperty("providers","/company/tinkerpop-server/json/"); UniGraph graph=UniGraph.open(conf); GraphTraversalSource g=graph.traversal(); System.out.println(g.V().key()); and I copy the modern.json to my folder.but When I run my application,It show me this: org.json.JSONException: A JSONObject text must begin with '{' at character 1 I checked out the modern.json file .There is no character error.and the modern.json is provided by this project.so I don't how to do next? Look forward for your reply.

seanbarzilay commented 6 years ago

Do you maybe have another file in that folder which is not a JSON file?

baozengkai commented 6 years ago

It works! Because my folder has a hidden file, so when I delete the hidden file, can successfully mapped.thank you for your help!