/** * Utility to do a basic cat operation */ public static void doTestRdfcatOutput( String inFormArg, String inputArg, String outFormArg, String parseAs ) { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); List<String> l = new ArrayList<>(); if (outFormArg != null) { l.add( "-out" ); l.add( outFormArg ); } if (inFormArg != null) l.add( inFormArg ); l.add( inputArg ); String[] args = new String[l.size()]; for (int i = 0; i < l.size(); i++) { args[i] = l.get(i); } // use file extension guessing rc.testGo( args ); Model output = asModel( so, parseAs ); assertTrue( output.isIsomorphicWith( source )); }
/** * Utility to do a basic cat operation */ public static void doTestRdfcatOutput( String inFormArg, String inputArg, String outFormArg, String parseAs ) { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); List<String> l = new ArrayList<>(); if (outFormArg != null) { l.add( "-out" ); l.add( outFormArg ); } if (inFormArg != null) l.add( inFormArg ); l.add( inputArg ); String[] args = new String[l.size()]; for (int i = 0; i < l.size(); i++) { args[i] = l.get(i); } // use file extension guessing rc.testGo( args ); Model output = asModel( so, parseAs ); assertTrue( output.isIsomorphicWith( source )); }
protected void testGo( String[] args ) { go( args ); } }
/** * Test the identity transform - RDF/XML to RDF/XML */ @Test public void testRdfcatIdentity() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"file:testing/cmd/rdfcat.xml"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }
/** * Change the default input language */ @Test public void testRdfcatConcat1() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"-in", "N3", "file:testing/cmd/rdfcat_1_n3", "file:testing/cmd/rdfcat_2_n3"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }
/** * Change the default input language */ @Test public void testRdfcatConcat1() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"-in", "N3", "file:testing/cmd/rdfcat_1_n3", "file:testing/cmd/rdfcat_2_n3"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }
protected void testGo( String[] args ) { go( args ); } }
/** * Test the basic concatenation */ @Test public void testRdfcatConcat() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"file:testing/cmd/rdfcat_1.xml", "file:testing/cmd/rdfcat_2.xml"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }
/** * Test the basic concatenation */ @Test public void testRdfcatConcat() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"file:testing/cmd/rdfcat_1.xml", "file:testing/cmd/rdfcat_2.xml"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }
/** * Test the identity transform - RDF/XML to RDF/XML */ @Test public void testRdfcatIdentity() { Model source = ModelFactory.createDefaultModel(); source.read( "file:testing/cmd/rdfcat.xml", "RDF/XML" ); OutputStream so = new ByteArrayOutputStream(); rdfcatFixture rc = new rdfcatFixture( so ); rc.testGo( new String[] {"file:testing/cmd/rdfcat.xml"} ); Model output = asModel( so, "RDF/XML" ); assertTrue( output.isIsomorphicWith( source )); }