diff --git a/.idea/workspace.xml b/.idea/workspace.xml index dce8f6b..8627d4a 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,12 +2,14 @@ - + + + - + @@ -48,7 +50,7 @@ - + @@ -64,7 +66,7 @@ - + @@ -93,6 +95,7 @@ + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - - + + + + - - + + - + - - + + - - - - + + @@ -334,9 +337,6 @@ @@ -365,6 +368,7 @@ @@ -890,7 +894,7 @@ diff --git a/bakemono/src/main/java/com/ontology2/bakemono/configuration/Beans.java b/bakemono/src/main/java/com/ontology2/bakemono/configuration/Beans.java index ee5a6c5..a403182 100644 --- a/bakemono/src/main/java/com/ontology2/bakemono/configuration/Beans.java +++ b/bakemono/src/main/java/com/ontology2/bakemono/configuration/Beans.java @@ -25,7 +25,9 @@ public Sieve3Configuration sieve3Default() { new Rule("text",matchesText()), new Rule("webpages",matchesWebPage()), new Rule("notability",isAboutNotability()), - new Rule("links",isLinkRelationship()) + new Rule("dotdot",hasDoubleDotPredicate()), + new Rule("links",isLinkRelationship()), + new Rule("literals",Predicates.not(isLinkRelationship())) ); } @@ -45,6 +47,13 @@ private static Predicate predicateStartsWith(final String that) }; } +private static Predicate hasDoubleDotPredicate() { + return new Predicate() { + @Override public boolean apply(PrimitiveTriple input) { + return input.getPredicate().contains(".."); + } + }; +} private static Predicate matchesA() { return matchesPredicate(""); }; diff --git a/bakemono/src/test/java/com/ontology2/bakemono/abstractions/SpringTest.java b/bakemono/src/test/java/com/ontology2/bakemono/abstractions/SpringTest.java index c12503a..9319b30 100644 --- a/bakemono/src/test/java/com/ontology2/bakemono/abstractions/SpringTest.java +++ b/bakemono/src/test/java/com/ontology2/bakemono/abstractions/SpringTest.java @@ -14,7 +14,7 @@ public void canGetSieve3Configuration() { // right now we don't actually use the Hadoop Config, so null is OK ApplicationContext c=Spring.getApplicationContext(null); Sieve3Configuration sieve3Config = c.getBean(Sieve3Configuration.SIEVE3DEFAULT,Sieve3Configuration.class); - assertEquals(sieve3Config.getRules().size(),11); + assertEquals(sieve3Config.getRules().size(),13); } } diff --git a/bakemono/src/test/java/com/ontology2/bakemono/sieve3/DeeperSieve3Test.java b/bakemono/src/test/java/com/ontology2/bakemono/sieve3/DeeperSieve3Test.java index 1479927..ecfb062 100644 --- a/bakemono/src/test/java/com/ontology2/bakemono/sieve3/DeeperSieve3Test.java +++ b/bakemono/src/test/java/com/ontology2/bakemono/sieve3/DeeperSieve3Test.java @@ -61,7 +61,9 @@ public void setup() throws IOException, InterruptedException { sieve3.outputs.put("webpages", mock(KeyValueAcceptor.class)); sieve3.outputs.put("notability",mock(KeyValueAcceptor.class)); sieve3.outputs.put("links", mock(KeyValueAcceptor.class)); - + sieve3.outputs.put("dotdot", mock(KeyValueAcceptor.class)); + sieve3.outputs.put("literals", mock(KeyValueAcceptor.class)); + sieve3.other=mock(KeyValueAcceptor.class); } @@ -307,13 +309,13 @@ public void links() throws IOException, InterruptedException { } @Test - public void other() throws IOException, InterruptedException { + public void literals() throws IOException, InterruptedException { sieve3.map( new LongWritable(88), new Text("\t\t\"this is the time and this is the record of the time\"\t."), context); - untouchedExceptFor("other"); - verify(sieve3.other).write( + untouchedExceptFor("literals"); + verify(sieve3.outputs.get("literals")).write( eq(new PrimitiveTriple( "", "", @@ -323,6 +325,23 @@ public void other() throws IOException, InterruptedException { eq(context)); } + @Test + public void dotdot() throws IOException, InterruptedException { + sieve3.map( + new LongWritable(88), + new Text("\t\t\"this is the time and this is the record of the time\"\t."), + context); + untouchedExceptFor("dotdot"); + verify(sieve3.outputs.get("dotdot")).write( + eq(new PrimitiveTriple( + "", + "", + "\"this is the time and this is the record of the time\"" + )), + eq(new LongWritable(1)), + eq(context)); + } + @Test public void key() throws IOException, InterruptedException { sieve3.map(