Package org.wymiwyg.commons.util.text

Examples of org.wymiwyg.commons.util.text.W3CDateFormat


    Date result = null;
    while (downloadAttempts.hasNext()) {
      Resource downloadAtttempt = downloadAttempts.nextResource();
      Date time;
      try {
        time = new W3CDateFormat().parse(downloadAtttempt.getProperty(
            AGGREGATOR.time).getString());
      } catch (ParseException e) {
        throw new RuntimeException(e);
      }
      if ((result == null) || (time.after(result))) {
View Full Code Here


    Date now = new Date();

    Model logEntryModel = ModelFactory.createDefaultModel();
    Resource downloadAttempt = logEntryModel
        .createResource(AGGREGATOR.DownloadAttempt);
    downloadAttempt.addProperty(AGGREGATOR.time, new W3CDateFormat()
        .format(now), XSDDatatype.XSDdateTime);
    downloadAttempt.addProperty(AGGREGATOR.aggregatedSource, logEntryModel
        .createResource(aggregatedSource.getURIRef()));
    downloadAttempt.addProperty(AGGREGATOR.aggregator, logEntryModel
        .createResource(identity.getURIRef()));
View Full Code Here

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

    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

    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

    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

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

    FCAGraph[] graphs = new FCAGraph[2];
    graphs[0] = new FCAGraphImpl(
        modelWithStatements("_a dc:subject _b"));
    graphs[1] = new FCAGraphImpl(
        modelWithStatements("http://example.org/ dc:author 'foo'"));
    clock.setTime(new W3CDateFormat()
    .parse("2006-05-01T16:30:00Z"));
    store.updateGraph(source, graphs[0]);
    Date date2 = new W3CDateFormat().parse("2006-05-01T16:32:00Z");
    clock.setTime(date2);
    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:30:00Z"));
    assertEquals(graphs[0], retrievedGraph);
    retrievedGraph = store.getGraphOverTime(sourceSet).getGraph(date2);
    assertEquals(graphs[1], retrievedGraph);
  }
View Full Code Here

      resource.addProperty(DOCUMENT.variant, documentVariant);
      documentVariant.addProperty(DOCUMENT.contentType, mimeType.toString());
      documentVariant.addProperty(DOCUMENT.content, contentResource);
      documentVariant.addProperty(DOCUMENT.contentLength, model
          .createTypedLiteral(fileContent.length));
      Literal createdLit = model.createTypedLiteral(new W3CDateFormat()
          .format(new Date()), XSDDatatype.XSDdateTime);

      documentVariant.addProperty(DCTerms.created, createdLit);
      if ((language != null) && (!language.equals("independent"))) {
        documentVariant.addProperty(DC.language, language);
View Full Code Here

    cookie.setPath("/");
    setHeader(HeaderName.SET_COOKIE, cookie);
    Model model = temporarySubject.getModel();
    AddAction action = new AddAction();
    action.add(model.createStatement(temporarySubject, RDF.type, TEMPSUBJECT.TemporarySubject));
    action.add(model.createStatement(temporarySubject, DC.date, new W3CDateFormat().format(new Date())));
    ActionHandler.getActionHandler(model).addAction(action);
  }
View Full Code Here

TOP

Related Classes of org.wymiwyg.commons.util.text.W3CDateFormat

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.