Package com.hp.hpl.jena.gvs.impl.util

Examples of com.hp.hpl.jena.gvs.impl.util.ToyClock


  public StoreTest(String name) {
    super(name);
  }

  public void testSingleSourceVersions() {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source");

    // graphs representing the state of a changing graph in chronological
    // order
    TimedGraphSequence testData = TimedGraphSequence.getRandomSequence(12,
        100);
    for (int i = 0; i < testData.getSize(); i++) {
      clock.setTime(testData
          .getDate(i));
      store
          .updateGraph(source, testData.getGraph(i));
    }
    for (int i = 0; i < 10; i++) {
View Full Code Here


    }

  }

  public void testTwoSourcesVersions() {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source0 = new SourceImpl("http://example.org/graph-source0");
    Source source1 = new SourceImpl("http://example.org/graph-source1");
    // graphs representing the state of a changing graph in chronological
    // order
    TimedGraphSequence testData0 = TimedGraphSequence.getRandomSequence(12,
        100);
    for (int i = 0; i < testData0.getSize(); i++) {
      clock.setTime(testData0
          .getDate(i));
      store.updateGraph(source0, testData0.getGraph(i));
    }
    TimedGraphSequence testData1 = TimedGraphSequence.getRandomSequence(12,
        100);
    for (int i = 0; i < testData1.getSize(); i++) {
      clock.setTime(testData1
          .getDate(i));
      store.updateGraph(source1, testData1.getGraph(i));
    }
    for (int i = 0; i < 10; i++) {
      assertTrue("retreved graph equals to original",
View Full Code Here

    }

  }

  public void testUpdate() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source#");
    Model model0 = ModelFactory.createDefaultModel();
    model0.read(StoreTest.class.getResource("update-test0.rdf").toString());
    FCAGraph graph0 = new FCAGraphImpl(model0);
    clock.setTime(new Date());
    store.updateGraph(source, graph0);
    store = null;
    Thread.sleep(2);
    store = reGetStoreImpl();
    Model model1 = ModelFactory.createDefaultModel();
    model1.read(StoreTest.class.getResource("update-test1.rdf").toString());
    FCAGraph graph1 = new FCAGraphImpl(model1);
    clock.setTime(new Date());
    store.updateGraph(new SourceImpl("http://example.org/graph-source#"),
        graph1);
    FCAGraph graphR = store.getGraphOverTime(
        Collections.singleton((Source) new SourceImpl(
            "http://example.org/graph-source#"))).getGraph(
View Full Code Here

        new Date());
    assertEquals(graph1, graphR);
  }

  public void testSources() {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source0 = new SourceImpl("http://example.org/graph-source0");
    Source source1 = new SourceImpl("http://example.org/graph-source1");
    // graphs representing the state of a changing graph in chronological
    // order
    TimedGraphSequence testData0 = TimedGraphSequence.getRandomSequence(12,
        100);
    for (int i = 0; i < testData0.getSize(); i++) {
      clock.setTime(testData0
          .getDate(i));
      store.updateGraph(source0, testData0.getGraph(i));
    }
    TimedGraphSequence testData1 = TimedGraphSequence.getRandomSequence(12,
        100);
    for (int i = 0; i < testData1.getSize(); i++) {
      clock.setTime(testData1
          .getDate(i));
      store.updateGraph(source1, testData1.getGraph(i));
    }
    assertEquals(2, store.getSources().size());
    store = reGetStoreImpl();
View Full Code Here

    }
    return result;
  }

  public void testTwoSingleSourceVersions() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source");
    FCAGraph[] graphs = new FCAGraph[2];

    // Model model1 = ModelFactory.createDefaultModel();
    // model1.createResource().addProperty(DC.subject, "test1");

    // Model model1 = modelWithStatements("_a dc:subject 'test1';
    // http://www.google.com/ foaf:maker 'ygf'");
    Model model1 = modelWithStatements("_a dc:subject _b");
    Model model2 = ModelFactory.createDefaultModel();
    model2.createResource().addProperty(DC.subject, "test2");
    graphs[0] = new FCAGraphImpl(model1);
    graphs[1] = new FCAGraphImpl(model2);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source, graphs[0]);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:32:00Z"));
    store.updateGraph(source, graphs[1]);
    Set<Source> sourceSet = new HashSet<Source>();
    sourceSet.add(source);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
View Full Code Here

        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(graphs[1], retrievedGraph);
  }

  public void testSimpleIFP() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source0 = new SourceImpl("http://example.org/graph-source0");
    Source source1 = new SourceImpl("http://example.org/graph-source1");
    Model model0 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox 'm'");
    Model model1 = modelWithStatements("_a rdfs:label 'hi'; _a http://xmlns.com/foaf/0.1/mbox 'm'");
    FCAGraph graph0 = new FCAGraphImpl(model0);
    FCAGraph graph1 = new FCAGraphImpl(model1);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source0, graph0);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:32:00Z"));
    store.updateGraph(source1, graph1);
    Set<Source> sourceSet = new HashSet<Source>();
    sourceSet.add(source0);
    sourceSet.add(source1);
View Full Code Here

        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(3, retrievedGraph.size());
  }

  public void testOneAndTwoNTifp() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source0 = new SourceImpl("http://example.org/graph-source0");
    Source source1 = new SourceImpl("http://example.org/graph-source1");
    Model model0 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox 'm'; _a http://xmlns.com/foaf/0.1/mbox 'n'");
    Model model1 = modelWithStatements("_a rdfs:label 'hi'; _a http://xmlns.com/foaf/0.1/mbox 'm'");
    FCAGraph graph0 = new FCAGraphImpl(model0);
    FCAGraph graph1 = new FCAGraphImpl(model1);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source0, graph0);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:32:00Z"));
    store.updateGraph(source1, graph1);
    Set<Source> sourceSet = new HashSet<Source>();
    sourceSet.add(source0);
    sourceSet.add(source1);
View Full Code Here

        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(4, retrievedGraph.size());
  }

  public void testCrossoverIFP() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source0 = new SourceImpl("http://example.org/graph-source0");
    Source source1 = new SourceImpl("http://example.org/graph-source1");
    Source source2 = new SourceImpl("http://example.org/graph-source2");
    Source source3 = new SourceImpl("http://example.org/graph-source3");
    Model model0 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox 'm'; _a http://xmlns.com/foaf/0.1/mbox 'n'");
    Model model1 = modelWithStatements("_a rdfs:label 'hi'; _a http://xmlns.com/foaf/0.1/mbox 'm'");
    Model model2 = modelWithStatements("_a rdfs:comment 'foo'; _a http://xmlns.com/foaf/0.1/mbox 'n'; _a http://xmlns.com/foaf/0.1/mbox 'o'");
    Model model3 = modelWithStatements("_a rdfs:comment 'bar'; _a http://xmlns.com/foaf/0.1/mbox 'o'");
    FCAGraph graph0 = new FCAGraphImpl(model0);
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    FCAGraph graph3 = new FCAGraphImpl(model3);
    clock.setTime(new W3CDateFormat()
        .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source0, graph0);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:32:00Z"));
    store.updateGraph(source1, graph1);
    store.updateGraph(source2, graph2);
    store.updateGraph(source3, graph3);
    Set<Source> sourceSet = new HashSet<Source>();
View Full Code Here

    model.write(System.out);
    assertEquals(7, retrievedGraph.size());
  }

  public void testReaddingSame() throws Exception {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source");
    FCAGraph[] graphs = new FCAGraph[3];
    graphs[0] = new FCAGraphImpl(
        modelWithStatements("_a dc:subject ''"));
    graphs[1] = new FCAGraphImpl(
        modelWithStatements("_a dc:author 'bla'"));
    graphs[2] = new FCAGraphImpl(
        modelWithStatements("_a dc:subject ''"));
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source, graphs[0]);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:32:00Z"));
    store.updateGraph(source, graphs[1]);
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-02T02:16:00Z"));
    store.updateGraph(source, graphs[2]);
    Set<Source> sourceSet = new HashSet<Source>();
    sourceSet.add(source);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
View Full Code Here

        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(graphs[2], retrievedGraph);
  }

  public void testNamedUnnamed() {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);;
    Source source = new SourceImpl("http://example.org/graph-source");
    FCAGraph[] graphs = new FCAGraph[3];
    graphs[0] = new FCAGraphImpl(
        modelWithStatements("_a dc:subject 'nbmnb'"));
    graphs[1] = new FCAGraphImpl(
            modelWithStatements("urn:urn-5:BvkoXZbrJ83FXCkas0+D67bgHJo= dc:subject _b"));
    graphs[2] = new FCAGraphImpl(
            modelWithStatements("urn:urn-5:BvkoXZbrJ83FXCkas0+D67bgHJo= dc:author _b"));
    TimedGraphSequence tgs = TimedGraphSequence
        .getSequenceWithRandomDates(graphs);
    for (int i = 0; i < tgs.getSize(); i++) {
      clock.setTime(tgs.getDate(i));
      store.updateGraph(source, tgs.getGraph(i));
    }
    compareVersionAtPosition(store, source, tgs, 1);
    // tgs.write(System.out);
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.gvs.impl.util.ToyClock

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.