Search in sources :

Example 6 with StatsMatcher

use of org.apache.jena.sparql.engine.optimizer.StatsMatcher in project jena by apache.

the class TestReorder method match_24.

@Test
public void match_24() {
    StatsMatcher matcher = matcher("(:p 11) (TERM 12)");
    Triple t = triple("(?x :q ?v)");
    double d = matcher.match(t);
    assertEquals(12, d, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 7 with StatsMatcher

use of org.apache.jena.sparql.engine.optimizer.StatsMatcher in project jena by apache.

the class TestReorder method match_10.

// Test first match wins. 
@Test
public void match_10() {
    StatsMatcher matcher = matcher("((VAR :p LITERAL) 5) ((VAR :p ANY) 10)");
    Triple t = triple("(?x :p 1913)");
    double d = matcher.match(t);
    assertEquals(5, d, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 8 with StatsMatcher

use of org.apache.jena.sparql.engine.optimizer.StatsMatcher in project jena by apache.

the class TestReorder method match_20.

// Abbreviated forms.
@Test
public void match_20() {
    StatsMatcher matcher = matcher("(:p 10) ");
    Triple t = triple("(?x :p ?v)");
    double d = matcher.match(t);
    assertEquals(10, d, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 9 with StatsMatcher

use of org.apache.jena.sparql.engine.optimizer.StatsMatcher in project jena by apache.

the class TestReorder method match_26.

@Test
public void match_26() {
    StatsMatcher matcher = matcher("(:pp 3) (other 1)");
    Triple t = triple("(:x :p ?v)");
    double d = matcher.match(t);
    assertEquals(1, d, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 10 with StatsMatcher

use of org.apache.jena.sparql.engine.optimizer.StatsMatcher in project jena by apache.

the class TestReorder method match_27.

// Bounds abbreviation rules.
@Test
public void match_27() {
    StatsMatcher matcher = matcher("(:p 200) (TERM 2)");
    Triple t = triple("(?x :q :v)");
    double d = matcher.match(t);
    assertEquals(2, d, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) StatsMatcher(org.apache.jena.sparql.engine.optimizer.StatsMatcher) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Aggregations

StatsMatcher (org.apache.jena.sparql.engine.optimizer.StatsMatcher)21 BaseTest (org.apache.jena.atlas.junit.BaseTest)20 Test (org.junit.Test)20 Triple (org.apache.jena.graph.Triple)19 BasicPattern (org.apache.jena.sparql.core.BasicPattern)1 Item (org.apache.jena.sparql.sse.Item)1