Advertisement
Guest User

Untitled

a guest
Aug 10th, 2020
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.88 KB | None | 0 0
  1. Streams.concat(ss.node_props, ss.edge_props)                                            
  2.     .map(p -> new Pair<>(p.name, p.type))                                                
  3.     .distinct()                                                                          
  4.     .collect(groupingBy(Pair::getValue0))                                                
  5.     .forEach((name, props) -> {          
  6.         // If prop. appears with only one type, set the type otherwise use Object
  7.         // (like autoschema does for everything).                                                
  8.         Class type = Object.class;                                                      
  9.         if (props.size() == 1) {                                                        
  10.             try {                                                                        
  11.                 type = Class.forName(props.get(0).getValue1());                          
  12.             } catch (ClassNotFoundException e) {                                          
  13.                 e.printStackTrace();          
  14.                 log.fatal("Class look up failed %s -> %s", name, props.get(0).getValue1())                                          
  15.             }                                                                            
  16.         }                                                                                
  17.        
  18.         // NOTE: it fails on this line                                                                                
  19.         m.makePropertyKey(name).dataType(type).cardinality(Cardinality.SINGLE).make();    
  20.     });                                                                                  
  21.                                                                                          
  22. m.commit();                                                                              
  23. gts.tx().commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement