Package org.apache.clerezza.rdf.core

Examples of org.apache.clerezza.rdf.core.TripleCollection


    Assert.assertEquals(0, mapping.size());
  }

  @Test
  public void test4() {
    TripleCollection tc1 = new SimpleMGraph();
    tc1.add(new TripleImpl(u1, u1, new BNode()));
    TripleCollection tc2 = new SimpleMGraph();
    tc2.add(new TripleImpl(u1, u1, new BNode()));
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    Assert.assertEquals(1, mapping.size());
  }
View Full Code Here


    Assert.assertEquals(1, mapping.size());
  }

  @Test
  public void test5() {
    TripleCollection tc1 = new SimpleMGraph();
    tc1.add(new TripleImpl(new BNode(), u1, new BNode()));
    TripleCollection tc2 = new SimpleMGraph();
    tc2.add(new TripleImpl(new BNode(), u1, new BNode()));
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    Assert.assertEquals(2, mapping.size());
  }
View Full Code Here

    Assert.assertEquals(2, mapping.size());
  }

  @Test
  public void test6() {
    TripleCollection tc1 = new SimpleMGraph();
    final BNode b11 = new BNode();
    tc1.add(new TripleImpl(new BNode(), u1,b11));
    tc1.add(new TripleImpl(new BNode(), u1,b11));
    TripleCollection tc2 = new SimpleMGraph();
    tc2.add(new TripleImpl(new BNode(), u1, new BNode()));
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNull(mapping);
  }
View Full Code Here

    return result;
  }

  @Test
  public void test7() {
    TripleCollection tc1 = generateCircle(2);
    TripleCollection tc2 = generateCircle(2);
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    Assert.assertEquals(2, mapping.size());
  }
View Full Code Here

  @Test
  public void siblingAddition() {
    MGraph base = new SimpleMGraph();
    Enricher siblingEnricher = new SiblingEnricher();
    TripleCollection enrichmentTriples = new EnrichmentTriples(base,
        Collections.singleton(siblingEnricher));
    NonLiteral grandMother = new UriRef("http://example.org/grand");
    NonLiteral mother = new UriRef("http://example.org/mother");
    NonLiteral me = new UriRef("http://example.org/me");
    NonLiteral sister = new UriRef("http://example.org/sister");
    NonLiteral uncle = new UriRef("http://example.org/uncle");
    NonLiteral cousin = new UriRef("http://example.org/cousin");
    base.add(new TripleImpl(me, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(sister, SiblingEnricher.parentProperty, mother));
    base.add(new TripleImpl(mother, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(uncle, SiblingEnricher.parentProperty, grandMother));
    base.add(new TripleImpl(cousin, SiblingEnricher.parentProperty, uncle));
    Assert.assertTrue(enrichmentTriples.filter(sister, SiblingEnricher.siblingProperty, me).hasNext());
    Assert.assertTrue(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, mother).hasNext());
    Assert.assertFalse(enrichmentTriples.filter(uncle, SiblingEnricher.siblingProperty, sister).hasNext());
  }
View Full Code Here

    Assert.assertEquals(2, mapping.size());
  }

  @Test
  public void test8() {
    TripleCollection tc1 = generateCircle(5);
    TripleCollection tc2 = generateCircle(5);
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    Assert.assertEquals(5, mapping.size());
  }
View Full Code Here

  }

  @Test
  public void test9() {
    NonLiteral crossing = new UriRef("http://example.org/");
    TripleCollection tc1 = generateCircle(2,crossing);
    tc1.addAll(generateCircle(3,crossing));
    TripleCollection tc2 = generateCircle(2,crossing);
    tc2.addAll(generateCircle(3,crossing));
    Assert.assertEquals(5, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    //a circle of 2 with 1 bnode and one of 2 bnodes
    Assert.assertEquals(3, mapping.size());
View Full Code Here

  @Test
  public void cityWeather() {
    MGraph base = new SimpleMGraph();
    Enricher cityEnricher = new CityWeatherEnricher();
    TripleCollection enrichmentTriples = new EnrichmentTriples(base,
        Collections.singleton(cityEnricher));
    NonLiteral london = new UriRef("http://example.org/london");
    NonLiteral me = new UriRef("http://example.org/me");
    base.add(new TripleImpl(me, RDF.type, FOAF.Agent));
    base.add(new TripleImpl(london, RDF.type, CityWeatherEnricher.classCity));
    Assert.assertTrue(enrichmentTriples.filter(london, CityWeatherEnricher.weatherProperty, null).hasNext());
    GraphNode node = new GraphNode(london, enrichmentTriples);
    Assert.assertEquals("0.51",
        node.getObjectNodes(CityWeatherEnricher.weatherProperty).next()
        .getLiterals(CityWeatherEnricher.humidityProperty).next().getLexicalForm());
    Assert.assertEquals(Double.toString(london.toString().length()),
View Full Code Here

  }

  @Test
  public void test10() {
    NonLiteral crossing1 = new BNode();
    TripleCollection tc1 = generateCircle(2,crossing1);
    tc1.addAll(generateCircle(3,crossing1));
    NonLiteral crossing2 = new BNode();
    TripleCollection tc2 = generateCircle(2,crossing2);
    tc2.addAll(generateCircle(3,crossing2));
    Assert.assertEquals(5, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNotNull(mapping);
    //a circle of 2 and one of 3 with one common node
    Assert.assertEquals(4, mapping.size());
View Full Code Here

  }

  @Test
  public void test11() {
    NonLiteral crossing1 = new BNode();
    TripleCollection tc1 = generateCircle(2,crossing1);
    tc1.addAll(generateCircle(4,crossing1));
    NonLiteral crossing2 = new BNode();
    TripleCollection tc2 = generateCircle(3,crossing2);
    tc2.addAll(generateCircle(3,crossing2));
    Assert.assertEquals(6, tc1.size());
    final Map<BNode, BNode> mapping = GraphMatcher.getValidMapping(tc1, tc2);
    Assert.assertNull(mapping);
  }
View Full Code Here

TOP

Related Classes of org.apache.clerezza.rdf.core.TripleCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.