@Test public void shouldLogRelationshipsReferringToMissingNode() throws Exception { List<String> nodeIds = asList( "a", "b", "c" ); Configuration config = Configuration.COMMAS; File nodeData = nodeData( true, config, nodeIds, TRUE ); List<RelationshipDataLine> relationships = Arrays.asList( relationship( "a", "b", "TYPE", "aa" ), relationship( "c", "bogus", "TYPE", "bb" ), relationship( "b", "c", "KNOWS", "cc" ), relationship( "c", "a", "KNOWS", "dd" ), relationship( "missing", "a", "KNOWS", "ee" ) ); File relationshipData1 = relationshipData( true, config, relationships.iterator(), lines( 0, 2 )); File relationshipData2 = relationshipData( false, config, relationships.iterator(), lines( 2, 5 )); File bad = badFile(); importTool( "--into", graphDbDir().getAbsolutePath(), "--nodes:" + node_label, nodeData.getAbsolutePath(), "--bad", bad.getAbsolutePath(), "--bad-tolerance", "2", "--edges:" + relationship_label, relationshipData1.getAbsolutePath() + MULTI_FILE_DELIMITER + relationshipData2.getAbsolutePath() ); String badContents = FileUtils.readTextFile( bad, Charset.defaultCharset() ); assertTrue( "Didn't contain first bad relationship", badContents.contains( "bogus" ) ); assertTrue( "Didn't contain second bad relationship", badContents.contains( "missing" ) ); }
public static Iterable<DataFactory> nodeData(final Charset encoding, Collection<Args.Option<File[]>> nodesFiles ) { return new IterableWrapper<DataFactory,Args.Option<File[]>>( nodesFiles ) { @Override protected DataFactory underlyingObjectToObject( Args.Option<File[]> input ) { Decorator decorator = input.metadata() != null ? InputEntityDecorators.additiveLabels( input.metadata().split( ":" ) ) : InputEntityDecorators.NO_DECORATOR; return data( decorator, encoding, input.value() ); } }; }
BulkLoad { public static Iterable<DataFactory> nodeData(final Charset encoding, Collection<Args.Option<File[]>> nodesFiles ) { return new IterableWrapper<DataFactory,Args.Option<File[]>>( nodesFiles ) { @Override protected DataFactory underlyingObjectToObject( Args.Option<File[]> input ) { Decorator decorator = input.metadata() != null ? InputEntityDecorators.additiveLabels( input.metadata().split( ":" ) ) : InputEntityDecorators.NO_DECORATOR; return data( decorator, encoding, input.value() ); } }; } }
BulkLoad { public static Iterable<DataFactory> nodeData(final Charset encoding, Collection<Args.Option<File[]>> nodesFiles ) { return new IterableWrapper<DataFactory,Args.Option<File[]>>( nodesFiles ) { @Override protected DataFactory underlyingObjectToObject( Args.Option<File[]> input ) { Decorator decorator = input.metadata() != null ? InputEntityDecorators.additiveLabels( input.metadata().split( ":" ) ) : InputEntityDecorators.NO_DECORATOR; return data( decorator, encoding, input.value() ); } }; }  }
BulkLoad { public static Iterable<DataFactory> nodeData(final Charset encoding, Collection<Args.Option<File[]>> nodesFiles ) { return new IterableWrapper<DataFactory,Args.Option<File[]>>( nodesFiles ) { @Override protected DataFactory underlyingObjectToObject( Args.Option<File[]> input ) { Decorator decorator = input.metadata() != null ? InputEntityDecorators.additiveLabels( input.metadata().split( ":" ) ) : InputEntityDecorators.NO_DECORATOR; return data( decorator, encoding, input.value() ); } }; }  static Function<String,T> withDefault( final T defaultValue ); static void main(String[] args0); static void doImport(StandardJanusGraph graph,PrintStream out, PrintStream err, InputStream in, File storeDir, File logsDir, File badFile,
                                FileSystem fs, Collection<Args.Option<File[]>> nodesFiles,
                                Collection<Args.Option<File[]>> edgesFiles, boolean enableStacktrace, Input input,
                                OutputStream badOutput,
                                Configuration configuration ); static Collection<Args.Option<File[]>> extractInputFiles(Args args, String key, PrintStream err ); static Collection<Args.Option<String>> extractJanusConfig(Args args, String key, PrintStream err ); static Iterable<DataFactory> nodeData(final Charset encoding,
                                                 Collection<Args.Option<File[]>> nodesFiles ); static Iterable<DataFactory> edgeData(final Charset encoding,
                                                 Collection<Args.Option<File[]>> edgesFiles ); static DataFactory data( final Decorator decorator,
                                    final Charset charset, final File... files ); static janusgraph.util.batchimport.unsafe.input.csv.Configuration csvConfiguration(
            Args args, final boolean defaultSettingsSuitableForTests ); static long parseLongWithUnit( String numberWithPotentialUnit ); static Args useArgumentsFromFileArgumentIfPresent( Args args ); static String[] parseFileArgumentList( File file ); static void validateInputFiles( Collection<Args.Option<File[]>> nodesFiles,
                                           Collection<Args.Option<File[]>> edgesFiles ); static Configuration importConfiguration(boolean bulkLoading,
            Number processors, Long maxMemory, File storeDir,
            boolean allowCacheOnHeap, Boolean defaultHighIO ); }
BulkLoad { public static Iterable<DataFactory> nodeData(final Charset encoding, Collection<Args.Option<File[]>> nodesFiles ) { return new IterableWrapper<DataFactory,Args.Option<File[]>>( nodesFiles ) { @Override protected DataFactory underlyingObjectToObject( Args.Option<File[]> input ) { Decorator decorator = input.metadata() != null ? InputEntityDecorators.additiveLabels( input.metadata().split( ":" ) ) : InputEntityDecorators.NO_DECORATOR; return data( decorator, encoding, input.value() ); } }; }  static Function<String,T> withDefault( final T defaultValue ); static void main(String[] args0); static void doImport(StandardJanusGraph graph,PrintStream out, PrintStream err, InputStream in, File storeDir, File logsDir, File badFile,
                                FileSystem fs, Collection<Args.Option<File[]>> nodesFiles,
                                Collection<Args.Option<File[]>> edgesFiles, boolean enableStacktrace, Input input,
                                OutputStream badOutput,
                                Configuration configuration ); static Collection<Args.Option<File[]>> extractInputFiles(Args args, String key, PrintStream err ); static Collection<Args.Option<String>> extractJanusConfig(Args args, String key, PrintStream err ); static Iterable<DataFactory> nodeData(final Charset encoding,
                                                 Collection<Args.Option<File[]>> nodesFiles ); static Iterable<DataFactory> edgeData(final Charset encoding,
                                                 Collection<Args.Option<File[]>> edgesFiles ); static DataFactory data( final Decorator decorator,
                                    final Charset charset, final File... files ); static janusgraph.util.batchimport.unsafe.input.csv.Configuration csvConfiguration(
            Args args, final boolean defaultSettingsSuitableForTests ); static long parseLongWithUnit( String numberWithPotentialUnit ); static Args useArgumentsFromFileArgumentIfPresent( Args args ); static String[] parseFileArgumentList( File file ); static void validateInputFiles( Collection<Args.Option<File[]>> nodesFiles,
                                           Collection<Args.Option<File[]>> edgesFiles ); static Configuration importConfiguration(boolean bulkLoading,
            Number processors, Long maxMemory, File storeDir,
            boolean allowCacheOnHeap, Boolean defaultHighIO );  }