Package com.hp.hpl.jena.gvs

Examples of com.hp.hpl.jena.gvs.FCAGraph


            }
           
            // ModelReferencingDecomposition dec = new
            // ModelReferencingDecompositionImpl(currentGraph);
            // TODO directly leanify dec
            FCAGraph retrievedGraph = store.getGraphOverTime(
                Collections.singleton(source)).getGraph(
                new Date());
            if (!retrievedGraph.equals(currentGraph)) {
              System.out.println("FAILURE!");
              JenaUtil.getModelFromGraph(currentGraph).write(
                  System.out);
              ModelFactory.createModelForGraph(retrievedGraph)
                  .write(System.out);
              PrintWriter pout = new PrintWriter(System.out);
              new MoleculeDiffImpl(
                  new ReferenceGroundedDecompositionImpl(
                      new ModelReferencingDecompositionImpl(
                          currentGraph)),
                          new ReferenceGroundedDecompositionImpl(
                              new ModelReferencingDecompositionImpl(
                                  retrievedGraph)))
                  .print(pout);
              pout.flush();
              retrievedGraph = store.getGraphOverTime(
                  Collections.singleton(source)).getGraph(
                  new Date());
              System.out.println("on second attempt: "+retrievedGraph.equals(currentGraph));
              System.exit(1);
            }
          }
          if ((i % 100) == 0) {
            System.out.println("thread " + threadNumber
View Full Code Here


          addUser(loginData, graph, request);
          response
              .setDefaultStylesheet("/application/stylesheets/verification-result");
          response.setBody(graph);
          Resource user = getUserByUsernameInIdentityGOT(loginData.userName);
          FCAGraph revokeGraphTmp = null;
          if (user != null) {
            log
                .info("Username already exist, removing previous password");
            Model revokeModel = ModelFactory.createDefaultModel();
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.passwordSha1));
            revokeModel.add(user.listProperties(FOAF.mbox_sha1sum));
            revokeModel.add(user
                .listProperties(ACCOUNTMANAGER.userName));
            revokeGraphTmp = new FCAGraphImpl(revokeModel);
            // store.revokeGraph(identity, new
            // FCAGraphImpl(revokeModel), now);
          }
          final FCAGraph revokeGraph = revokeGraphTmp;
          final FCAGraph assertGraph = new FCAGraphImpl(graph);
          // store.assertGraph(identity, new FCAGraphImpl(graph),
          // now);
          store.perform(identity, new StoreTransaction() {

            public void execute(SourceStoreView storeView) {
View Full Code Here

  private static void updateWorkingGraph(Store store, Source identity, Date now, final Source aggregatedSource, final Graph logEntryGraph) {
    store.perform(identity, new StoreTransaction() {

      public void execute(SourceStoreView storeView) {
        SimpleGraph newWorkingGraph = new SimpleGraph();
        FCAGraph oldWorkingGraph = storeView.getGraph();
        Node downloadAttemptNode = null;
        for (Triple triple : oldWorkingGraph) {
          if (triple.getObject().equals(aggregatedSource) &&
              triple.getPredicate().getURIRef().equals(AGGREGATOR.aggregatedSource.getURI())) {
            downloadAttemptNode = triple.getSubject();
            break;
          }
        }
        for (Iterator<Triple> iter = oldWorkingGraph.iterator(); iter.hasNext();) {
          Triple triple = iter.next();
          //x.equals(null) should return false, making the first condition obsolete
          if ((downloadAttemptNode == null) || !triple.getSubject().equals(downloadAttemptNode)) {
            newWorkingGraph.add(triple);
          }
View Full Code Here

    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(
        new Date());
    assertEquals(graph1, graphR);
    store = reGetStoreImpl();
View Full Code Here

    Date retrievingDate = new Date(
        (long) (testData.getDate(0).getTime() + (Math.random()
            * (1 + 1f / testData.getSize()) * (testData.getDate(
            testData.getSize() - 1).getTime() - testData.getDate(0)
            .getTime()))));
    FCAGraph expectedGraph = null;
    int graphNumber = -1;
    for (int j = 0; j < testData.getSize(); j++) {
      if (!retrievingDate.before(testData.getDate(j))) {
        graphNumber = j;
      } else {
        System.out.println(retrievingDate.getTime() + " is before "
            + testData.getDate(j).getTime());
        break;
      }
    }
    expectedGraph = testData.getGraph(graphNumber);
    System.out.println("Expecting graph number " + graphNumber + " for "
        + retrievingDate);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        retrievingDate);
    retrievedGraph = new FCAGraphImpl(MoleculeBasedLeanifier
        .getLeanVersionOf(retrievedGraph));
    boolean result = expectedGraph.equals(retrievedGraph);
    if (!result) {
View Full Code Here

    Date retrievingDate = new Date(
        (long) (testData.getDate(position).getTime() + (Math.random() * (testData
            .getSize() > (position + 1) ? (testData.getDate(
            position + 1).getTime() - testData
            .getDate(position + 1).getTime()) : 100))));
    FCAGraph expectedGraph = null;
    int graphNumber = -1;
    for (int j = 0; j < testData.getSize(); j++) {
      if (!retrievingDate.before(testData.getDate(j))) {
        graphNumber = j;
      } else {
        break;
      }
    }
    expectedGraph = testData.getGraph(graphNumber);
    System.out.println("Expecting graph number " + graphNumber + " for "
        + retrievingDate);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        retrievingDate);
    retrievedGraph = new FCAGraphImpl(MoleculeBasedLeanifier
        .getLeanVersionOf(retrievedGraph));
    boolean result = expectedGraph.equals(retrievedGraph);
    if (!result) {
View Full Code Here

    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(
        new W3CDateFormat().parse("2006-05-01T16:31:00Z"));
    assertEquals(graphs[0], retrievedGraph);
    retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        new W3CDateFormat().parse("2006-05-01T16:32:00Z"));
    assertEquals(graphs[1], retrievedGraph);
View Full Code Here

    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);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(3, retrievedGraph.size());
  }
View Full Code Here

    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);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        new W3CDateFormat().parse("2006-06-01"));
    assertEquals(4, retrievedGraph.size());
  }
View Full Code Here

    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>();
    sourceSet.add(source0);
    sourceSet.add(source1);
    sourceSet.add(source2);
    sourceSet.add(source3);
    FCAGraph retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(
        new W3CDateFormat().parse("2006-06-01"));
    Model model = JenaUtil.getModelFromGraph(retrievedGraph);
    model.write(System.out);
    assertEquals(7, retrievedGraph.size());
  }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.gvs.FCAGraph

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.