public void assertNormalisesTo(final Tokenizer t, final String input, final String[] expectedImages, final String[] expectedTypes) throws Exception { this.assertNormalisesTo(t, input, expectedImages, expectedTypes, null); }
@Test public void testOpenCycURIWithMaxLength() throws Exception { MAX_LENGTH = 20; this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4ri_sbFDVGEdaAAACgydogAg>", new String[] { "Mx4ri_sbFDVGEdaAAACgydogAg", "http://sw.opencyc.org/concept/Mx4ri_sbFDVGEdaAAACgydogAg" }); this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4rpZ2oIm5SEdqAAAACs71DGQ>", new String[] { "Mx4rpZ2oIm5SEdqAAAACs71DGQ", "http://sw.opencyc.org/concept/Mx4rpZ2oIm5SEdqAAAACs71DGQ" }); this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4r7FpweNCOQdiMucbWDv61HQ>", new String[] { "Mx4r7FpweNCOQdiMucbWDv61HQ", "http://sw.opencyc.org/concept/Mx4r7FpweNCOQdiMucbWDv61HQ" }); }
@Test public void testOpenCycURI() throws Exception { this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4ri_sbFDVGEdaAAACgydogAg>", new String[] { "Mx4ri", "Eda", "Cgydog", "Mx4ri_sbFDVGEdaAAACgydogAg", "http://sw.opencyc.org/concept/Mx4ri_sbFDVGEdaAAACgydogAg" }, new String[] { "<URI>", "<URI>", "<URI>", "<URI>", "<URI>" }); this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4rpZ2oIm5SEdqAAAACs71DGQ>", new String[] { "Mx4rp", "Z2o", "Im5", "Edq", "Cs71", "Mx4rpZ2oIm5SEdqAAAACs71DGQ", "http://sw.opencyc.org/concept/Mx4rpZ2oIm5SEdqAAAACs71DGQ" }, new String[] { "<URI>", "<URI>", "<URI>", "<URI>", "<URI>", "<URI>", "<URI>" }); this.assertNormalisesTo(_t, "<http://sw.opencyc.org/concept/Mx4r7FpweNCOQdiMucbWDv61HQ>", new String[] { "Mx4r7", "Fpwe", "Qdi", "Mucb", "Dv61", "Mx4r7FpweNCOQdiMucbWDv61HQ", "http://sw.opencyc.org/concept/Mx4r7FpweNCOQdiMucbWDv61HQ" }, new String[] { "<URI>", "<URI>", "<URI>", "<URI>", "<URI>", "<URI>", "<URI>" }); }
@Test public void testPosInc() throws Exception { this.assertNormalisesTo(_t, "<http://example.org/schema/age>", new String[] { "age", "http://example.org/schema/age" }, new String[] { "<URI>", "<URI>" }, new int[] { 1,0 }); this.assertNormalisesTo(_t, "<http://example.org/schema/me>", new String[] { "http://example.org/schema/me" }, new String[] { "<URI>" }, new int[] { 1 }); this.assertNormalisesTo(_t, "<http://rdf.data-vocabulary.org/#startDate>", new String[] { "start", "Date", "startDate", "http://rdf.data-vocabulary.org/#startDate" }, new String[] { "<URI>", "<URI>", "<URI>", "<URI>" }, new int[] { 1, 1, 0, 0 }); }
@Test public void testURI() throws Exception { this.assertNormalisesTo(_t, "<http://renaud.delbru.fr/>", new String[] { "http://renaud.delbru.fr/" }, new String[] { "<URI>" }); this.assertNormalisesTo(_t, "<http://renaud.delbru.fr/rdf/foaf#renaud>", new String[] { "renaud", "http://renaud.delbru.fr/rdf/foaf#renaud" }, new String[] { "<URI>", "<URI>" }); this.assertNormalisesTo(_t, "<http://renaud.delbru.fr/rdf/foaf#me>", new String[] { "http://renaud.delbru.fr/rdf/foaf#me" }, new String[] { "<URI>" }); this.assertNormalisesTo(_t, "<http://renaud.delbru.fr/rdf/uppercaseShouldBeTokenised>", new String[] { "uppercase", "Should", "Tokenised", "uppercaseShouldBeTokenised", "http://renaud.delbru.fr/rdf/uppercaseShouldBeTokenised" }); this.assertNormalisesTo(_t, "<http://renaud.delbru.fr/rdf/AVeryLongLocalnameWithMoreThan64CharactersThatShouldNotBeTokenised>", new String[] { "AVeryLongLocalnameWithMoreThan64CharactersThatShouldNotBeTokenised", "http://renaud.delbru.fr/rdf/AVeryLongLocalnameWithMoreThan64CharactersThatShouldNotBeTokenised" }); "<http://purl.org/dc/terms/subject> " + "<http://dbpedia.org/resource/Category:Decca_Records_artists>"; this.assertNormalisesTo(_t, triple, new String[] { "The", "Kingston", "Trio", "The_Kingston_Trio", "http://dbpedia.org/resource/The_Kingston_Trio", "subject", "http://purl.org/dc/terms/subject",